Java Collections MCQs l Top 20 Java Collections Questions and Answers l Javatpoint
ฝัง
- เผยแพร่เมื่อ 8 ต.ค. 2024
- Java Collections MCQs | Java Tutorial l #javatpoint #java #javaprogramming #javatutorial #javacollections #javacollectionsframework
1. What is the purpose of Java Collections framework?
a) To provide a unified architecture for storing and manipulating groups of objects
b) To provide a way to organize classes and interfaces in a hierarchical structure
c) To provide a way to manage memory allocation and deallocation
d) To provide a way to implement multi-threading in Java programs
Answer: a) To provide a unified architecture for storing and manipulating groups of objects
2. Which interface in Java Collections framework is used to represent a set of elements with no duplicates?
a) List
b) Set
c) Map
d) Queue
Answer: b) Set
3. Which interface in Java Collections framework is used to represent an ordered collection of elements?
a) List
b) Set
c) Map
d) Queue
Answer: a) List
4. Which interface in Java Collections framework is used to represent a mapping between keys and values?
a) List
b) Set
c) Map
d) Queue
Answer: c) Map
5. Which interface in Java Collections framework is used to represent a collection of elements that can be accessed in a first-in, first-out (FIFO) order?
a) List
b) Set
c) Map
d) Queue
Answer: d) Queue
6. Which class in Java Collections framework is used to implement a dynamic array?
a) ArrayList
b) LinkedList
c) HashSet
d) HashMap
Answer: a) ArrayList
7. Which class in Java Collections framework is used to implement a linked list?
a) ArrayList
b) LinkedList
c) HashSet
d) HashMap
Answer: b) LinkedList
8. Which class in Java Collections framework is used to implement a hash-based set of elements with no duplicates?
a) ArrayList
b) LinkedList
c) HashSet
d) HashMap
Answer: c) HashSet
9. Which class in Java Collections framework is used to implement a hash-based mapping between keys and values?
a) ArrayList
b) LinkedList
c) HashSet
d) HashMap
Answer: d) HashMap
10. Which method is used to add an element to a Set in Java Collections framework?
a) add()
b) put()
c) push()
d) insert()
Answer: a) add()
Thank you for this video 😅
Thanks