Array in Data Structure

@T-Bone

This question paper focuses on the "Array" of Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This question paper focuses on the "Array" of Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. A program P reads in 500 integers in the range [0..100] exepresenting 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?

Mark the correct option

2. Which of these best describes an array?

Mark the correct option

3. Let A be a square matrix of size n x n. Consider the following program. What is the expected output? C = 100 for i = 1 to n do for j = 1 to n do { Temp = A[i][j] + C A[i][j] = A[j][i] A[j][i] = Temp - C } for i = 1 to n do for j = 1 to n do Output(A[i][j]);

Mark the correct option

4. hat is the output of the following piece of code? public class array { public static void main(String args[]) { int []arr = {1,2,3,4,5}; System.out.println(arr[2]); System.out.println(arr[4]); } }

Mark the correct option

5. Consider an array A[20, 10], assume 4 words per memory cell and the base address of array A is 100. What is the address of A[11, 5] ? Assume row major storage.

Mark the correct option

6. What is the output of the following piece of code? public class array { public static void main(String args[]) { int []arr = {1,2,3,4,5}; System.out.println(arr[5]); } }

Mark the correct option

7. Which of the following is an illegal array definition?

Mark the correct option

8. Which of the following concepts make extensive use of arrays?

Mark the correct option

9. et A[1...n] be an array of n distinct numbers. If i < j and A[i] > A[j], then the pair (i, j) is called an inversion of A. What is the expected number of inversions in any permutation on n elements ?

Mark the correct option

10. Which of the following operations is not O(1) for an array of sorted data. You may assume that array elements are distinct.

Mark the correct option

11. The smallest element of an array's index is called its

Mark the correct option

12. The extra key inserted at the end of the array is called a,

Mark the correct option

13. The largest element of an array index is called its

Mark the correct option

14. Each array declaration need not give, implicitly or explicitly, the information about

Mark the correct option

15. The elements of an array are stored successively in memory cells because

Mark the correct option

Index of Questions