0% found this document useful (0 votes)
9 views

Lab on Advanced Java Journal Questions

Questions

Uploaded by

AMIT JADHAV
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lab on Advanced Java Journal Questions

Questions

Uploaded by

AMIT JADHAV
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Journal Questions

Q.8 Write a Java program that uses an ArrayList to manage a list of student
names. Perform the following actions in your program:

1. Add students to the studentList.


2. Display the initial list of students.
3. Update the name of a student at a specific index.
4. Remove a student by name.
5. Search for a student by name.
6. Display the final list of students.
7. Clear the studentList.

Q.9 Write a Java program that demonstrates basic operations such as adding, removing, updating
searching and accessing elements in Vector.

Q.10 Implement a linked list in Java, Create methods to perform the following operations on the
linked list:

1. Insertion of a node at the beginning of the list.


2. Insertion of a node at the end of the list.
3. Deletion of a node from the beginning of the list.
4. Deletion of a node from the end of the list.
5. Searching for a given element in the list and returning its index.
6. Displaying the elements of the list.

Q.11 Write java program to use iterator to traverse through ArrayList and perform the following
operations:

1. Display all elements of ArrayList.


2. Remove elements that satisfy a specific condition (e.g., remove all even numbers).

Q.12 Create a Java program named HashSetAssignment and Implement the following tasks within
the program:

a. Initialize a HashSet named uniqueNumbers.


b. Populate the HashSet with random integers between 1 to 20. Ensure that each number
added is unique.
c. Display the contents of the HashSet.
d. Implement a method named removeMultiples(int num) that removes all multiples of the
given number num from the HashSet.
e. Display the updated contents of the HashSet after removing multiples of 5.

Q.13 Implement a Java program that demonstrates the creation and manipulation of a
LinkedHashSet. The program should include the following functionalities:

a. Create a LinkedHashSet of integers.


b. Add elements to the LinkedHashSet.
c. Remove elements from the LinkedHashSet.
d. Iterate over the elements of the LinkedHashSet and display them.

Q.14 Implement a Java program that demonstrates the creation and manipulation of a TreeSet. The
program should include the following functionalities:
a. Implement a method named addElements which adds the following elements to the
treeSet: "Apple", "Banana", "Orange", "Grape", "Pineapple", "Mango"
b. Implement a method named displayElements which displays all the elements of the
treeSet.
c. Implement a method named removeElement which removes the element "Orange"
from the treeSet.
d. Implement a method named accessElement which checks if the treeSet contains the
element "Grape" and prints the result.

Q.15 Write java program to demonstrate concept of Dictionary in java and display content of
Dictionary on console.

You might also like