GATE Exam » GATE MCQs » Data Structure MCQs

Data Structure MCQs

The data structure is an important part of the computer language. The collection of all the input values and their functions and modifications make a part of computer language.

Data forms an integral part of the computer language. In the computer language, the data could be anything like a numeric value, alphabetical value or a special character. 

There are many types of data structure in various computer languages like C++, python, Java etc. Data structures like Hash Tables, Trees, Graphs etc are some of the type of data structures easily found in the computer languages. 

MCQs (Multiple Choice Questions)

Q1 Provide the format for the representation of string in the memory in C language? 

  1. Represented as an array of characters
  2. Can be represented as an object of some type of class
  3. Could be the same just as the other primitive data types
  4. Could be the Linked list of Characters

Answer: 1

The correct way for the representation of string in the memory in C language is represented as an Array of Characters. 

Q2 Can you tell the advantage of using the array data structure among the following statements? 

  1. The entities of mixed type of data types could be easily stored
  2. The access to the elements present in the array is a little easy
  3.  Always the index number of the first element present starts from the number 1
  4.  None of the above 

Ans: 2 is the correct answer because, in an array, the elements present are stored in the block of memory. So it becomes easy to access it. 

Q3 Which among the following is the queue data structure’s applications? 

  1. When among the many or multiple users, a resource is shared.
  2. Balancing of the load.
  3. When the transferring of the data is asynchronous
  4. All of the above

Answer: 4 All the above as all these features are the applications of queue type of data structure

Q4 Name the type of data structure among the following that could be used to implement queues? 

  1. Linked List type of data structure
  2. Arrays type of data structure
  3. Stack type of data structure
  4. All of the above following type

Answer: 4 As all the above following options could be used for the implementation of queues, option 4 is the right answer. 

Q5 Among the following options, which of the following type of data structure is used in recursion? 

  1. Queues type of data structure
  2. Array type of data structures
  3. List type of data structures
  4. Stack type of data structures

Answer: 4 In recursion, the type of data structure that finds its use is the Stack type of data structure. 

Q6 The data structure that allows the insertion, as well as the deletion from both the ends, are:

  1. String type of data structure
  2. Queue type of data structure
  3. Stack type of data structure
  4. Dequeue type of data structure 

Answer: 4 The type of data structure that allows insertion, as well as the deletion from both the ends, is the dequeue type of data structure. 

Q7 For getting best time complexity in the worst case scenario, which type of sorting algorithms are used? 

  1. Bubble sort of algorithm
  2. Selection sort of algorithm
  3. Quick sort of algorithm
  4. Merge sort of algorithm

Answer: 4 because among the following, merge sort of algorithm is used. 

Q8 For processing queries on trees, which of the following algorithm is ised and found to be highly useful? 

  1. Centroid type of algorithm
  2. Heavy Light Decomposition type of algorithm
  3. Both A and B are correct
  4.  None of the above

For handling the queries on trees, both centroid as well as the heavy light decomposition type of algorithm are used. 

Q9 In C++ language, the maps implemented use which kind of a data structure? 

  1. Hash tables type of structure
  2. Red Black tree type of data structure
  3. Data structure such as AVL trees
  4. Binary Search trees type of structure

Answer: 2 For the implementation of maps in C++ language, Red Black Tree type of data structure is used 

Q 10 Among the following, what all could be done on Linkedlist? 

  1. For the binary trees to be implemented
  2. For the stacks and queues to be implemented
  3. Dynamic Array
  4. All of the above

Answer: 4 For implementing the type of data structure that can be helpful is simulating Dynamic Array

Q11 For implementing the recursive algorithm which type of data structure is used? 

  1.  List type of data structure
  2. Array type of data structure
  3.  Stack type of data structure
  4. Queue type of data structure

Answer: 3 The stack type of data structure is used for implementing the recursive algorithm

Q12 What do one mean by bit array term? 

  1. It is a data structure used for the representation of the arrays
  2. It is a data structure that stores bits
  3. It is a type  of array in which most of the elements possess the same value
  4. It is a type of array in which the elements are present in discontinuous location

Answer: 2 It is a data structure that helps in storing in bits

Q13. Among the following, which is not an advantage of using a bit array? 

  1. The exploit bit level parallelism type
  2. Maximum use of data cache feature
  3. It is helpful for storing and manipulating in the register set for a longer period of time
  4. For the access of individual elements making it easier

Answer: 4 Bit array makes it easier for handling individual elements as it is really complicated to handle them at once 

Q14 To toggle a particular bit, which of the following bitwise operator would be used? 

  1. OR operator
  2. AND operator
  3. XOR operator
  4.  NOT operator

Answer: 3 XOR operator is used to toggle a particular bit in the bitwise operations

Q15  To set a particular bit to 1, which of the following bitwise operation can be used in it? 

  1. OR operator
  2. AND operator
  3. XOR operator
  4. NOR operator

Answer: 1 because OR operator is used in the bitwise operations to set a particular bit to 1

Q16 who is responsible for coining the term Sparse Matrix? 

  1. Arthur Cayley
  2. James Sylvester
  3. Harry Markowitz
  4. Chris Messines

Answer: 3 It was coined by Harry Markowitz whereas Arthur Cayley is responsible for developing the algebraic aspect of matrix. 

Ques 17 Which among the following matrix has lots of elements as zero? 

  1. Unit matrix type
  2. Identity matrix type
  3. Zero matrix type
  4. Sparse matrix type

Answer: 4 The matrix that has lots of elements as zero is sparse matrix

Q18 What can be the relation between sparsity and density in a matrix? 

  1. Sparsity = 1- Density
  2. Sparsity = Density + 1
  3. Sparsity = Total number of elements * density
  4. Sparsity = Density divided by total number of elements

Answer: 1 The correct relation is Sparsity = 1- Density

Q19 For the multiplication of matrix, which among the following properties is not true? 

  1. Associative property
  2. Distributive property
  3. Commutative property
  4. Additive property. 

Answer: 3 The commutative property does not hold true for matrix. 

Q20 Which is an important advantage of matrices? 

  1. Plotting of graph
  2. Internal Complexity
  3. Less efficiency of space
  4. None of the above

Answer: 1 The graph plotting property is an important advantage of matrices.