Array: GATE CS Previous Year Questions

Array · Data Structures

17 questions · asked in 12 of 27 years (2000–2026)

MCQ 15 · NAT 21-mark 13 · 2-mark 4

2000Questions per year2026

Questions 11–15 of 17

Q11GATE 20051 markMCQ−0.33 if wrong
Let a and b be two sorted arrays containing n integers each, in non-decreasing order. Let c be a sorted array containing 2n integers obtained by merging the two arrays a and b. Assuming the arrays are indexed starting from 0, consider the following four statements

I. a[i]≥b[i]⇒c[2i]≥a[i]a[i] \geq b [i] \Rightarrow c[2i] \geq a [i]
II. a[i]≥b[i]⇒c[2i]≥b[i]a[i] \geq b [i] \Rightarrow c[2i] \geq b [i]
III. a[i]≥b[i]⇒c[2i]≤a[i]a[i] \geq b [i] \Rightarrow c[2i] \leq a [i]
IV. a[i]≥b[i]⇒c[2i]≤b[i]a[i] \geq b [i] \Rightarrow c[2i] \leq b [i]

Which of the following is TRUE?

Q12GATE 20051 markMCQ−0.33 if wrong
A program P reads in 500 integers in the range [0,100] representing the scores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies?

Q13GATE 20041 markMCQ−0.33 if wrong
Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major or column-major order in contiguous memory locations. The time complexity of an algorithm to compute M1 x M2 will be

Q14GATE 20021 markMCQ−0.33 if wrong
Consider the following algorithm for searching for a given number x in an unsorted array A[1.....n] having n distinct values :

(1) Choose an i uniformly at random from [1....n]
(2) If A[i] = x then stop else Goto 1;

Assuming that x is present A, What is the expected number of comparisons made by the algorithm before it terminates?

Q15GATE 20021 markMCQ−0.33 if wrong
Consider the following declaration of a two-dimensional array in C :

Char a[100][100]
Assuming that the main memory is byte-addressable and that array is stored starting from memory address 0, the address of a [40] [50] is

Keep practising

Topics in Data Structures

All CS topics ›