• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top 50 Data Structures MCQs with Answers

Question 11

Which one of the following is an application of Queue Data Structure?

  • When a resource is shared among multiple consumers.

  • When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes

  • Load Balancing

  • All of the above

Question 12

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?

  • (ii) is true

  • (i) and (ii) are true

  • (iii) is true

  • (ii) and (iv) are true

Question 13

Which of the following option is not correct?

  • If the queue is implemented with a linked list, keeping track of a front pointer, Only rear pointer s will change during an insertion into an non-empty queue.

  • Queue data structure can be used to implement least recently used (LRU) page fault algorithm and Quick short algorithm.

  • Queue data structure can be used to implement Quick short algorithm but not least recently used (LRU) page fault algorithm.

  • Both (A) and (C)

Question 14

Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are

  • Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT

  • Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR

  • Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT

  • Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT

Question 15

The minimum number of stacks needed to implement a queue is

  • 3

  • 1

  • 2

  • 4

Question 16

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
  • Θ(√n)
  • Θ(log2(n))
  • Θ(n2)
  • Θ(n)

Question 17

Consider a binary tree with n nodes, where each node can have at most two children. The height of the tree is defined as the maximum number of edges between the root node and any leaf node. Which of the following statements is true regarding the height h of this binary tree?

  • The height of the tree is always equal to n-1.

  • The height of the tree can be greater than or equal to n-1.

  • The height of the tree is always equal to log₂(n).

  • The height of the tree can be greater than or equal to log₂(n).

Question 18

A size-balanced binary tree is a binary tree in which for every node, the difference between the number of nodes in the left and right subtree is at most 1. The distance of a node from the root is the length of the path from the root to the node. The height of a binary tree is the maximum distance of a leaf node from the root. a. Prove, by using induction on h, that a size-balance binary tree of height h contains at least 2h nodes. b. In a size-balanced binary tree of height h≤1, how many nodes are at distance h−1 from the root? Write only the answer without any explanations.

    Question 19

    Draw the binary tree with node labels a, b, c, d, e, f and g for which the inorder and postorder traversals result in the following sequences:
    Inorder       a f b c d g e
    Postorder     a f c g e d b
    
    

      Question 20

      Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is
      • Ω(logn)
      • Ω(n)
      • Ω(nlogn)
      • Ω(n2)

      There are 50 questions to complete.

      Last Updated :
      Take a part in the ongoing discussion