Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 16 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

1.

Elements in an array are accessed _____________

A. randomly
B. sequentially
C. exponentially
D. logarithmically
Answer» B. sequentially
2.

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

A. 0
B. -1
C. 2
D. 1
Answer» B. -1
3.

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

A. 15
B. 19
C. 11
D. 60
Answer» E.
4.

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
Answer» C. Index value of an array can be negative
5.

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
Answer» E.
6.

Which of the following concepts make extensive use of arrays?

A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality
Answer» E.
7.

When does the ArrayIndexOutOfBoundsException occur?

A. Compile-time
B. Run-time
C. Not an error
D. Not an exception at all
Answer» C. Not an error
8.

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

A. int[] arr;
B. int arr[[]];
C. int[][]arr;
D. int[[]] arr;
Answer» D. int[[]] arr;
9.

WHEN_DOES_THE_ARRAYINDEXOUTOFBOUNDSEXCEPTION_OCCUR??$

A. Compile-time
B. Run-time
C. Not an error
D. None of the mentioned
Answer» E.
10.

What are the advantages of arrays?$

A. Easier to store elements of same data type
B. Used to implement other data structures like stack and queue
C. Convenient way to represent matrices as a 2D array
D. All of the mentioned
Answer» E.
11.

Which_of_the_following_concepts_make_extensive_use_of_arrays?$

A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality
Answer» E.
12.

3 and 5

A. 5 and 3
B. 2 and 4
C. 4 and 2
Answer» D.
13.

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. All of the mentioned
Answer» E.
14.

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);
Answer» D. int arr() = new int(3);
15.

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);
Answer» D. int arr(3) = (1,2,3);
16.

Which of these best describes an array?

A. A data structure that shows a hierarchical behavior
B. Container of objects of similar types
C. Container of objects of mixed types
D. All of the mentioned
Answer» C. Container of objects of mixed types