What is the function of the peek method in a stack implementation?

A. to return the bottom item without removing it
B. to return the top item without removing it
C. to return the top item and remove it from the stack
D. to return the bottom item and remove it from the stack

Answer: B

Computer Science & Information Technology

You might also like to view...

An example of a component would be:

a) a button b) a timer c) a form d) All of the above

Computer Science & Information Technology

A method that does not alter a linked list, but simply looks at it to determine whether it’s empty, is referred to as a(n) _____________ method.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology