Given a circular array-based queue Q capable of holding 7 objects. After…

Given a circular array-based queue Q capable of holding 7 objects. After execution of the following code, find the element at location ‘2’, if the array is initially empty array location start from 0.

for (int k = 1; k <= 7; k++)

Q.enqueue(k);

for (int k = 1; k< 4; k++)

{

Q.enqueue(Q.dequeue());

Q.dequeue ();

}

Assume enqueue and dequeue are circular queue operations for insertion and deletion respectively.__________

Attempted by 145 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…