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 16–17 of 17

Q16GATE 20001 markMCQ−0.33 if wrong
Suppose you are given an array s[1....n] and a procedure reverse (s, i, j) which reverses the order of elements in s between positions i and j (both inclusive). What does the following sequence do, where 1 ⩽k⩽\leqslant k \leqslant n:
 reverse (s, 1, k);
 reverse (s, k+1, n);
 reverse (s, 1, n); 

Q17GATE 20001 markMCQ−0.33 if wrong
An n×nn \times n array vv is defined as follows:
v[i,j]=i−jv\left[i,j\right] = i - j for all i,j,1≤i≤n,1≤j≤ni, j, 1 \leq i \leq n, 1 \leq j \leq n
The sum of the elements of the array vv is

Keep practising

Topics in Data Structures

All CS topics ›