MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The five items:A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is
A
A
B
B
C
C
D
D
E
E
Explanation: 

Detailed explanation-1: -Answer: Its called stack overflow.

Detailed explanation-2: -stack::push() push() function is used to insert or ‘push’ an element at the top of the stack.

Detailed explanation-3: -Stack: A stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top. A stack follows the LIFO (Last In First Out) principle, i.e., the element inserted at the last is the first element to come out.

Detailed explanation-4: -Stack is a linear data structure in which the insertion and deletion operations are performed at only one end. In a stack, adding and removing of elements are performed at single position which is known as “top". That means, new element is added at top of the stack and an element is removed from the top of the stack.

There is 1 question to complete.