What condition indicates an empty circular queue?
A. rear == size
B. rear == front - 1
C. front == rear
D. front == -1
D. front == -1
Which queue type is best suited for continuous insertion and deletion?
A. Stack
B. Array Queue
C. Linear Queue
D. Circular Queue
D. Circular Queue
What happens when a dequeue operation is performed on an empty queue?
A. Overflow
B. Underflow
C. Null Return
D. -999
D. -999
What principle does a linear queue follow?
A. Random
B. FILO
C. LIFO
D. FIFO
D. FIFO
Which operation inserts an element into a queue?
A. Peek
B. Pop
C. Enqueue
D. Dequeue
C. Enqueue
Which operation retrieves the front element without removing it?
A. Pop
B. Peek
C. Dequeue
D. Enqueue
B. Peek
Which queue type may falsely appear full due to fixed array limits?
A. Stack
B. Linear Queue
C. Linked Queue
D. Circular Queue
B. Linear Queue
Which pointer update causes wrap-around in circular queues?
A. rear = size - rear
B. rear = (rear + 1) % size
C. rear = rear + 1
D. rear = rear - 1
B. rear = (rear + 1) % size
Which queue uses modulo arithmetic to manage pointer movement?
A. Circular Queue
B. Array Queue
C. Linear Queue
D. Stack
A. Circular Queue
How is the front index updated in a circular queue after deletion?
A. front = front - 1
B. front = size - front
C. front = front + 1
D. front = (front + 1) % size
D. front = (front + 1) % size
Which queue type prevents memory wastage by wrapping around the array?
A. Circular Queue
B. Linked Queue
C. Linear Queue
D. Stack
A. Circular Queue
Which queue type allows reuse of vacant spaces after deletion?
A. Array Queue
B. Linear Queue
C. Stack
D. Circular Queue
D. Circular Queue
What condition indicates a full circular queue?
A. (rear + 1) % size == front
B. rear == size - 1
C. rear == front - 1
D. front == rear
A. (rear + 1) % size == front
How is the rear index updated in a circular queue after insertion?
A. rear = size - rear
B. rear = rear - 1
C. rear = rear + 1
D. rear = (rear + 1) % size
D. rear = (rear + 1) % size
Which queue type is more memory-efficient for fixed-size arrays?
A. Linear Queue
B. Stack
C. Circular Queue
D. Array Queue
C. Circular Queue
Which operation removes the front element from a queue?
A. Push
B. Dequeue
C. Peek
D. Enqueue
B. Dequeue
What condition indicates a full linear queue (array-based)?
A. front == rear
B. front == -1
C. rear == front
D. rear == size - 1
D. rear == size - 1
What is the initial value of front and rear in an empty linear queue?
A. 0
B. -1
C. 1
D. NULL
B. -1
In circular queues, which arithmetic operation ensures pointer reset?
A. Division
B. Modulo
C. Addition
D. Subtraction
B. Modulo
Which queue type cannot reuse space after front deletions?
A. Stack
B. Linked Queue
C. Linear Queue
D. Circular Queue
C. Linear Queue
What is the output of the following code?
queue q = new(queue, 3)
enqueue(q, 4)
enqueue(q, 8)
enqueue(q, 12)
enqueue(q, 16)
A. Queue Overflow
B. 16
C. -999
D. [4, 8, 12, 16]
A. Queue Overflow
Which of the following correctly completes the enqueue method below?
public int enqueue(T el) {
if (isFull()) return -999;
if (isEmpty()) front = 0;
rear = (rear + 1) % maxQSize;
que[_____] = _____;
return 1;
}
A. rear + 1, el
B. maxQSize, el
C. front, el
D. rear, el
D. rear, el
What is the output of the following code?
queue q = new(queue, 3)
enqueue(q, 5)
enqueue(q, 10)
dequeue(q)
print(q.que[q.front])
10
Which of the following correctly completes the dequeue method below?
public int dequeue() {
if (isEmpty(q))
return -999;
else {
int el = q.que[q.front];
if (q.front == q.rear)
clear();
else
q.front = (q.front + 1) % maxQSize;
_____;
}
}
A. return q.que[q.front];
B. return q.rear;
C. return q.front;
D. return el;
D. return el;