Array
Array
Q4.What happens if you try to access an array element with an index that is out of
bounds?
a) A runtime exception is thrown
b) The program terminates abruptly
c) The element value is set to null
d) The element value is set to 0
Answer:a)A runtime exception is thrown
Q11.What is the type of variable "b" and "d" in the below snippet?
int a[], b;
int []c, d;
A. "b" and "d" are int
B. "b" and "d" are arrays of type int
C. "d" is int variable; and "b" is int array
D. "b" is int variable; and "d" is int array
Answer: D
Explanation: If [] is declared after variable it is applicable only to one
variable.
If [] is declared before variable it is applicable to all the variables.