MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
One difference between a queue and a stack is:
A
Queues require dynamic memory, but stacks do not
B
Stacks require dynamic memory, but queues do not.
C
Queues use two ends of the structure; stacks use only one.
D
Stacks use two ends of the structure, queues use only one.
Explanation: 

Detailed explanation-1: -The primary difference between Stack and Queue Data Structures is that Stack follows LIFO while Queue follows FIFO data structure type. LIFO refers to Last In First Out.

Detailed explanation-2: -One difference between a queue and a stack is: Queues use two ends of the structure; stacks use only one. If the characters ‘D’, ‘C’, ‘B’, ‘A’ are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?

Detailed explanation-3: -Stacks use two ends of the structure, queues use only one.

Detailed explanation-4: -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).

There is 1 question to complete.