C++ Programming banner
Fourth EditionD.S. Malik

Chapter 19


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. 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
  2. The isFullQueue function ____.
    1. A: returns an int value
    2. B: always returns the value false in a linked queue
    3. C: always returns the value false in an array-based queue
    4. D: is not implemented in a linked queue
  3. 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
  4. A stack is a list of ____ elements.
    1. A: primitive
    2. B: immutable
    3. C: heterogeneous
    4. D: homogeneous
  5. A stack element can be accessed ____.
    1. A: only at the top of the stack
    2. B: only at the bottom of the stack
    3. C: either at the top or bottom of the stack
    4. D: from anywhere in the stack
  6. In a circular array-based implementation of a queue. the rear of the queue is assigned the position ____.
    1. A:  maxQueueSize
    2. B:  queueRear + 1
    3. C:  (queueRear + 1) % maxQueueSize
    4. D:  queueRear % maxQueueSize + 1
  7. Computer ____ is a technique in which one system models the behavior of another system.
    1. A: cloning
    2. B: queuing
    3. C: linkage
    4. D: simulation
  8. 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
  9. 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
  10. Many compilers translate arithmetic expressions into ____ notation and then translate this expression into machine code.
    1. A: postfix
    2. B: Polish
    3. C: infix
    4. D: prefix
  11. In a linked representation of a stack, the stack is considered to be full ____.
    1. A: when stackTop = NULL
    2. B: when stackTop = maxStackSize
    3. C: only if the computer runs out of memory
    4. D: if the stack is uninitialized
  12. If you try to remove an item from an empty stack, the resulting condition is called a(n) ____.
    1. A: underflow
    2. B: simulation error
    3. C: circular condition
    4. D: overflow
  13. A queue is a(n) ____ data structure.
    1. A: FIFO
    2. B: immutable
    3. C: LIFO
    4. D: primitive
  14. 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
  15. 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
  16. In a linked queue, the definition of the destructor is similar to the definition of the ____ function.
    1. A:  deleteQueue
    2. B: copy constructor
    3. C: constructor
    4. D:  initializeQueue
  17. The stack is a(n) ____ data structure.
    1. A: FIFO
    2. B: circular
    3. C: LIFO
    4. D: static
  18. When using a stack to print a list backwards, ____ in the linked list is saved on the stack.
    1. A: the data of each node
    2. B: a string representing the output of each node
    3. C: a pointer to each node
    4. D: each node
  19. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  20. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six