MCQ's On Array
MCQ's On Array
MCQ's On Array
Answer: b
Explanation: Array contains elements only of the same type.
Answer: c
Explanation: This is the syntax to initialize an array in C.
Answer: c
Explanation: Note that option b is declaration whereas option c is to
instantiate an array.
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;
Answer: c
Explanation: The syntax to declare multidimensional array in java is either
int[][] arr; or int arr[][];
Answer: a
Explanation: Array indexing starts from 0.
Answer: c
Explanation: Trying to access an element beyond the limits of an array gives
ArrayIndexOutOfBoundsException.
a) Compile-time
b) Run-time
c) Not an error
d) Not an exception at all
Answer: b
Explanation: ArrayIndexOutOfBoundsException is a run-time exception and
the compilation is error-free.
a) Binary trees
b) Scheduling of processes
c) Caching
d) Spatial locality
Answer: d
Answer: d
Explanation: Arrays stores elements of same data type and present in
continuous memory locations.
Answer: b
Explanation: Arrays are of fixed size. If we insert elements less than the
allocated size, unoccupied positions can’t be used again. Wastage will occur in
memory.
a) 15
b) 19
c) 11
d) 60
Answer: d
Explanation: Since there are 15 int elements and each int is of 4bytes, we get
15*4 = 60 bytes.
a) 0
b) -1
c) 2
d) 1
Answer: a
Explanation: In general, Array Indexing starts from 0. Thus, the index of the
first element in an array is 0.
a) randomly
b) sequentially
c) exponentially
d) logarithmically
Answer: a
Explanation: Elements in an array are accessed randomly. In Linked lists,
elements are accessed sequentially.
Answer: a
16. A …………………… does not keep track of address of every element in the list.
a) Stack
b) String
c) Linear Array
d) Queue
Answer: (c).Linear array
Answer: (a).
LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words
per memory cell for the array
Ans : B
20. 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.
A. 560
B. 565
C. 570
D. 575
Ans : A
A. lower bound.
B. upper bound.
C. range.
D. extraction.
Ans : A
22. Each array declaration need not give, implicitly or explicitly, the
information about
Ans : C
A. by this way computer can keep track only the address of the first element
and the addresses of other elements can be calculated
B. the architecture of computer memory does not allow arrays to store other
than serially
C. both of above
D. none of above
Ans : A
24. Two dimensional arrays are also called
A. tables arrays
B. matrix arrays
C. both of above
D. none of above
Ans : C
A. Sequential
B. Random
C. Sequential and Random
D. None of the above
Ans : A
Ans : C
27. Once an array is declared and initialized, various operations, such as,_can
be performed on the array.
Ans : d
28. To perform an operation on an array, the elements of the array need to be
accessed. The process of accessing each element of an array is known
as__________.
A. Insertion
B. Traversal
C. Both (a) and (b)
D. None of the above
Ans : B
A. Linear search
B. Binary search
C. Searching
D. None of the above
Ans : C
A. Found or not
B. Not Found
C. It is irrelevant
D. None of the above
Ans : A