Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE CS 1996 | Question 12

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Consider the following statements:

i.   First-in-first out types of computations are efficiently supported by STACKS.
ii.  Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.
iv.  Last-in-first-out type of computations are efficiently supported by QUEUES.

Which of the following is correct?

(A)

(ii) is true

(B)

(i) and (ii) are true

(C)

(iii) is true

(D)

(ii) and (iv) are true


Answer: (C)

Explanation:

The correct statement is:

iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.

Explanation:

i. STACKS are used to implement Last-in-First-Out (LIFO) operations, not First-in-First-out (FIFO) operations. Therefore, statement i is incorrect.

ii. Implementing LISTS on a linked list is more efficient for some operations, such as adding or removing elements in the middle of the list, but it is less efficient for other operations, such as accessing elements by index. Therefore, the statement is incorrect.

iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices. This is because with a circular array, the front and rear indices wrap around when they reach the end of the array, making it more efficient toenqueue and dequeue elements. Therefore, the statement is correct.

iv. QUEUES are used to implement First-in-First-out (FIFO) operations, not Last-in-First-out (LIFO) operations. Therefore, statement iv is incorrect.


Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Last Updated : 28 May, 2020
Like Article
Save Article
Similar Reads