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. 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
  2. A linked queue is empty if _____ is NULL .
    1. A:  queueFront->link
    2. B:  queueRear->link
    3. C:  queueFront
    4. D:  queueRear
  3. 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
  4. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  5. A(n) _____ consists of servers and queues of objects waiting to be served.
    1. A: customer transaction
    2. B: linked simulation system
    3. C: queuing system
    4. D: time-driven simulation
  6. 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
  7. In a queue, elements are deleted from the end called the ____.
    1. A: back
    2. B: rear
    3. C: top
    4. D: front
  8. The ____ operation of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  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. 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
  11. 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
  12. 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
  13. In the queuing system simulation presented in this chapter, the list of servers is stored in a(n) ____.
    1. A: dynamic array
    2. B: linked list
    3. C: linked queue
    4. D: array-based queue
  14. 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
  15. 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
  16. 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
  17. 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
  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. 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
  20. 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