C++ Programming banner
Fourth EditionD.S. Malik
Chapters:

Chapter 19

Self-Test

INSTRUCTIONS: Answer each question below. Click the 'Grade Test' button to receive a graded study guide. You will not get a grade until all questions are answered.

  1. When evaluating a postfix expression with a stack, you ____ when you encounter an operator in the input.
    1. A: push one operand onto the stack
    2. B: pop two operands off the stack
    3. C: push two operands onto the stack
    4. D: pop one operand off the stack
  2. The ____ constructor is called when a stack object is passes as a (value) parameter to a function.
    1. A: default
    2. B: copy
    3. C: initial
    4. D: overloaded
  3. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six
  4. For classes with pointer member variables, the ____ operator must be explicitly overloaded.
    1. A: comparison
    2. B: assignment
    3. C: equality
    4. D: None of the above
  5. In the serverListType class presented in this chapter, the value of ____ indicates that all the servers are busy.
    1. A:  -1
    2. B:  0
    3. C:  NULL
    4. D:  false
  6. When an item is pushed onto a linked stack, ____ is assigned to the new node's link.
    1. A:  stackTop ’s link
    2. B:  stackTop
    3. C: the value NULL
    4. D: the value -1
  7. In an array-based stack, the index of the top element in the stack is ____.
    1. A:  stackTop
    2. B:  stackTop-1
    3. C:  maxStackSize
    4. D:  0
  8. In a stack implemented with a dynamic array, which of the following functions must be provided?
    1. A: overloaded assignment operator
    2. B: destructor
    3. C: copy constructor
    4. D: all of the above
  9. In a time-driven simulation, the clock is implemented as a ____.
    1. A: class
    2. B: counter variable
    3. C: list
    4. D: queue
  10. The ____ operation retrieves the top element of the stack, but leaves the stack unchanged.
    1. A:  get
    2. B:  retrieve
    3. C:  top
    4. D:  pop
  11. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  12. The ____ operation of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  13. A(n) _____ expression is one in which the operators are written between the operands.
    1. A: Polish
    2. B: postfix
    3. C: prefix
    4. D: infix
  14. A stack is a list of ____ elements.
    1. A: primitive
    2. B: immutable
    3. C: heterogeneous
    4. D: homogeneous
  15. In a linked queue, if the queue is empty, calling the function ____ will terminate the program.
    1. A:  front
    2. B:  isEmpty
    3. C:  isFull
    4. D:  initializeQueue
  16. The deleteQueue function if a linked queue has a return value of ____.
    1. A:  void
    2. B:  Type
    3. C:  int
    4. D:  linkedQueueType<Type>
  17. The addition and deletion of elements in a stack only occurs at one end, called the ____ of the stack.
    1. A: bottom
    2. B: top
    3. C: front
    4. D: back
  18. Charles L. Hamblin proposed a scheme in which the operators follow the operands, resulting in the _____ notation.
    1. A: Reverse Polish
    2. B: Pascal Case
    3. C: prefix
    4. D: Reverse Curve
  19. It is best to use a(n) ____ to print a list backwards.
    1. A: linked implementation of a queue
    2. B: array-based implementation of a stack
    3. C: linked implementation of a stack
    4. D: array-based implementation of a queue
  20. The initializeStack stack function ____.
    1. A: is called by the constructor
    2. B: sets the size of the stack
    3. C: calls the constructor
    4. D: initializes the stack to an empty state