0% found this document useful (0 votes)
1K views7 pages

Core Java Day 8 Paper

This document contains questions about operations on different Set implementations in Java. It includes questions to create HashSet, LinkedHashSet, and TreeSet from lists, convert lists to sets using addAll, iterate through sets using enhanced for loops, get common elements between sets, and remove elements from sets using removeAll. The questions cover basic Set operations and comparing different Set types.
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)
1K views7 pages

Core Java Day 8 Paper

This document contains questions about operations on different Set implementations in Java. It includes questions to create HashSet, LinkedHashSet, and TreeSet from lists, convert lists to sets using addAll, iterate through sets using enhanced for loops, get common elements between sets, and remove elements from sets using removeAll. The questions cover basic Set operations and comparing different Set types.
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/ 7

9/2022 Core Java Day -8 ( Set) M.

Praveen

Q.1.1. Create a HashSet for the below values


Input : List = 10,20,30,40,50,60,70,80,90,10,20

Q.1.2. Create a LinkedHashSet for the below values


Input : List = 10,20,30,40,50,60,70,80,90,10,20
Q.1.3. Create a TreeSet for the below values
Input : List = 10,20,30,40,50,60,70,80,90,10,20

Q.2.1. Convert the below list in to set(use addAll()) method


Input : List = 10,20,30,90,10,10,40,50
Q.2.2. Convert the below list in to set(use addAll()) method
Input : List = 105,205,305,405,505,605,705,805,505,605

Q.2.3. Convert the below list in to set(use addAll()) method


Input : List = 100,200,300,400,500,600,700,100,300,500
Q.3.1. 3.2 and 3.3 Get the each value of set by using enhanced for loop
Input: List = 105,205,305,405,505,605,705,805
Q.4.1. Create a new HashSet with values and return the common values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80

Q.4.2. Create a new LinkedHashSet with values and return the common
values
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90
Q.4.3. Create a new TreeSet with values and return the common values
Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000

Q.5.1. Create a new HashSet with values and perform removeAll()


function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 30,40,50,60,80
Q.5.2. Create a new LinkedHashSet with values and perform removeAll()
function
Input : List = 10,20,30,90,10,10,40,50
Input : List = 10,20,60,50,40,70,80,90

Q.5.3. Create a new TreeSet with values and perform removeAll()


function. Input : List = 10,20,30,40,50,60,70,80
Input : List = 100,200,300,400,500,600,700,8000

You might also like