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 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
  2. 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
  3. 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
  4. The ____ operation of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  5. 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
  6. 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
  7. 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
  8. 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
  9. The stack is a(n) ____ data structure.
    1. A: FIFO
    2. B: circular
    3. C: LIFO
    4. D: static
  10. 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
  11. A linked implementation of a queue is similar to a(n) ____.
    1. A: array-based implementation of a list
    2. B: array-based implementation of a stack
    3. C: linked list implementation created in a backward manner
    4. D: linked list implementation created in a forward manner
  12. 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
  13. In a circular array-based implementation of a queue. the rear of the queue is assigned the position ____.
    1. A:  maxQueueSize
    2. B:  queueRear + 1
    3. C:  (queueRear + 1) % maxQueueSize
    4. D:  queueRear % maxQueueSize + 1
  14. 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
  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. 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
  17. A linked queue is empty if _____ is NULL .
    1. A:  queueFront->link
    2. B:  queueRear->link
    3. C:  queueFront
    4. D:  queueRear
  18. A queue is a(n) ____ data structure.
    1. A: FIFO
    2. B: immutable
    3. C: LIFO
    4. D: primitive
  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. 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