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. 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
  2. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six
  3. 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
  4. 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
  5. 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
  6. 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
  7. The ____ operation of a stack adds a new element to the top of the stack.
    1. A:  push
    2. B:  insert
    3. C:  pop
    4. D:  top
  8. 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
  9. 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
  10. 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>
  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. 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
  13. A queue is a(n) ____ data structure.
    1. A: FIFO
    2. B: immutable
    3. C: LIFO
    4. D: primitive
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  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 linked queue implementation in this chapter uses _____ pointers to maintain the queue.
    1. A: one
    2. B: two
    3. C: three
    4. D: four