Objects and Collections Questions and Answers
Practice ModeShowing 10 of 38 questions
Q31
Which class implements the List interface?
Answer: Option B
Explanation: ArrayList is a widely used implementation of List.
Q32
Which keyword is used to refer to the current object?
Answer: Option C
Explanation: this is used to reference the current class instance.
Q33
Which of the following is not a feature of OOP?
Answer: Option C
Explanation: Compilation is not an OOP principle.
Q34
Which method returns the size of a collection?
Answer: Option C
Explanation: size() returns the number of elements in collections.
Q35
Which collection allows null keys?
Answer: Option B
Explanation: Only HashMap allows one null key.
Q36
What is the default value of object reference variables?
Answer: Option C
Explanation: Objects default to null until initialized.
Q37
Which class is best for constant-time search operations?
Answer: Option B
Explanation: HashMap provides average O(1) search time.
Q38
What is the parent interface of all collections?
Answer: Option B
Explanation: Collection is the root interface for most collections except Map.