Lab 14: Prelab Questions


Written Questions

Question #1: A stack is a sequence container allows inserts at the ____________ and removal at the ____________ of the sequence.

Question #2: A queue is a sequence container allows inserts at the ____________ and removal at the ____________ of the sequence.

Question #3: A stack is implemented with the ____________ class template in the ____________ library; a queue is implemented with the ____________ class template in the ____________ library.

Question #4: A stack is known as a "last in, ____________" container.

Question #5: A queue is known as a "first in, ____________" container.

Programming Exercises

Code #1: Write a declaration for a stack of ints named cards.

Code #2: Write a declaration for a queue of doubles named waitingLine.

Code #3: Write statements that inserts the value 3 in cards and also adds it to waitingLine.

Code #4: Write an expression whose value is the top value of cards; write an expression whose value is the front value of waitingLine.

Code #5: Write expressions that test if value and moreValues are empty.


Lab Exercise
Report errors to Larry Nyhoff (nyhl@cs.calvin.edu)