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 ____ of the queue is accessed whenever an element is deleted from the queue.
    1. A: back
    2. B: front
    3. C: middle
    4. D: None of the above
  2. 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
  3. The isEmptyStack function ____.
    1. A: initializes a stack to an empty state
    2. B: sets the size of a stack
    3. C: determines whether an item can be removed from a stack
    4. D: determines whether an item can be added to a stack
  4. 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
  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. Which of the following is the general loop condition to process the information of a stack?
    1. A:  while (stackTop == current)
    2. B:  while (stackTop != -1)
    3. C:  while (stack.isFull())
    4. D:  while (!stack.isEmptyStack())
  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. 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
  9. A linked queue is empty if _____ is NULL .
    1. A:  queueFront->link
    2. B:  queueRear->link
    3. C:  queueFront
    4. D:  queueRear
  10. 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
  11. An object that provides a service in a queuing system is called a _____.
    1. A: customer
    2. B: server
    3. C: transaction
    4. D: simulator
  12. 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
  13. 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>
  14. A ____ array can solve the problem of queue overflow in the rear.
    1. A: circular
    2. B: dynamic
    3. C: static
    4. D: parallel
  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. 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
  17. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  18. 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
  19. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six
  20. 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