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 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
  2. 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
  3. 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
  4. 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
  5. The array-based queue implementation in this chapter has ____ private member variables.
    1. A: two
    2. B: three
    3. C: five
    4. D: six
  6. 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
  7. Computer ____ is a technique in which one system models the behavior of another system.
    1. A: cloning
    2. B: queuing
    3. C: linkage
    4. D: simulation
  8. 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
  9. In a queue, elements are deleted from the end called the ____.
    1. A: back
    2. B: rear
    3. C: top
    4. D: front
  10. 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
  11. A stack is a list of ____ elements.
    1. A: primitive
    2. B: immutable
    3. C: heterogeneous
    4. D: homogeneous
  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. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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())
  20. 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