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 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
  2. 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
  3. The ____ function of a stack is declared as a private member.
    1. A:  initializeStack
    2. B:  top
    3. C:  copyStack
    4. D:  isEmptyStack
  4. 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
  5. The ____ operation of a stack removes the top element of the stack.
    1. A:  back
    2. B:  pop
    3. C:  top
    4. D:  push
  6. 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
  7. 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
  8. 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
  9. 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>
  10. 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
  11. 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
  12. 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
  13. A linked queue is empty if _____ is NULL .
    1. A:  queueFront->link
    2. B:  queueRear->link
    3. C:  queueFront
    4. D:  queueRear
  14. 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
  15. 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
  16. 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
  17. 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())
  18. 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
  19. 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
  20. A stack is a list of ____ elements.
    1. A: primitive
    2. B: immutable
    3. C: heterogeneous
    4. D: homogeneous