Top 350+ Solved Data Structures (DS) MCQ Questions Answer

From 1 to 15 of 370

Q. Which of these best describes an array?

a. A data structure that shows a hierarchical behaviour

b. Container of objects of similar types

c. Arrays are immutable once initialised

d. Array is not a data structure

  • b. Container of objects of similar types

Q. How do you initialize an array in C?

a. int arr[3] = (1,2,3);

b. int arr(3) = {1,2,3};

c. int arr[3] = {1,2,3};

d. int arr(3) = (1,2,3);

  • c. int arr[3] = {1,2,3};

Q. How do you instantiate an array in Java?

a. int arr[] = new int(3);

b. int arr[];

c. int arr[] = new int[3];

d. int arr() = new int(3);

  • c. int arr[] = new int[3];

Q. Which of the following is a correct way to declare a multidimensional array in Java?

a. int[] arr;

b. int arr[[]];

c. int[][]arr;

d. int[[]] arr;

  • c. int[][]arr;

Q. When does the ArrayIndexOutOfBoundsException occur?

a. Compile-time

b. Run-time

c. Not an error

d. Not an exception at all

  • b. Run-time

Q. Which of the following concepts make extensive use of arrays?

a. Binary trees

b. Scheduling of processes

c. Caching

d. Spatial locality

  • d. Spatial locality

Q. What are the advantages of arrays?

a. Objects of mixed data types can be stored

b. Elements in an array cannot be sorted

c. Index of first element of an array is 1

d. Easier to store elements of same data type

  • d. Easier to store elements of same data type

Q. What are the disadvantages of arrays?

a. Data structure like queue or stack cannot be implemented

b. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

c. Index value of an array can be negative

d. Elements are sequentially accessed

  • b. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

Q. Elements in an array are accessed

a. randomly

b. sequentially

c. exponentially

d. logarithmically

  • a. randomly

Q. Which of the following is not a disadvantage to the usage of array?

a. Fixed size

b. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

c. Insertion based on position

d. Accessing elements at specified positions

  • d. Accessing elements at specified positions

Q. What is the time complexity of inserting at the end in dynamic arrays?

a. O(1)

b. O(n)

c. O(logn)

d. Either O(1) or O(n)

  • d. Either O(1) or O(n)

Q. What is the space complexity for deleting a linked list?

a. O(1)

b. O(n)

c. Either O(1) or O(n)

d. O(logn)

  • a. O(1)
Subscribe Now

Get All Updates & News