Open In App

GATE | GATE CS 1996 | Question 12

Like Article
Like
Save Article
Save
Share
Report issue
Report

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.

Hence Option (C) is the correct answer.


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


Last Updated : 28 May, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads