Consider the following statements: i. First-in-first out types of computations…

2024

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?

  1. A.

    (ii) and (iii) are true

  2. B.

    (i) and (ii) are true

  3. C.

    (iii) and (iv) are true

  4. D.

    (ii) and (iv) are true

Attempted by 257 students.

Show answer & explanation

Correct answer: A

Explanation:

i -STACK is the data structure that follows Last In First Out (LIFO) or First In Last Out (FILO) order, in which the element which is inserted at last is removed out first.

ii - Implementing LISTS on linked lists is more efficient than implementing it on an array for almost all the basic LIST operations because the insertion and deletion of elements can be done in O(1) in Linked List but it takes O(N) time in Arrays.

iii- Implementing QUEUES on a circular array is more efficient than implementing it on a linear array with two indices because using circular arrays, it takes less space and can reuse it again.

iv - QUEUE is the data structure that follows First In First Out (FIFO) or Last In Last Out (LILO) order, in which the element which is inserted first is removed first.

only (ii) and (iii) are TRUE. Option (A) is correct.

Explore the full course: Coding For Placement