You are given a 2D array representing a matrix. What does transposing this matrix mean?
Sorting the matrix in ascending order.
Swapping rows and columns of the matrix.
Finding the sum of all elements in the matrix.
Reversing all elements in the matrix.
What is the time complexity of finding the length of an array in most programming languages?
O(n) - Linear Time
O(1) - Constant Time
O(n^2) - Quadratic Time
O(log n) - Logarithmic Time
How can you efficiently delete a specific element from the middle of a sorted array while maintaining the sorted order?
By swapping the element with the last element and then removing it.
By directly removing the element and leaving the space empty.
By shifting all the elements after the deleted element one position back.
Deletion in a sorted array always disrupts the order.
Given an array of integers, how can you efficiently count the occurrences of a specific element?
All of the above methods are equally efficient.
Sort the array and use binary search.
Iterate through the array and increment a counter for each occurrence.
Use a hash map to store the frequency of each element.
Which operation is typically NOT efficient on a standard array?
Updating an element at a given index.
Finding the length of the array.
Retrieving the value at a given index.
Inserting an element at the beginning.
What is the time complexity of accessing an element in a 2D array with 'm' rows and 'n' columns?
O(log m + log n)
O(m * n)
O(1)
O(m + n)
What is the primary advantage of using binary search over linear search?
Binary search is generally faster for large arrays.
Binary search is simpler to implement.
Binary search uses less memory.
Binary search works on unsorted arrays.
Which of the following is a valid array declaration in a common programming language (syntax may vary slightly)?
All of the above.
array numbers = [1, 2, 3, 4];
int numbers[] = {1, 2, 3, 4};
numbers = array(1, 2, 3, 4);
What is the main disadvantage of using bubble sort for large datasets?
It is difficult to implement.
It has a high time complexity, making it inefficient.
It requires additional memory space.
It cannot handle duplicate values.
What is the purpose of having a base address associated with an array in memory?
To store the value of the first element in the array.
To store the length of the array.
To identify the starting memory location where the array is stored.
To indicate the data type of elements stored in the array.