Advanced Java Programming - Unit Wise Questions
1. What is exception handling? Discuss exception handling in detail with suitable example.
1. What is multithreading? Why is it important to develop in computer programs? Discuss life cycle of thread in detail.
1. What is multithreading? How can you write multithreaded programs in java? Discuss with suitable example.
1. What is interface? How can you use the concept of interface to achieve multiple inheritance? Discuss with suitable example.
1. What are exceptions? Why is it important to handle exceptions? Discuss different keywords that are used to handle exception. (2+2+6)
1. Define inheritance. Discuss the benefits of using inheritance. Discuss multiple inheritance with suitable example.(1+2+7)
1. What is exception handling? Discuss the use of each keyword (try, catch, throw, throws and finally) with suitable Java program.
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]
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)
4. Write an object oriented program to find the area and perimeter of rectangle.
4.Write an object oriented program to find area and perimeter of rectangle. (5)
4. Discuss the use of interfaces to achieve multiple inheritance. (5)
4. Write an object oriented program in Java to find the area of circle.
4. How do you achieve multiple inheritance in java? Discuss.
4. What is package? How can you create your own package in Java? Explain with example.(1+4)
5. Write the simple java program that reads data from one file and writes data to another file.
5. Write a simple java program that reads data from one file and writes data to another file.
5. Discuss the use of multithreading with suitable example. (5)
5. Write a simple java program that reads data from one file and writes the data to another file (5)
4. Define class. How do you create a class in Java? Differentiate class with interface.
5. Write a simple Java program that reads a file named "Test.txt" and displays its contents.
6. Explain the importance of exception handling with suitable example.
6. Write a simple java program to read from and write to files.
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)
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]
6. Define the chain of constructor. What is the purpose of private constructor? [5]
8. Discuss any five classes to handle files in java. (5)
8. Write a simple java program to read from and write to files.
9. Why multithreading is important in programming? Discuss.
7. When does the finally block is mandatory in while handling exception? Describe with a suitable scenario. (5)
10. Discuss any 5 exception classes in java.
9. Write down the life cycle of thread. Write a program to execute multiple threads in priority base. [2+3]
10. When do we use final method and final class? Differentiate between function overloading and function overriding.[2+3]
10. Why multiple inheritance is not allowed in Java using classes? Give an example.(5)
13. Write short note on:
a. Interface
b. Servlet
13. Write short note on:
a. Multithreading
b. RMI architecture
13. Write short notes on: (2.5+2.5)
a) Multithreading
b) JSP
12. Why synchronization in essential in multithreading? Describe.
(5)
13. Write short notes on.[2.5+2.5]
a. JAVA beans and JAR file
b. MVC design pattern
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.
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)
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)
2. What is layout management? Discuss any three layout management classes with example of each.
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.
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.
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)
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)
5. Why do we need swing components ? Explain the uses of check boxes and radio buttons in GUI programming. (2+3)
6.Discuss grid layout with example.
6. Discuss border layout with example.
6. What are the benefits of using swing components? Explain.
7. Discuss grid layout with suitable example. (5)
7. Discuss group layout with suitable example.
6. Why do we need layout management? What is GridBag layout?
7. Discuss MVC design pattern with example.
8. Discuss border layout with suitable example.
6. What is the task of Layout manager? Describe about default layout manager.
(1 +4)
13. Write short notes on:[2.5+2.5]
a. Grid Layout
b. Ragged Array
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)
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)
7. Discuss any three event classes in Java.
6. How can we use listener interface to handle events? Compare listener interface with adapter class. (3+2)
7. Why is it important to handle events? List any five event classes.
7. What is action event? Discuss (5)
5. Define event delegation model. Why do we need adapter class in event handling?
(2+3)
10. Discuss any five event classes in java.
11. Discuss the role of event listeners to handle events with suitable example.
11. How can you handle events using adapter classes? Discuss. (5)
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).
4. What is JDBC? How do you execute SQL queries in JDBC?
5. What is JDBC? Discuss different driver types of JDBC.
6. What is JDBC? How do you execute SQL statements in JDBC? (2+3)
8. Discuss different driver types on JDBC.
8. What is JDBC? How do you execute SQL statements in JDBC?
8. How do you execute SQL statement in JDBC? (5)
7. What is row set? Explain cached row set in detail.(1+4)
8. What are the benefits of using JDBC? What is prepared statement?
8. How prepared statements are different with statement? List the types of JDBC driver.[2+3]
3. What is socket? How can you write java programs that communicate with each other using TCP sockets? Discuss with suitable example.
9. Discuss the process of sending email messages using Java.
9. What is socket? Differentiate TCP socket from UDP socket.
9. What is TCP socket? Differentiate it with UDP socket.
8. What is Java Mail API ? How can you use this API to send email messages? (1+4)
9 What is socket? How can you write java programs that communicate with each other using TCP sockets? (1+4)
10. What is UDP socket? Differentiate it with TCP socket. (2+3)
9. Write Java programs using TCP sockets that communicate with each other in a computer network.
11. What is InetAddress class? Discuss.
12. What is socket? How can you communicate two programs in a network using TCP Socket?
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]
2. What is Java Beans? How is it different from other Java classes? Discuss property design patterns with suitable example of each.
3. What is java beans? Differentiate it with java class. Discuss bean writing process with suitable examples. (2+2+6)
5. What is java beans? How is it different from java class?
9. Compare JavaFX with swing. Explain HBox and BBox layouts of JavaFX.(2+3)
11. What is java beans? Differentiate it with java classes.
11. Discuss property design patterns for Java Beans. (5)
10. Define Java Bean. How is it different from other Java programs? What is design pattern?
9. What is the task of manifest file? Write the procedure to create it.
[2 + 3]
11. What is Java Bean? How is it different from other Java classes?
11. Give any two differences between class and bean. Write the steps to create JAR files. [2+3]
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)
3. Define servlet. Discuss life cycle of servlet. Differentiate servlet with JSP. Write a simple JSP file to display 'IOST' 20 times.
3. What is servlet? Differentiate it with JSP. Discuss life cycle of servlet in detail.
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]
7. Discuss different methods used in life cycle of servlet.
5. Explain the significance of cookies and sessions with suitable example? [5]
9. What is JSP? Differentiate it with servlet. (2+3)
10. What is JSP? Discuss with suitable example.
8. Explain the life cycle of a servlet.
(5)
10. What is servlet? Discuss its life cycle.
10. Write a Java program using servlet to display "Tribhuvan University". (5)
10. What is servlet? Write a simple JSP file to display "Tribhuwan University" five times. (2+3)
11. How do you handle HTTP request (GET) using servlet?
13. Write a simple JSP program to display “Tribhuvan University” 10 times.
13. Write a simple JSP program to display “Lalitpur, Nepal” 10 times.
13. Write a simple JSP program to display “Kathmandu, Nepal” 10 times. (5)
11. How forms can be created and processed using JSP? Make it clear with your own assumptions. [5]
12. Write short notes on: (2*2.5 = 5)
a. JDBC drivers
b. Java server pages
13. Write short notes on:
- Servlet API
- RMI vs CORBA
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)
3. Explain RMI architecture layers in detail. Write a Java programs using RMI to find product of two numbers.(4+6)
3. What is RMI? How can you use RMI to develop a program that runs in different machine? Discuss with suitable example.
7. Describe the process to run the RMI application. [5]
12. What is RMI? Discuss architecture of RMI in detail. (1+4)
12. What is CORBA? How is it different from RMI? (2+3)
11. Why CORBA is important? Compare CORBA with RMI. (3+2)
12. What is RMI? Discuss architecture of RMI.
12. What is RMI? How is it different from CORBA?
12. What is RMI? Differentiate it with CORBA?
12. What are different layers of RMI architecture? Explain.