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. 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
  2. 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
  3. In an array-based implementation of a queue, queueRear is initialized to ____.
    1. A:  maxQueueSize
    2. B:  maxQueueSize - 1
    3. C:  queueFront
    4. D:  maxQueueSize + 1
  4. 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
  5. When a stack class is derived from unorderedLinkedList , all of the following stack functions make a call to the base class EXCEPT ____.
    1. A:  top
    2. B:  push
    3. C:  pop
    4. D:  initializeStack
  6. A queue is a(n) ____ data structure.
    1. A: FIFO
    2. B: immutable
    3. C: LIFO
    4. D: primitive
  7. The isFullStack function ____.
    1. A: determines whether the stack is full
    2. B: determines whether the stack is empty
    3. C: loads items onto the stack
    4. D: removes items from the stack
  8. A stack is a list of ____ elements.
    1. A: primitive
    2. B: immutable
    3. C: heterogeneous
    4. D: homogeneous
  9. An additional ____ variable can be used in a circular array implementation of queue to indicate whether the queue is empty or full.
    1. A: Boolean
    2. B: constant
    3. C: pointer
    4. D: counter
  10. 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
  11. 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
  12. 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>
  13. A(n) _____ expression is one in which the operators are written before the operands.
    1. A: infix
    2. B: postfix
    3. C: prefix
    4. D: Reverse Polish
  14. When popping elements off a linked stack, the stackTop pointer is ____.
    1. A: assigned the address of the popped element
    2. B: unchanged
    3. C: assigned the value -1 if the stack becomes empty
    4. D: assigned the address of its link
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. In a queue, elements are deleted from the end called the ____.
    1. A: back
    2. B: rear
    3. C: top
    4. D: front