![]() |
VOOZH | about |
Question 1
Given a sorted 1D array, which technique finds whether a pair with sum = X exists in O(n) time ?
Binary Search
Nested Loops
Two pointer technique
Hashing
Question 2
What is the minimum number of comparisons required to find both the minimum and maximum element in a 1D array of size n?
2n
n
3n/2 -2
n²
Question 3
Which in-place procedure deletes the element at index k from a 1D array of length n (shifting remaining)?
Swap A[k] with A[nā1], then reduce length by 1
For i from k to nā2, set A[i] = A[i+1]
Mark A[k] as null
Reverse subarray [k..nā1]
Question 4
In a circular buffer of size n, to advance a write index by one modulo n, compute:
(idx + 1) & n
(idx + 1) % n
idx++
(idx ā 1 + n) % n
Question 5
Which in-place sequence of operations rotates a 1D array right by k positions?
Reverse entire array, reverse first k, then reverse remaining nāk
Reverse first k, reverse remaining, then reverse entire
Swap pairs (i, i+k) for all i
Shift everything right one at a time, k times
Question 6
Reversing a 1D array of length n in place requires how many element swaps?
n
n / 2
n ā 1
(n + 1) / 2
Question 7
Which in-place procedure deletes the element at index k from a 1D array of length n (shifting remaining)?
Swap A[k] with A[nā1], then reduce length by 1
For i from k to nā2, set A[i] = A[i+1]
Mark A[k] as null
Reverse subarray [k..nā1]
Question 8
Consider the below program. What is the expected output?
swapping the elements pairwise
sorting the elements
Reverse an array
None
Question 9
Refer the below diagram and identify the problem.
Normal traversal of the matrix.
Row-wise traversal of the matrix.
Column-wise traversal of the matrix.
spiral traversal of the matrix.
Question 10
Fill in the blanks for completing the program to rotate an array by d elements.
p <= d , i < n - 1 , arr[n - 1] = last;
p < d, i < n, arr[n] = last;
p >=d, i >n , arr[n] = last
None
There are 26 questions to complete.