Advanced Java Programming - Unit Wise Questions

Unit 1: Programming in Java
39 Questions

1. What is exception handling? Discuss exception handling in detail with suitable example.

10 marks | Asked in 2072 |

1. What is multithreading? Why is it important to develop in computer programs? Discuss life cycle of thread in detail.

10 marks | Asked in 2071 |

1. What is multithreading? How can you write multithreaded programs in java? Discuss with suitable example.

10 marks | Asked in 2073 |

1. What is interface? How can you use the concept of interface to achieve multiple inheritance? Discuss with suitable example.

10 marks | Asked in 2070 |

1. What are exceptions? Why is it important to handle exceptions? Discuss different keywords that are used to handle exception. (2+2+6)

10 marks | Asked in 2069 |

1. Define inheritance. Discuss the benefits of using inheritance. Discuss multiple inheritance with suitable example.(1+2+7)

10 marks | Asked in 2074 |

1. What is exception handling? Discuss the use of each keyword (try, catch, throw, throws and finally) with suitable Java program.

10 marks | Asked in 2076 |

2. Why do we need to handle the exception? Distinguish error and exception, Write a program to demonstrate your own exception class. [1+2+7]

10 marks | Asked in 2075 |

3. Describe the responsibility of Serializable interface. Write a program to read an input string from the user and write the vowels of that string in VOWEL.TXT and consonants in CONSOLNANT.TXT (2+8)

10 marks | Asked in 2077

4. Write an object oriented program to find the area and perimeter of rectangle. 

5 marks | Asked in 2073 |

4.Write an object oriented program to find area and perimeter of rectangle. (5)

5 marks | Asked in 2074 |

4. Discuss the use of interfaces to achieve multiple inheritance. (5)

5 marks | Asked in 2069 |

4. Write an object oriented program in Java to find the area of circle.

5 marks | Asked in 2072 |

4. How do you achieve multiple inheritance in java? Discuss.

5 marks | Asked in 2071 |

4. What is package? How can you create your own package in Java? Explain with example.(1+4)

5 marks | Asked in 2078

5. Write the simple java program that reads data from one file and writes data to another file.

5 marks | Asked in 2073 |

5. Write a simple java program that reads data from one file and writes data to another file.

5 marks | Asked in 2072 |

5. Discuss the use of multithreading with suitable example. (5)

5 marks | Asked in 2069 |

5. Write a simple java program that reads data from one file and writes the data to another file (5)

5 marks | Asked in 2074 |

4. Define class. How do you create a class in Java? Differentiate class with interface.

5 marks | Asked in 2076 |

5. Write a simple Java program that reads a file named "Test.txt" and displays its contents.

5 marks | Asked in 2076 |

6. Explain the importance of exception handling with suitable example.

5 marks | Asked in 2071 |

6. Write a simple java program to read from and write to files.

5 marks | Asked in 2070 |

4. A non-empty array A of length n is called on array of all possibilities if it contains all numbers between 0 and A.length-1 inclusive. Write a method named isAllPossibilities that accepts an integer array and returns 1 if the array is an array of all possiblities, otherwise it returns 0. (15)

5 marks | Asked in 2077 |

4. An array is called balanced if it's even numbered elements (a[0], a[2], etc.) are even and its odd numbered elements (a[1], a[3],etc.) are Odd. Write a function named is Balanced that accepts an array of integers and returns 1 if the array is balanced otherwise it returns 0. [5]

5 marks | Asked in 2075 |

6. Define the chain of constructor. What is the purpose of private constructor? [5]

5 marks | Asked in 2075 |

8. Discuss any five classes to handle files in java. (5)

5 marks | Asked in 2069

8. Write a simple java program to read from and write to files.

5 marks | Asked in 2071 |

9. Why multithreading is important in programming? Discuss.

5 marks | Asked in 2070 |

7. When does the finally block is mandatory in while handling exception? Describe with a suitable scenario. (5)

5 marks | Asked in 2077 |

10. Discuss any 5 exception classes in java.

5 marks | Asked in 2070 |

9. Write down the life cycle of thread. Write a program to execute multiple threads in priority base. [2+3]

5 marks | Asked in 2075 |

10. When do we use final method and final class? Differentiate between function overloading and function overriding.[2+3]

5 marks | Asked in 2075

10. Why multiple inheritance is not allowed in Java using classes? Give an example.(5)

5 marks | Asked in 2077 |

13. Write short note on: 

      a. Interface

      b. Servlet

5 marks | Asked in 2073

13. Write short note on:

            a. Multithreading

            b. RMI architecture

5 marks | Asked in 2072

13. Write short notes on: (2.5+2.5)

     a) Multithreading

     b) JSP

5 marks | Asked in 2074

12. Why synchronization in essential in multithreading? Describe. (5) 

5 marks | Asked in 2077 |

13. Write short notes on.[2.5+2.5]

a. JAVA beans and JAR file

b. MVC design pattern

5 marks | Asked in 2077 |

Unit 2: User Interface Components with Swing
19 Questions

2. Write a Java program to find the sum of two numbers using swing components. Use text fields for input and output. Your program displays output if you press any key in keyboard. Use key adapter to handle  events.

10 marks | Asked in 2076 |

1. Design a GUI form using swing with a text field, a text label for displaying the input message “Input any String”, and three buttons with caption CheckPalindrome, Reverse, FindVowels. Write a complete program for above scenario and for checking palindrome in first button, reverse it after clicking second button and extract the vowels from it after clicking third button. (10)

10 marks | Asked in 2075 |

2. Write a program using swing components to add two numbers. Use text fields for inputs and output. Your program should display the result when the user presses a button. (10)

10 marks | Asked in 2069 |

2. What is layout management? Discuss any three layout management classes with example of each.

10 marks | Asked in 2072 |

2. Write a program using swing components to multiply two numbers. Use text fields for inputs and output. Your program should display the result when the user press a button.

10 marks | Asked in 2070 |

2. Write a program using swing components to find simple interest. Use text fields for inputs and output. Your program should display the result when the user presses a button.

10 marks | Asked in 2071 |

3. Write a program using swing components to find simple interest. Use text fields for inputs and output. Your program should display output if the user clicks a button. (10)

10 marks | Asked in 2074 |

2. You are hired by a reputed software company which is going to design an application for "Movie Rental System". Your responsibility is to design a schema named MRS and create a table named Movie(id, Tille, Genre, Language, Length). Write a program to design a GUI form to take input for this table and insert the data into table after clicking the OK button (10)

10 marks | Asked in 2077

5. Why do we need swing components ? Explain the uses of check boxes and radio buttons in GUI programming. (2+3)

5 marks | Asked in 2078

6.Discuss grid layout with example. 

10 marks | Asked in 2074 |

6. Discuss border layout with example. 

5 marks | Asked in 2073 |

6. What are the benefits of using swing components? Explain.

5 marks | Asked in 2072 |

7. Discuss grid layout with suitable example. (5)

5 marks | Asked in 2069 |

7. Discuss group layout with suitable example.

5 marks | Asked in 2071 |

6. Why do we need layout management? What is GridBag layout?

5 marks | Asked in 2076 |

7. Discuss MVC design pattern with example.

5 marks | Asked in 2076 |

8. Discuss border layout with suitable example.

5 marks | Asked in 2070 |

6. What is the task of Layout manager? Describe about default layout manager. (1 +4)

5 marks | Asked in 2077 |

13. Write short notes on:[2.5+2.5]

a. Grid Layout

b. Ragged Array

5 marks | Asked in 2075 |

Unit 3: Event Handling
10 Questions

1. Compare AWT with Swing. Write a GUI program using components to find sum and difference of two numbers.Use two text fields for giving input and a label for output. The program should display sum if  user presses mouse and difference if user release mouse.(2+8)

10 marks | Asked in 2078

2. why do we need event handling? Discuss the process of handling events with example. Differentiate event listener interface with adapter class. (3+4+3)

10 marks | Asked in 2074 |

7. Discuss any three event classes in Java.

5 marks | Asked in 2072

6. How can we use listener interface to handle events? Compare listener interface with adapter class. (3+2)

5 marks | Asked in 2078

7. Why is it important to handle events? List any five event classes. 

5 marks | Asked in 2073

7. What is action event? Discuss (5)

5 marks | Asked in 2074 |

5. Define event delegation model. Why do we need adapter class in event handling? (2+3)

5 marks | Asked in 2077

10. Discuss any five event classes in java.

5 marks | Asked in 2071

11. Discuss the role of event listeners to handle events with suitable example.

5 marks | Asked in 2070

11. How can you handle events using adapter classes? Discuss. (5)

5 marks | Asked in 2069

Unit 4: Database Connectivity
10 Questions

3. Write a Java program using JDBC to extract name of those students who live in Kathmandu district, assuming that the student table has four attributes (ID, name, district, and age).

10 marks | Asked in 2072 |

4. What is JDBC? How do you execute SQL queries in JDBC?

5 marks | Asked in 2070 |

5. What is JDBC? Discuss different driver types of JDBC.

5 marks | Asked in 2071 |

6. What is JDBC? How do you execute SQL statements in JDBC? (2+3)

5 marks | Asked in 2069 |

8. Discuss different driver types on JDBC.

5 marks | Asked in 2072 |

8. What is JDBC? How do you execute SQL statements in JDBC?

5 marks | Asked in 2073 |

8. How do you execute SQL statement in JDBC? (5)

5 marks | Asked in 2074 |

7. What is row set? Explain cached row set in detail.(1+4)

5 marks | Asked in 2078

8. What are the benefits of using JDBC? What is prepared statement?

5 marks | Asked in 2076 |

8. How prepared statements are different with statement? List the types of JDBC driver.[2+3]

5 marks | Asked in 2075 |

Unit 5: Network Programming
11 Questions

3. What is socket? How can you write java programs that communicate with each other using TCP sockets? Discuss with suitable example.

10 marks | Asked in 2073 |

9. Discuss the process of sending email messages using Java.

5 marks | Asked in 2073 |

9. What is socket? Differentiate TCP socket from UDP socket.

5 marks | Asked in 2072 |

9. What is TCP socket? Differentiate it with UDP socket.

5 marks | Asked in 2071 |

8. What is Java Mail API ? How can you use this API to send email messages? (1+4)

5 marks | Asked in 2078

9 What is socket? How can you write java programs that communicate with each other using TCP sockets? (1+4)

5 marks | Asked in 2074 |

10. What is UDP socket? Differentiate it with TCP socket. (2+3)

5 marks | Asked in 2069 |

9. Write Java programs using TCP sockets that communicate with each other in a computer network.

5 marks | Asked in 2076 |

11. What is InetAddress class? Discuss.

5 marks | Asked in 2073 |

12. What is socket? How can you communicate two programs in a network using TCP Socket?

5 marks | Asked in 2070 |

12. What is a socket? Write client and server programs in which a server program accepts a radius of a circle from the client program. Computes area, sends the computed area to the client program, and displays it by client program.[1+4]

5 marks | Asked in 2075 |

Unit 6: GUI with JavaFX
10 Questions

2. What is Java Beans? How is it different from other Java classes? Discuss property design patterns with suitable example of each.

10 marks | Asked in 2073

3. What is java beans? Differentiate it with java class. Discuss bean writing process with suitable examples. (2+2+6)

10 marks | Asked in 2069

5. What is java beans? How is it different from java class?

5 marks | Asked in 2070

9. Compare JavaFX with swing. Explain HBox and BBox layouts of JavaFX.(2+3)

5 marks | Asked in 2078

11. What is java beans? Differentiate it with java classes.

5 marks | Asked in 2071

11. Discuss property design patterns for Java Beans. (5)

5 marks | Asked in 2074

10. Define Java Bean. How is it different from other Java programs? What is design pattern?

5 marks | Asked in 2076

9. What is the task of manifest file? Write the procedure to create it. [2 + 3]

5 marks | Asked in 2077

11. What is Java Bean? How is it different from other Java classes?

5 marks | Asked in 2072

11. Give any two differences between class and bean. Write the steps to create JAR files. [2+3]

5 marks | Asked in 2075

Unit 7: Servlets and Java Server pages
19 Questions

2. Explain life-cycle of servlet in detail.Create a simple servlet that reads and displaysdata from HTML form. Assume form with two fields username and password.(5+5)

10 marks | Asked in 2078

3. Define servlet. Discuss life cycle of servlet. Differentiate servlet with JSP. Write a simple JSP file to display 'IOST' 20 times.

10 marks | Asked in 2076 |

3. What is servlet? Differentiate it with JSP. Discuss life cycle of servlet in detail.

10 marks | Asked in 2071 |

3. Describe the process to deploy the servlet. Write a program to a JSP web form to take input of a student and submit it to second JSP file which may simply print the values of form submission. [4+6]

10 marks | Asked in 2075 |

7. Discuss different methods used in life cycle of servlet.

5 marks | Asked in 2070 |

5. Explain the significance of cookies and sessions with suitable example? [5]

5 marks | Asked in 2075

9. What is JSP? Differentiate it with servlet. (2+3)

5 marks | Asked in 2069 |

10. What is JSP? Discuss with suitable example.

5 marks | Asked in 2073 |

8. Explain the life cycle of a servlet. (5)

5 marks | Asked in 2077 |

10. What is servlet? Discuss its life cycle.

5 marks | Asked in 2072 |

10. Write a Java program using servlet to display "Tribhuvan University". (5)

5 marks | Asked in 2074 |

10. What is servlet? Write a simple JSP file to display "Tribhuwan University" five times. (2+3)

5 marks | Asked in 2078

11. How do you handle HTTP request (GET) using servlet?

5 marks | Asked in 2076 |

13. Write a simple JSP program to display “Tribhuvan University” 10 times.

5 marks | Asked in 2071 |

13. Write a simple JSP program to display “Lalitpur, Nepal” 10 times.

5 marks | Asked in 2070 |

13. Write a simple JSP program to display “Kathmandu, Nepal” 10 times. (5)

5 marks | Asked in 2069 |

11. How forms can be created and processed using JSP? Make it clear with your own assumptions. [5]

5 marks | Asked in 2077

12. Write short notes on: (2*2.5 = 5)

   a. JDBC drivers

   b. Java server pages

5 marks | Asked in 2078

13. Write short notes on:

  • Servlet API
  • RMI vs CORBA
5 marks | Asked in 2076 |

Unit 8: RMI and CORBA
11 Questions

1, What is the significance of stub and skeleton In RMI? Create a RMI application such that a client sends an Integer number to the server and the server return the factorial value of that integer. Give a clear specification for every step. (10)

10 marks | Asked in 2077

3. Explain RMI architecture layers in detail. Write a Java programs using RMI to find product of two numbers.(4+6)

10 marks | Asked in 2078

3. What is RMI? How can you use RMI to develop a program that runs in different machine? Discuss with suitable example.

10 marks | Asked in 2070 |

7. Describe the process to run the RMI application. [5]

5 marks | Asked in 2075 |

12. What is RMI? Discuss architecture of RMI in detail. (1+4)

5 marks | Asked in 2069 |

12. What is CORBA? How is it different from RMI? (2+3)

5 marks | Asked in 2074 |

11. Why CORBA is important? Compare CORBA with RMI. (3+2)

5 marks | Asked in 2078

12. What is RMI? Discuss architecture of RMI.

5 marks | Asked in 2073 |

12. What is RMI? How is it different from CORBA?

5 marks | Asked in 2072 |

12. What is RMI? Differentiate it with CORBA?

5 marks | Asked in 2071 |

12. What are different layers of RMI architecture? Explain.

5 marks | Asked in 2076 |

Unit 9: Old Syllabus (Java Beans)
0 Questions