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.
Which of the following sorting algorithms has the best average-case time complexity?
Insertion Sort
Merge Sort
Selection Sort
Bubble Sort
Given an array of integers, how can you efficiently count the occurrences of a specific element?
Iterate through the array and increment a counter for each occurrence.
All of the above methods are equally efficient.
Sort the array and use binary search.
Use a hash map to store the frequency of each element.
Which sorting algorithm works by repeatedly selecting the minimum element and placing it in its correct position?
Quick Sort
Which of the following is a valid array declaration in a common programming language (syntax may vary slightly)?
numbers = array(1, 2, 3, 4);
All of the above.
array numbers = [1, 2, 3, 4];
int numbers[] = {1, 2, 3, 4};
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.
Deletion in a sorted array always disrupts the order.
By shifting all the elements after the deleted element one position back.
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 a key difference between a 1D array and a 2D array?
1D arrays store numbers while 2D arrays store characters.
1D arrays represent linear sequences, 2D arrays represent tabular data.
1D arrays can only be accessed sequentially, 2D arrays allow random access.
1D arrays are static in size, 2D arrays can change size dynamically.
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 works on unsorted arrays.
Binary search uses less memory.
What is the purpose of having a base address associated with an array in memory?
To indicate the data type of elements stored in the array.
To store the value of the first element in the array.
To identify the starting memory location where the array is stored.
To store the length of the array.