Array


Question 1
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
A
\Theta (\sqrt{n})
B
\Theta ( \log _2 (n))
C
\Theta ( n^2)
D
\Theta ( n)
GATE CSE 2021 SET-2   Data Structure
Question 2
Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of n elements. Which one of the following choices is correct?
A
t \gt 2n-2
B
t \gt 3\lceil \frac{n}{2}\rceil \text{ and } t\leq 2n-2
C
t \gt n \text{ and } t\leq 3\lceil \frac{n}{2}\rceil
D
t \gt \lceil \log_2(n)\rceil \text{ and } t\leq n
GATE CSE 2021 SET-1   Data Structure


Question 3
If an array A contains the items 10, 4, 7, 23, 67, 12 and 5 in that order, what will be the resultant array A after third pass of insertion sort?
A
67,12,10,5,4,7,23
B
4,7,10,23,67,12,5
C
4,5,7,67,10,12,23
D
10,7,4,67,23,12,5
ISRO CSE 2020   Data Structure
Question 4
Consider a 2-dimensional array x with 10 rows and 4 columns, with each element storing a value equivalent to the product of row number and column number. The array is stored in row-major format. If the first element x[0][0] occupies the memory location with address 1000 and each element occupies only one memory location, which all locations (in decimal) will be holding a value of 10?
A
1018,1019
B
1022,1041
C
1017,1036
D
1000,1399
ISRO CSE 2020   Data Structure
Question 4 Explanation: 
Originally all Options are wrong. We have modified one option.
Click here for detail solution by gateoverflow
Question 5
An array A consists of n integers in locations A[0],A[1],...A[n-1]. It is required to shift the elements of the array cyclically to the left by k places, where 1 \leq k \leq (n-1). An incomplete algorithm for doing this in linear time, without using another array is given bellow. Complete the algorithm by filling in the blanks.
 min=n; i=0;
while(_________) {
    temp= A[i]; j=i;
    while(_________) {
        A[j]= _______;
        j=(j+k) mod n;
        if(j < min) then
        min = j;
    }
    A[(n+i-k) mod n]=_______;
    i=________;
    
}
A
i \gt \min ; \quad j !=(n+1) \bmod n ; \quad A[j+k] \quad \text { temp; } \quad i+1 ;
B
i \lt \min ; \quad j !=(n+i) \bmod n ; \quad A[j+k] \quad \text { temp; } \quad i+1 ;
C
i \gt \min ; \quad j !=(n+i+k) \bmod n ; \quad A[j+k] \quad \text { temp; } \quad i+1 ;
D
i \lt \min ; \quad j !=(n+i-k) \bmod n ; \quad A[(j+k) \bmod n] \quad \text { temp; } \quad i+1 ;
ISRO CSE 2018   Data Structure


There are 5 questions to complete.

3 thoughts on “Array”

Leave a Comment