Array and Array Operations Multiple Questions and Answers.

1.Which of these best describes an array?
A. A data structure that shows a hierarchical behaviour
B. Container of objects of similar types
C. Arrays are immutable once initialised
D. Array is not a data structure

2.How do you initialize an array in C?
A. int arr[3] = (1,2,3);
B. int arr(3) = {1,2,3};
C. int arr[3] = {1,2,3};
D. int arr(3) = (1,2,3);

3.How do you instantiate an array in Java ?
A. int arr[] = new int(3);
B. int arr[];
C. int arr[] = new int[3];
D. int arr() = new int(3);

4.Which of the following is a correct way to declare a multidimensional array in Java ?
A. int[] arr;
B. int arr[[]];
C. int[][]arr;
D. int[[]] arr;

5.What is the output of the following piece of code ?
A. 3 and 5
B. 5 and 3
C. 2 and 4
D. 4 and 2


Quick Links

GAT Subject

   Computer Science    English    Agriculture    Botany    


   Computer Science    Civil Engineering    


   Networking    Electronics    Database    

Past Papers

   Model Papers    FPSC    PPSC    NTS