MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Show the content of a queue after the following operations are execute. Initialize (Q)Add (A, Q)Add (F, Q)Add (X, Q)Remove (Q)
A
A and F
B
A and X
C
F and X
D
A, F and X
Explanation: 

Detailed explanation-1: -Dequeue Operation Dequeue means removing an element from the queue. Since queue follows the FIFO principle we need to remove the element of the queue which was inserted at first.

Detailed explanation-2: -The operation of adding an element to the rear of the queue is known as enqueue, and the operation of removing an element from the front is known as dequeue. Other operations may also be allowed, often including a peek or front operation that returns the value of the next element to be dequeued without dequeuing it.

Detailed explanation-3: -In a queue, one end is always used to insert data (enqueue) and the other is used to delete data (dequeue), because queue is open at both its ends. The enqueue() and dequeue() are two important functions used in a queue.

There is 1 question to complete.