200 views
0 0 votes

A queue is implemented using an array of size $6$ with two indices $\verb|front|$ and $\verb|rear|$.

Initially, $\verb|front = rear = -1|$.

The following operations are performed in order:

ENQUEUE(10)
ENQUEUE(20)
ENQUEUE(30)
DEQUEUE()
ENQUEUE(40)
ENQUEUE(50)
DEQUEUE()
ENQUEUE(60)


Assume queue is simple linear queue


Which of the following options is correct?

  1. $\verb|front = 2|$, $\verb|rear = 5|$, Queue elements: $30, 40, 50, 60$
     
  2. $\verb|front = 1|$, $\verb|rear = 4|$, Queue elements: $20,30,40,50$
     
  3. $\verb|front = 2|$, $\verb|rear = 4|$, Queue elements: $30,40,50$
     
  4. $\verb|front = 3|$, $\verb|rear = 5|$, Queue elements: $40,50,60$

1 Answer

Answer:
Position:
Show:

Related questions

0 0 votes
1 1 answer
260
260 views
GO Classes asked Dec 26, 2025
260 views
Consider the following undirected, unweighted graph with vertices$\verb|V = {A, B, C, D, E, F}|$ and edges:(A, B), (A, C), (B, D), (C, D), (C, E), (D, F), (E, F)A Breadth...
0 0 votes
1 1 answer
224
224 views
GO Classes asked Dec 26, 2025
224 views
Consider the following Python code: def make_funcs(): funcs = [] for i in range(3): funcs.append(lambda x: x + i) return funcs f1, f2, f3 = make_f...
1 1 vote
1 1 answer
225
225 views
GO Classes asked Dec 26, 2025
225 views
Consider the following Python code: A={i: i*i for i in range(3)} B = A C = A.copy() A[3] = 9 B[4] = 16 C[5] = 25 print(len(A), len(B), len(C))}What will be printed by the...
0 0 votes
1 1 answer
250
250 views
GO Classes asked Dec 26, 2025
250 views
Consider the following Python program: x = [1, 2, 3] def g(y): y = y + [4] return y def h(y): y.append(4) return y p = g(x) q = h(x) print(x, p, q...