Show List
Quiz - Java Collections - 1
Select the right answer for below questions:
What is a Collection in Java?
A Collection is a group of primitive data types that can be manipulated as a single unit
A Collection is a group of classes that can be manipulated as a single unit
A Collection is a group of objects that can be manipulated as a single unit
None of the above
A Collection is a group of objects that can be manipulated as a single unit
What is the difference between an Array and a Collection in Java?
A Collection is a fixed-size data structure, while an Array can grow or shrink dynamically
An Array is a fixed-size data structure, while a Collection can grow or shrink dynamically
Both Array and Collection are fixed-size data structures
None of the above
An Array is a fixed-size data structure, while a Collection can grow or shrink dynamically
What is the root interface of the Java Collection framework?
List
Set
Map
Collection
Collection
What is the difference between a List and a Set in Java?
A Set allows duplicate elements, while a List does not
A List allows duplicate elements, while a Set does not
Both List and Set do not allow duplicate elements
None of the above
A List allows duplicate elements, while a Set does not
What is the difference between a HashMap and a TreeMap in Java?
A HashMap uses a hash table for storage, while a TreeMap uses a tree for storage
A TreeMap uses a hash table for storage, while a HashMap uses a tree for storage
Both HashMap and TreeMap use hash tables for storage
None of the above
A HashMap uses a hash table for storage, while a TreeMap uses a tree for storage
Can a List in Java be sorted?
Yes, using the sort() method
Yes, using the Collections.sort() method
Yes, using both the sort() method and the Collections.sort() method
No
Yes, using the Collections.sort() method
Can a Set in Java be sorted?
Yes, using the sort() method
Yes, using the Collections.sort() method
Yes, using both the sort() method and the Collections.sort() method
No
Yes, using the Collections.sort() method
Can a Map in Java be sorted?
Yes, using the sort() method
Yes, using the Collections.sort() method
Yes, using both the sort() method and the Collections.sort() method
No
No
What is the difference between an ArrayList and a LinkedList in Java?
An ArrayList uses an array for storage, while a LinkedList uses a linked list for storage
A LinkedList uses an array for storage, while an ArrayList uses a linked list for storage
Both ArrayList and LinkedList use arrays for storage
None of the above
An ArrayList uses an array for storage, while a LinkedList uses a linked list for storage
What is the difference between a Queue and a Stack in Java?
A Stack follows the First-In-First-Out (FIFO) order, while a Queue follows the Last-In-First-Out (LIFO) order
Both Queue and Stack follow the First-In-First-Out (FIFO) order
A Queue follows the First-In-First-Out (FIFO) order, while a Stack follows the Last-In-First-Out (LIFO) order
None of the above
A Queue follows the First-In-First-Out (FIFO) order, while a Stack follows the Last-In-First-Out (LIFO) order
Submit
Retry
{"qz1-963413":"A Collection is a group of objects that can be manipulated as a single unit","qz1-963414":"An Array is a fixed-size data structure, while a Collection can grow or shrink dynamically","qz1-963415":"Collection","qz1-963416":"A List allows duplicate elements, while a Set does not","qz1-963417":"A HashMap uses a hash table for storage, while a TreeMap uses a tree for storage","qz1-963418":"Yes, using the Collections.sort() method","qz1-963419":"Yes, using the Collections.sort() method","qz1-963420":"No","qz1-963421":"An ArrayList uses an array for storage, while a LinkedList uses a linked list for storage","qz1-963422":"A Queue follows the First-In-First-Out (FIFO) order, while a Stack follows the Last-In-First-Out (LIFO) order"}
Leave a Comment