CSE406 : Advanced Java Programming Practice Questions for ETE End Term Exam


Question 1. Write a method with following signature to arrange all the elements of list into non-decreasing order.

public static <E extends Comparable<E>> void sort(E[] list)

Question 2. Write a generic method with following signature that returns the maximum valued element
from an array.

public static <E extends Comparable<E>> E max(E[][] list)

Question 3. WAP to create a class Student with attributes name and cgpa. Add at least 5 Student objects in an appropriate collection such that they are sorted in ascending order on the basis of their cgpa.

Question 4. Write a generic method with following signature that returns the minimum valued element from an array.

public static <E extends Comparable<E>> E min(E[][] list)

Question 5. WAP to implement a method which accepts an arraylist containing duplicate values and returns a Collection having unique elements only.

public Collection revoveDuplicate(ArrayList<T extends Number> al)

Question 6. WAP to find all Employees whose salary is greater than 50000 from a group of employees by using lambda expression for predicate functional interface.

Question 7. WAP to transform all the Integer objects from an collection into Double by using lambda expression for function functional interface.

Question 8. WAP to find all the words from list of words which are started from ‘a’ and ended with suffix 'g' by using stream. Also display these words in dictionary order.

Question 9. WAP to find all the students of LPU who are from Jalandhar and doing B.Tech by using lambda expression for predicate functional interface.

Question 10. WAP to calculate sum of all the integers from collection of Integer objects by using instance method reference.

Question 11. WAP to filter only those Employee who are working in CSE department of LPU organization from list of Employees by using stream.

Question 12. Write a program which prompts the user to enter the name of a table and use JDBC to display the names of all the columns of that table and print "Table does not exist!" if table is not present in the database.

Question 13. Given a table named "Student" with attributes name, roll_num and cgpa. Write a program which prompts the user to enter the cgpa and delete the record of all the students who are having cgpa less than the entered value using PreparedStatement. Also display the details of the remaining students.

Question 14. Write a program using NIO2 to copy a file named "my.txt" from location d:/java to c:/programs.

Question 15. Write a program Stream API with NIO.2 which Streams all the elements of a given directory and prints the names of all the .txt files.

Question 16. Write a program to create a worker thread by inheriting Callable. The thread must print all the two digit odd numbers.

Question 17. Write a program to move a file from one directory to another using NIO.2.

Solution : Coming Soon..