Which operation is typically NOT efficient on a standard array?
Retrieving the value at a given index.
Finding the length of the array.
Inserting an element at the beginning.
Updating an element at a given index.
Which sorting algorithm works by repeatedly selecting the minimum element and placing it in its correct position?
Bubble Sort
Merge Sort
Selection Sort
Quick Sort
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.
Reversing all elements in the matrix.
Finding the sum of all elements in the matrix.
You want to find the first occurrence of a specific element in a sorted array. Which search algorithm is the most efficient?
Linear Search
It depends on the size of the array.
Both are equally efficient in this case.
Binary Search
Which code snippet correctly initializes a 2D array named 'grid' with 3 rows and 4 columns, all filled with zeros?
int grid[3][4]; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) grid[i][j] = 0;
int grid[3][4] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int grid[3][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
int grid[3][4] = {0};
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)
Consider a 2D array storing characters to represent a word search grid. You want to check if a given word exists in the grid horizontally or vertically. Which algorithm would be suitable for this task?
Depth First Search (DFS)
What is the main disadvantage of using bubble sort for large datasets?
It has a high time complexity, making it inefficient.
It requires additional memory space.
It cannot handle duplicate values.
It is difficult to implement.
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 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.
What is the primary advantage of using binary search over linear search?
Binary search uses less memory.
Binary search is generally faster for large arrays.
Binary search works on unsorted arrays.
Binary search is simpler to implement.