• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Data Structures in DSA with Answers

Question 11

Which data structure in a compiler is used for managing information about variables and their attributes?
  • Abstract syntax tree
  • Symbol table
  • Semantic stack
  • Parse Table

Question 12

An Abstract Data Type (ADT) is:

  • Same as an abstract class

  • A data type that cannot be instantiated

  • A data type for which only the operations defined on it can be used, but none else

  • All of the above

Question 13

A data structure is required for storing a set of integers such that each of the following operations can be done in (log n) time, where n is the number of elements in the set.
   o	Delection of the smallest element 
   o	Insertion of an element if it is not already present in the set

Which of the following data structures can be used for this purpose?
  • A heap can be used but not a balanced binary search tree
  • A balanced binary search tree can be used but not a heap
  • Both balanced binary search tree and heap can be used
  • Neither balanced binary search tree nor heap can be used

Question 14

A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with ∞, and hence there cannot be any entry to the right of, or below a ∞. The following Young tableau consists of unique entries.
1     2     5      14
3     4     6      23       
10    12    18     25  
31    ∞     ∞       ∞ 
When an element is removed from a Young tableau, other elements should be moved into its place so that the resulting table is still a Young tableau (unfilled entries may be filled in with a ∞). The minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau is ____________
  • 2
  • 5
  • 6
  • 18

Question 15

What is the value of theta  
  • -1
  • 1
  • 0
  • π

Question 16

A language L is a subset of Pascal with the following constructs: a). Expressions involving the operators \'+\' and \'<\' only b). Assignment statements c). \'while\' statements and d). Compound statements with the syntax \'begin..............end\' Give an unambiguous grammar for L.

    Question 17

    Consider the following program fragment in Pascal:
    Program Main;
        var X : integer;
        procedure A:
           var Y : integer;
        procedure B:
           var Z : integer;
        procedure C:
           var Z : integer;
        begin(*Procedure C*)
        .
        .
        end(*Procedure C*)
     begin(*Procedure B*)
        .
        .
     C; (*call to C*)
     A; (*call to A*)
            .
            .
    
     end(*Procedure B*)
     begin(*Procedure A*)
            .
            .
            B; (*call to B*)
            .
            .
      end(*Procedure A*)
    begin (*Main*)
    
    
    Assume that there are no calls to any procedures other than the ones indicated above. It is known that at some point of time during the execution of this program five activation records exist on the run-time stack. Describe the run-time stack at this point of time by clearly indicating the following: the top of the stack, the contents of the static link and dynamic link, and allocation of the local variables in each record.

      Question 18

      Consider a 2D-array A[10][20] using row major order in memory and the memory location we want to access is A[y, z]. Known that each memory address occupies 4-bytes. Below is the 3-address code for the same, fill the blank spaces with correct value :
      x : A[y, z]
      
      t1 = ---(1)--- * ---(2)---
      t2 = t1  +  z
      t3 = t2  *  ---(3)---
      ---(4)--- = base address of A
      x = t4[---(5)---]
      
      
      • (1) : x (2) : 10 (3) : 4 (4) : t4 (5) : t3
      • (1) : y (2) : 10 (3) : t4 (4) : 4 (5) : t3
      • (1) : y (2) : 20 (3) : 4 (4) : t4 (5) : t3
      • None of these

      Question 19

      A list of n strings, each of length n, is sorted into lexicographic order using merge - sort algorithm. The worst case running time of this computation is :
      • O(n log n)
      • O(n2log n)
      • O(n2 + log n)
      • O(n3)

      Question 20

      Heap allocation is required for languages that
      • use dynamic scope rules
      • support dynamic data structures
      • support recursion
      • support recursion and dynamic data structures

      There are 39 questions to complete.

      Last Updated :
      Take a part in the ongoing discussion