0% found this document useful (0 votes)
12 views2 pages

module1

The document outlines various topics related to the Java Collections Framework, including the benefits of using collections, differences between List, Set, and Queue, and the functionality of interfaces like Deque and RandomAccess. It also covers the importance of overriding equals() and hashCode() for object uniqueness in collections, as well as methods for sorting and iterating over collections. Additionally, the document discusses best practices for efficient use of collections in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

module1

The document outlines various topics related to the Java Collections Framework, including the benefits of using collections, differences between List, Set, and Queue, and the functionality of interfaces like Deque and RandomAccess. It also covers the importance of overriding equals() and hashCode() for object uniqueness in collections, as well as methods for sorting and iterating over collections. Additionally, the document discusses best practices for efficient use of collections in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MODULE-1

1. What is the Java Collections Framework? Explain its benefits


and demonstrate how to create a simple ArrayList
2. What are the key differences between List, Set, and Queue in
Java? Provide an example where you use all three.
3. What is the Deque interface in Java? How is it different from
Queue? Show an example of adding and removing elements
from both ends.
4. Compare ArrayList and LinkedList. When should each be used?
Show an example where LinkedList performs better
5. How does HashSet ensure uniqueness? Write a program to
demonstrate this concept.
6. How do you traverse a collection using an Iterator? Provide an
example.
7. How can you store custom objects in a HashSet while ensuring
uniqueness?
8. Why should equals() and hashCode() be overridden when
storing objects in a collection like HashSet? Demonstrate with
an example.
9. What is the RandomAccess interface? Which classes implement
it? Show an example.
10. How does HashMap store key-value pairs internally?
Provide an example of inserting and retrieving data.
11. Write a program to iterate over a HashMap using different
methods.
12. What is the difference between Comparable and
Comparator? Show an example of sorting objects using both.
13. How can you sort a list of objects using Comparator?
14. What are some commonly used methods from the
Collections utility class? Provide examples.
15. What is the purpose of Collections.shuffle()? Explain with
an example.
16. What is the difference between Arrays.sort() and
Collections.sort()?
17. How do you convert an array to a list in Java? Provide an
example.
18. How does Vector differ from ArrayList?
19. What is the difference between Hashtable and HashMap?
20. What are the best practices for using collections efficiently
in Java?

You might also like