Objects and Collections Questions and Answers
Practice ModeShowing 10 of 38 questions
Q21
Which wrapper class represents integer values?
Answer: Option B
Explanation: Integer is the wrapper class for int.
Q22
Which collection class maintains insertion order?
Answer: Option C
Explanation: LinkedHashSet preserves insertion order.
Q23
Which method adds an element to an ArrayList?
Answer: Option C
Explanation: add() inserts new elements into an ArrayList.
Q24
Which reference indicates an object is not pointing anywhere?
Answer: Option C
Explanation: null means the reference variable does not refer to any object.
Q25
Which of these is not a Java collection interface?
Answer: Option D
Explanation: Structure is not part of Java Collections Framework.
Q26
Which class stores elements in sorted order?
Answer: Option A
Explanation: TreeSet stores elements in ascending sorted order.
Q27
Which method removes all elements from a collection?
Answer: Option A
Explanation: clear() empties a collection.
Q28
Which concept allows objects to take many forms?
Answer: Option C
Explanation: Polymorphism allows the same method to behave differently.
Q29
Which operator is used to access object members?
Answer: Option C
Explanation: The dot operator accesses object methods and variables.
Q30
Which collection allows FIFO (First-In, First-Out) order?
Answer: Option B
Explanation: A Queue follows FIFO ordering.