Java
Java
Java
Section A
1. What are exceptions? Why is it important to handle exceptions? Discuss different keywords that are used to handle exception.
(2+2+6)
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)
3. What is java beans? Differentiate it with java class. Discuss bean writing process with suitable examples. (2+2+6)
Section B
11. How can you handle events using adapter classes? Discuss. (5)
13. Write a simple JSP program to display “Kathmandu, Nepal” 10 times. (5)
Tribhuwan University
Institute of Science and Technology
2070
Section A
1. What is interface? How can you use the concept of interface to achieve multiple inheritance? Discuss with suitable example.
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.
3. What is RMI? How can you use RMI to develop a program that runs in different machine? Discuss with suitable example.
Section B
11. Discuss the role of event listeners to handle events with suitable example.
12. What is socket? How can you communicate two programs in a network using TCP Socket?
Section A
1. What is multithreading? Why is it important to develop in computer programs? Discuss life cycle of thread in detail.
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. What is servlet? Differentiate it with JSP. Discuss life cycle of servlet in detail.
Section B
Section A
1. What is exception handling? Discuss exception handling in detail with suitable example.
2. What is layout management? Discuss any three layout management classes with example of each.
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).
Section B
5. Write a simple java program that reads data from one file and writes data to another file.
11. What is Java Bean? How is it different from other Java classes?
a. Multithreading
b. RMI architecture
Tribhuwan University
Institute of Science and Technology
2073
Section A
1. What is multithreading? How can you write multithreaded programs in java? Discuss with suitable example.
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 socket? How can you write java programs that communicate with each other using TCP sockets? Discuss with suitable
example.
Section B
4. Write an object oriented program to find the area and perimeter of rectangle.
5. Write the simple java program that reads data from one file and writes data to another file.
a. Interface
b. Servlet
Tribhuwan University
Institute of Science and Technology
2074
Group A
1. Define inheritance. Discuss the benefits of using inheritance. Discuss multiple inheritance with suitable example.(1+2+7)
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)
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)
Group B
4.Write an object oriented program to find area and perimeter of rectangle. (5)
5. Write a simple java program that reads data from one file and writes the data to another file (5)
9 What is socket? How can you write java programs that communicate with each other using TCP sockets? (1+4)
10. Write a Java program using servlet to display "Tribhuvan University". (5)
a) Multithreading
b) JSP
Tribhuwan University
Institute of Science and Technology
2075
Section A
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. 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 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]
Group B
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. Explain the significance of cookies and sessions with suitable example? [5]
6. Define the chain of constructor. What is the purpose of private constructor? [5]
8. How prepared statements are different with statement? List the types of JDBC driver.[2+3]
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]
11. Give any two differences between class and bean. Write the steps to create JAR files. [2+3]
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]
a. Grid Layout
b. Ragged Array
Tribhuwan University
Institute of Science and Technology
2076
1. What is exception handling? Discuss the use of each keyword (try, catch, throw, throws and finally) with suitable Java program.
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.
3. Define servlet. Discuss life cycle of servlet. Differentiate servlet with JSP. Write a simple JSP file to display 'IOST' 20 times.
Group B
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.
9. Write Java programs using TCP sockets that communicate with each other in a computer network.
10. Define Java Bean. How is it different from other Java programs? What is design pattern?
• Servlet API
• RMI vs CORBA
Tribhuwan University
Institute of Science and Technology
2077
Group A
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)
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)
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)
Group B
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. Define event delegation model. Why do we need adapter class in event handling? (2+3)
6. What is the task of Layout manager? Describe about default layout manager. (1 +4)
7. When does the finally block is mandatory in while handling exception? Describe with a suitable scenario. (5)
9. What is the task of manifest file? Write the procedure to create it. [2 + 3]
10. Why multiple inheritance is not allowed in Java using classes? Give an example.(5)
11. How forms can be created and processed using JSP? Make it clear with your own assumptions. [5]
Section A
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. 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. Explain RMI architecture layers in detail. Write a Java programs using RMI to find product of two numbers.(4+6)
Section B
4. What is package? How can you create your own package in Java? Explain with example.(1+4)
5. Why do we need swing components ? Explain the uses of check boxes and radio buttons in GUI programming. (2+3)
6. How can we use listener interface to handle events? Compare listener interface with adapter class. (3+2)
8. What is Java Mail API ? How can you use this API to send email messages? (1+4)
9. Compare JavaFX with swing. Explain HBox and BBox layouts of JavaFX.(2+3)
10. What is servlet? Write a simple JSP file to display "Tribhuwan University" five times. (2+3)
a. JDBC drivers