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

Collections Questions

The document outlines various questions and programming tasks related to Java Collections, including differences between data structures, advantages of the Collection framework, and methods for manipulating collections. It also includes programming exercises for converting between data types, removing duplicates, sorting, and performing CRUD operations on different collection types. The content serves as a comprehensive guide for understanding and applying Java Collections in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Collections Questions

The document outlines various questions and programming tasks related to Java Collections, including differences between data structures, advantages of the Collection framework, and methods for manipulating collections. It also includes programming exercises for converting between data types, removing duplicates, sorting, and performing CRUD operations on different collection types. The content serves as a comprehensive guide for understanding and applying Java Collections in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

COLLECTIONS

1) What is the difference between Array and Collection in java?


2) Differentiate between Collection and collections
3) What are the advantages of the Collection framework?
4) Differentiate between Iterator and ListIterator in Java.
5) Differentiate between HashSet and TreeSet. When would you prefer TreeSet to
HashSet?
6) Differentiate between Set and Map in Java.
7) Differentiate between HashSet and HashMap.
8) Differentiate between Array and ArrayList in Java.
9) Differentiate between Comparable and Comparator
10) Differentiate between Iterator and Enumeration.
11) Differentiate between HashMap and HashTable.
12) Given an array in Java, convert it to a collection.
String sample_array[] = { "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday" };
13) What is the Collection framework in Java?
14) How to convert ArrayList to Array and Array to ArrayList?
15) How to remove duplicates from ArrayList?
16) How to add Elements to HashMap.
17) Explain the differences between List, Set, and Map interfaces in Java.
18) What is the difference between ArrayList and LinkedList? When would you use one
over the other?
19) What is the importance of the hashCode() and equals() methods when working with
collections like HashMap and HashSet?
20) When would you choose a TreeSet over a HashSet, and vice versa?
21) Can you explain the concept of "generics" in Java collections and how they
improve type safety?
22) What is Internal Working Of ArrayList and Vetore.
23) what is Internal Working of LinkedList.How the data Will Stored in linked List.
24) what is default size or current Capacity of arrayList,Vetore,HashSet?
25) what is Incremental Capacity Formula for ArrayList,Vetore,HashSet.
26) Differentiate between Sort() and reverse() methods in Collections class.
27) If we Add a Primitive Values In A Collection What Happen. Is Collection Allow
Primitive Data Types?
28) what is Internal working of TreeSet.
29) Differentiate b/w Stack and Queue.
30) What is Functional Interface Mention Some Examples in Collection
31) What is Lambda Function and What is Use Of It.
32)What is Blocks In Java and what are Different Type of Blocks Present in Java
33) what is static block and When was Static block excuted
34) If we have Multiple Static Blocks which block should be excuted first
35) what is non static blocks and When was Non Static block Excuted.
36) If we have Multiple Static Blocks which block should be excuted first
.

PROGRAMS

1) Wtrite a Programs to convert ArrayList to Array and Array to ArrayList?


2) Wtrite a Programs to remove duplicates from ArrayList?
3) Wtrite a Programs to reverse ArrayList?
4) Wtrite a Programs to sort ArrayList in descending order?
5) Wtrite a Programs to Find Duplicate Elements in an Array or List:
6) Wtrite a Programs to Count Occurrences of Elements in a List:
7) Write a program to Perform All basic Oparation on LinkedList.
8) write a program which allows only string values in arrayList using generics?
9) Write a Java Program to Store 3 Employee Object inside LinkedList and Traversed
used forEach loop where in each employee will have Id and name as Attribute.
10) WAJP to Store Student Object inside a Collection and Print the Solution for the
below requirements
a) Print the Name of the student with highest marks
b) print the Name of Student with lower Marks
c) print Student Name whos marks is b/w 41 to 70.
11) Sort a Student Data Using TreeSet.
12) WAJP to sort the Student Object in Ascending Order based on id using
Comparable and TreeSet
13) WAJP to sort the Student Object in Ascending Order based on Name using
Comparable and TreeSet
14) WAJP to sort the Student Object in Ascending Order based on id using
Comparable and ArrayList
15) WAJP to sort the Student Object in Desending Order based on id using
Comparable and ArrayList
16) WAJP to sort the Student Object in Desending Order based on Name using
Comparable and TreeSet
17) WAJP to sort the Student Object in Ascending Order based on id using
Comparator and TreeSet
18) WAJP to sort the Student Object in Ascending Order based on id ,name,marks
using Comparator and TreeSet
19) WAJP to sort the Student Object in Ascending Order based on id ,name,marks
using Comparator and ArrayList
20) WAJP to sort the Student Object in Desending Order based on id ,name,marks
using Comparator and TreeSet
21) WAJP to perform CRUD oparation and size,clear oparation on HashMap.
22) WAJP to perform CRUD oparation and size,clear oparation on LinkedHashMap.
23) WAJP to traverse a HashMap and LinkedHashMap using keyset() method.
24) WAJP to Sort Stdeunt id in Desending order using TreeMap using comparator
25) WAJP to Sort Stdeunt id in Ascending order using TreeMap using comparator
26) WAJP to Perform a Basic oparation on Stack and Queue
27) WAJP for Static blocks and Non static blocks .

You might also like