solution - Data Structures and Algorithms : Array (Test 1)

Question : What is an array?

Solution :
33720260611030111 Correct Answer : Collection of elements of the same data type stored in contiguous memory locations

Description -

Data Structures and Algorithms : Array (Test 1)

Question : The index of the first element in most programming language arrays is:

Solution :
228820260611030030 Correct Answer : 0

Description -

Data Structures and Algorithms : Array (Test 1)

Question : What is the size of the array int arr[10]?

Solution :
475120260611025946 Correct Answer : 10

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which operation takes O(1) time in an array?

Solution :
115520260611025839 Correct Answer : Accessing an element by index

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which memory allocation is used for arrays?

Solution :
436820260611025758 Correct Answer : Contiguous

Description -

Data Structures and Algorithms : Array (Test 1)

Question : In an array of size 15, the last valid index is:

Solution :
46520260611025720 Correct Answer : 14

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which data structure is best represented using arrays?

Solution :
42520260611025646 Correct Answer : Matrix

Description -

Data Structures and Algorithms : Array (Test 1)

Question : What happens if you access an invalid array index?

Solution :
490220260611025602 Correct Answer : Runtime error or undefined behavior

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which traversal method visits every element exactly once?

Solution :
274820260611025445 Correct Answer : Linear Traversal

Description -

Data Structures and Algorithms : Array (Test 1)

Question : What is the time complexity of traversing an array of n elements?

Solution :
570120260611025405 Correct Answer : O(n)

Description -

Data Structures and Algorithms : Array (Test 1)

Question : A 2D array is also known as:

Solution :
35020260611025306 Correct Answer : Matrix

Description -

Data Structures and Algorithms : Array (Test 1)

Question : How many elements are in a 4 × 5 matrix?

Solution :
744620260611025229 Correct Answer : 20

Description -

Data Structures and Algorithms : Array (Test 1)

Question : In a matrix A[3][4], how many rows exist?

Solution :
452720260611025138 Correct Answer : 3

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Address calculation in row-major order depends on:

Solution :
688520260611025033 Correct Answer : Number of columns

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which representation is used by C language for multidimensional arrays?

Solution :
605720260611024955 Correct Answer : Row-major

Description -

Data Structures and Algorithms : Array (Test 1)

Question : What is the total number of elements in a 3D array A[2][3][4]?

Solution :
566620260611024920 Correct Answer : 24

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which searching algorithm requires a sorted array?

Solution :
835320260611024840 Correct Answer : Binary Search

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Worst-case complexity of binary search is:

Solution :
792020260611024757 Correct Answer : O(log n)

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Inserting an element at the beginning of an array requires:

Solution :
873020260611024644 Correct Answer : Shifting all elements right

Description -

Data Structures and Algorithms : Array (Test 1)

Question : What is the time complexity of insertion at the beginning?

Solution :
666520260611024538 Correct Answer : O(n)

Description -

Data Structures and Algorithms : Array (Test 1)

Question : A sparse matrix is a matrix:

Solution :
991920260611024446 Correct Answer : Having mostly zero elements

Description -

Data Structures and Algorithms : Array (Test 1)

Question : A matrix of size 100 × 100 contains only 50 non-zero elements. It is:

Solution :
112220260611024349 Correct Answer : Sparse Matrix

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which representation saves memory for sparse matrices?

Solution :
101220260611024312 Correct Answer : Both B and C

Description -

Data Structures and Algorithms : Array (Test 1)

Question : In triplet representation, each non-zero element is stored as:

Solution :
348120260611024214 Correct Answer : Row, Column, Value

Description -

Data Structures and Algorithms : Array (Test 1)

Question : The first row in triplet representation generally contains:

Solution :
848420260611024116 Correct Answer : Matrix dimensions and number of non-zero elements

Description -

Data Structures and Algorithms : Array (Test 1)

Question : A 5 × 5 identity matrix has how many non-zero elements?

Solution :
476720260611024039 Correct Answer : 5

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Memory complexity of storing a sparse matrix in normal form is:

Solution :
346120260611023937 Correct Answer : Depends on total matrix size

Description -

Data Structures and Algorithms : Array (Test 1)

Question : Which matrix is always sparse when its size becomes very large?

Solution :
460020260611023858 Correct Answer : Identity Matrix

Description -

Data Structures and Algorithms : Array (Test 1)

Question : For a sparse matrix with 1000 rows, 1000 columns, and 20 non-zero elements, triplet representation stores:

Solution :
454920260611023711 Correct Answer : 21 rows of triplets (including header)

Description -

Data Structures and Algorithms : Array (Test 1)