Data Structure and Algorithms (DSA) MCQs with answers Page - 82

Here, you will find a collection of MCQ questions on Data Structure and Algorithms (DSA). Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. When does the ArrayIndexOutOfBoundsException occur?

  • (A) Compile-time
  • (B) Run-time
  • (C) Not an error
  • (D) Not an exception at all

A

Admin • 833.24K Points
Coach

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

  • (A) Binary trees
  • (B) Scheduling of processes
  • (C) Caching
  • (D) Spatial locality

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

Q. Assuming int is of 4bytes, what is the size of int arr[15];?

  • (A) 15
  • (B) 19
  • (C) 11
  • (D) 60

A

Admin • 833.24K Points
Coach

Q. In general, the index of the first element in an array is

  • (A) 0
  • (B) -1
  • (C) 2
  • (D) 1

A

Admin • 833.24K Points
Coach

Q. Elements in an array are accessed

  • (A) randomly
  • (B) sequentially
  • (C) exponentially
  • (D) logarithmically

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

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)

A

Admin • 833.24K Points
Coach

Q. What is the time complexity to count the number of elements in the linked list?

  • (A) O(1)
  • (B) O(n)
  • (C) O(logn)
  • (D) O(n2)