MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
____ operation returns the value of the topmost element of the stack.
A
push
B
pop
C
peep
D
update
Explanation: 

Detailed explanation-1: -In computer science, peek is an operation on certain abstract data types, specifically sequential collections such as stacks and queues, which returns the value of the top ("front") of the collection without removing the element from the collection.

Detailed explanation-2: -C++ Stack top() function returns the value of the top element in the stack. The top element is the one which was recently added on the stack. The last added element is the top element.

Detailed explanation-3: -Peek Operation: Peek operations involve returning the topmost data element of the stack without removing it from the stack.

Detailed explanation-4: -There are basically three operations that can be performed on stacks. They are 1) inserting an item into a stack (push). 2) deleting an item from the stack (pop). 3) displaying the contents of the stack (peek or top).

There is 1 question to complete.