CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

The five items A, B, C, D and E are pushed in a stack one after the other starting from A. The stack is popped 4 times and each element is inserted in a queue then 2 element are deleted form the queue and pushed back on the stack. Now 1 item is popped from the stack the popped item is _________.

A
A
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
B
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
C
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
D
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D D

Stack is an ordered list of similar data type. Stack is a LIFO (Last in First out) structure or FILO (First in Last out). Push () function is used to insert new elements into the Stack and pop () function is used to remove an element from the stack.

Queue is a data structure. Unlike stacks, a queue is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out and the data item stored first will be accessed first.

We pushed five elements A to E.

E

D

C

B

A



904907_916975_ans_22b1aa9a9e92488785f26c369eff5ada.PNG

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Kepler's Law
PHYSICS
Watch in App
Join BYJU'S Learning Program
CrossIcon