MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
items are being added at the top of the stack
A
Push
B
Pop
C
Peek
D
None of the above
Explanation: 

Detailed explanation-1: -The basic operations supported by a stack are push and pop. Push adds an element at the top of a stack. Pop removes the topmost element of a stack.

Detailed explanation-2: -Push operation refers to inserting an element in the stack. Since there’s only one position at which the new element can be inserted-Top of the stack, the new element is inserted at the top of the stack. Pop operation refers to the removal of an element.

Detailed explanation-3: -A stack is a limited access data structure, a container of objects that are inserted and removed according to the last-in first-out (LIFO) principle. Elements can be added and removed from the stack only at the top. A stack can be empty or it consists of a top and the rest which is a stack.

Detailed explanation-4: -The “top” element of the stack is the element that was last pushed and will be the first to be popped. The “bottom” element of the stack is the one that, when removed, will leave the stack empty.

There is 1 question to complete.