You are on page 1of 11

MCQ ON ARRAY

• Which of these best describes an array?


a) A data structure that shows a hierarchical behavior
b) Container of objects of similar types
c) Arrays are immutable once initialized
d) Array is not a data structure
• How do you initialize an array in C/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);
• Which of the following concepts make extensive use of arrays?
a) Binary trees
b) Scheduling of processes
c) Caching
d) Spatial locality
• What are the disadvantages of arrays?
a) Data structure like queue or stack cannot be implemented
b) There are chances of wastage of memory space if elements
inserted in an array are lesser than the allocated size
c) Index value of an array can be negative
d) Elements are sequentially accessed
• Assuming int is of 4bytes, what is the size of int arr[15];?
a) 15
b) 19
c) 11
d) 60
• In general, the index of the first element in an array is
__________
a) 0
b) -1
c) 2
d) 1
• What is the correct syntax for initializing 1D array?
a) arr[4] =(1,2,3,4);
b) arr[4]={1 2 3 4};
c) arr[] = {1,2,3,4};
d) arr[4] = {1,2,3,4};

a) 3, 2 , 15
b) 2,3,20
c) 2,1,15
d) 1,2,5
• Elements in an array are accessed _____________
a) randomly
b) sequentially
c) exponentially
d) logarithmically

a) Both A[2] and 2[A] give value 2


b) Both A[2] and 2[A] give value 3
c) A[2] is correct and 2[A] give error
d) Last element of array A is 5
a) 2,0
b) 3,0
c) 2,9
d) 3,9
a) Search
b) Merge
c) Traverse
d) Sort
a) 111111
b) 000000
c) 100000
d) 1 followed by 5 garbage value.
a) 4
b) 3
c) 2
d) 5

a) 4325
b) 2222
c) 4444
d) error
• If integer requires two bytes space, then what will be the size of
following ‘C’ code?
int arr[3][4];
a) 12 bytes
b) 24 bytes
c) 14 bytes
d) 7 bytes

e) 3
f) 14
g) 15
h) 12

You might also like