GateAI
Linear Structures, Trees and Heaps

GATE CSE 2016 Set 1 · Q10

MCQ1 markEasy

Time

A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is **CORRECT** (nn refers to the number of items in the queue)?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) Both operations can be performed in O(1) time

Linear Structures, Trees and Heaps

A queue can be efficiently implemented using a circular array with two pointers, front and rear.

  • ENQUEUE operation: Increments the rear pointer using modulo arithmetic (rear = (rear + 1) % capacity) and inserts the element at array[rear]. This takes $O(1)$ time.

  • DEQUEUE operation: Removes the element at array[front] and increments the front pointer using modulo arithmetic (front = (front + 1) % capacity). This also takes $O(1)$ time.

Since both operations perform a constant number of operations without shifting remaining elements, both ENQUEUE and DEQUEUE run in O(1)O(1) time.

Therefore, option A is correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Linear Structures, Trees and Heaps previous year question is Q10 of the GATE CSE 2016 Set 1 paper. Find more GATE CSE PYQs on Linear Structures, Trees and Heaps in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Linear Structures, Trees and Heaps PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Linear Structures, Trees and Heaps in GATE CSE

Linear Structures, Trees and Heaps has 14 GATE CSE PYQs across 12 papers from 2012 to 2026. 7 of them are 1-mark MCQs like this one, and GATE CSE 2016 Set 1 has 2.

How GATE tests Linear Structures, Trees and Heaps

More from GATE CSE 2016 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2016 Set 1 · Q10 · MCQ

A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.