What is the space complexity of storing a 2D array with 'm' rows and 'n' columns?
O(1)
O(m)
O(m * n)
O(n)
If you have an array of size 5 and you try to add a 6th element to it, what is a likely outcome?
An error or exception will occur indicating an out-of-bounds access.
The behavior is undefined and can lead to unpredictable program crashes.
The new element will overwrite the value at the first index (index 0).
The array will automatically resize to accommodate the new element.
In an array with indices starting at 0, what is the index of the last element in an array of size 'n'?
n - 1
0
It depends on the data type of the array.
n
What is the time complexity of accessing an element in a 2D array with 'm' rows and 'n' columns?
O(m + n)
O(log m + log n)
What is the purpose of having a base address associated with an array in memory?
To identify the starting memory location where the array is stored.
To indicate the data type of elements stored in the array.
To store the length of the array.
To store the value of the first element in the array.
Which sorting algorithm works by repeatedly selecting the minimum element and placing it in its correct position?
Selection Sort
Quick Sort
Bubble Sort
Merge Sort
What is the primary advantage of using binary search over linear search?
Binary search is simpler to implement.
Binary search works on unsorted arrays.
Binary search uses less memory.
Binary search is generally faster for large arrays.
What is the time complexity of finding the length of an array in most programming languages?
O(log n) - Logarithmic Time
O(n^2) - Quadratic Time
O(1) - Constant Time
O(n) - Linear Time
How is an element at row 'i' and column 'j' typically accessed in a 2D array named 'matrix'?
matrix[i][j]
matrix[i, j]
matrix(i)[j]
matrix.get(i, j)
You are given a 2D array representing a matrix. What does transposing this matrix mean?
Sorting the matrix in ascending order.
Finding the sum of all elements in the matrix.
Swapping rows and columns of the matrix.
Reversing all elements in the matrix.