Week-03 July22
Week-03 July22
QUESTION 1:
System.out. println(arr);
a. Garbage Value
b. Pointer to Address
c. Compile time Error
d. None of the above
Correct Answer: c
Detailed Solution:
The size of the array should be provided during declaration of the array.
____________________________________________________________________________
QUESTION 2:
System.out. println(arr);
a. Garbage Value
b. Reference Value
c. Compile time Error
d. None of the above
Correct Answer: b
Detailed Solution:
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
Array is created as an object and therefore when printed will return the reference value.
___________________________________________________________________________
QUESTION 3:
a. Compilation Error
b. Logical Error
c. Exception
d. None of the above
Correct Answer:c
Detailed Solution:
We cannot declare a negative integer as array size.
We will have NegativeArraySizeException at runtime
_________________________________________________________________________
QUESTION 4:
a = b; // ??
a. Legal Statement
b. Compile time error
c. Runtime error
d. None of these
Correct Answer: a
Detailed Solution:
Compiler Checks only type not the size..
_________________________________________________________
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 5:
Correct Answer: d
Detailed Solution:
Declaring size and the array elements simultaneously is not required.
________________________________________________________________________
QUESTION 6:
a. Array
b. Graph
c. Binary Tree
d. Heap Tree
Correct Answer: a
Detailed Solution:
Array is a linear Data Structure..
___________________________________________________________________________
QUESTION 7:
Correct Answer: d
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
Detailed Solution:
Array of size 5 has index values 0 to 4. arr[5] is an illegal expression and causes
ArrayIndexOutOfBoundsException.
__________________________________________________________________________
QUESTION 8:
Correct Answer: d
Detailed Solution:
Object type array has default value as null
___________________________________________________________________________
QUESTION 9:
a. length
b. length()
c. size()
d. len()
Correct Answer: a
Detailed Solution:
length is a final variable applicable for arrays. With the help of the length variable, we can obtain
the size of the array.
___________________________________________________________________________
QUESTION 10:
Correct Answer: d
Detailed Solution:
Array is a collection of similar types of elements
___________________________________________________________________________
************END************