MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which is the correct operation for:"Add item to the rear of the queue.”
A
enQueue(item)
B
Append.Queue(item)
C
enQueue()
D
AddItem(EnQueue())
Explanation: 

Detailed explanation-1: -In the queue only two operations are allowed enqueue and dequeue. Enqueue means to insert an item into the back of the queue, dequeue means removing the front item.

Detailed explanation-2: -When we insert the first element in a Queue, front and rear both are set to 0. When we insert a new element, the rear gets incremented, i.e., rear=rear+1.

Detailed explanation-3: -enqueue(): Inserts an element at the end of the queue i.e. at the rear end. dequeue(): This operation removes and returns an element that is at the front end of the queue.

Detailed explanation-4: -Insertion and deletion in queues takes place from the opposite ends of the list. The insertion takes place at the rear of the list and the deletion takes place from the front of the list. Insert operation is called push operation. Insert operation is called enqueue operation.

There is 1 question to complete.