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 retrieves the top element of the stack, but leaves the stack unchanged.
    1. A:  get
    2. B:  retrieve
    3. C:  top
    4. D:  pop
  2. 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
  3. 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>
  4. A queue is a(n) ____ data structure.
    1. A: FIFO
    2. B: immutable
    3. C: LIFO
    4. D: primitive
  5. 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
  6. 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
  7. 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
  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. The stack is a(n) ____ data structure.
    1. A: FIFO
    2. B: circular
    3. C: LIFO
    4. D: static
  10. The ____ operation of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  11. 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
  12. In a queue, elements are deleted from the end called the ____.
    1. A: back
    2. B: rear
    3. C: top
    4. D: front
  13. 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
  14. 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
  15. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  16. 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
  17. 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
  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 implementation of a queue, queueRear is initialized to ____.
    1. A:  maxQueueSize
    2. B:  maxQueueSize - 1
    3. C:  queueFront
    4. D:  maxQueueSize + 1
  20. 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())