## Arrays

 Question 1

 A 4 B 5 C 6 D 7
Data-Structures       Arrays       GATE 2015 -(Set-2)
Question 1 Explanation:
 Question 2
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?
 A An array of 50 numbers B An array of 100 numbers C An array of 500 numbers D A dynamically allocated array of 550 numbers
Data-Structures       Arrays       Gate-2005
Question 2 Explanation:
→ Here we are storing values above 50 and we are ignoring the scores which is less than 50.
→ Then using array of 50 numbers is the best way to store the frequencies.
 Question 3

 A I, II, and IV only B II, III, and IV only C II and IV only D IV only
Data-Structures       Arrays       Gate-2003
Question 3 Explanation:
i) A[2] can be consider as a pointer and this will not give any compile-time error.
ii) A[2][3] This results an integer, no error will come.
iii) B[1] is a base address of an array. This will not be changed it will result a compile time error.
iv) B[2][3] This also results an integer. No error will come.
 Question 4

 A 4040 B 4050 C 5040 D 5050
Data-Structures       Arrays       Gate-2002
Question 4 Explanation:
Address for a[40][50] = BaseAddress + [40 * 100 * element size] + [50 * element size]
= 0 + [40 * 100 * 1] + [50 * 1]
= 4000 + 50
= 4050
 Question 5

 A Rotates s left by k positions B Leaves s unchanged C Reverses all elements of s D None of the above
Data-Structures       Arrays       Gate-2000
Question 5 Explanation:
If we perform the three given open operations it will result left rotation by K positions. If we perform n time it will result the initial array.
 Question 6

 A 15i + j + 84 B 15j + i + 84 C 10i + j + 89 D 10j + i + 89
Data-Structures       Arrays       Gate-1998
Question 6 Explanation:
The address of element A[i][j] will be,
100 + 15 * (i-1) + (j-1)
= 100 + 15i - 15 + j - 1
= 15i + j + 84
There are 6 questions to complete.