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 of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  2. 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
  3. In a queue, elements are deleted from the end called the ____.
    1. A: back
    2. B: rear
    3. C: top
    4. D: front
  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. 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
  6. 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
  7. In a linked queue, if the queue is empty, calling the function ____ will terminate the program.
    1. A:  front
    2. B:  isEmpty
    3. C:  isFull
    4. D:  initializeQueue
  8. 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
  9. 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
  10. 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
  11. A ____ array can solve the problem of queue overflow in the rear.
    1. A: circular
    2. B: dynamic
    3. C: static
    4. D: parallel
  12. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six
  13. 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
  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. 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
  16. 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())
  17. If you try to add a new element to a full stack, the resulting condition is called a(n) ____.
    1. A: underflow
    2. B: simulation error
    3. C: circular condition
    4. D: overflow
  18. 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
  19. 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
  20. 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>