0% found this document useful (0 votes)
66 views1 page

Advanced Java Programming Exam 2071

This document provides information about a computer science exam for a seventh semester bachelor's level course at Tribhuwan University Institute of Science and Technology. The exam covers advanced Java programming topics and consists of two sections worth 20 and 40 marks respectively. Section A requires answering any two of three questions, while Section B requires answering any eight of eleven questions focusing on topics like multithreading, Swing components, servlets, inheritance, JDBC, exceptions, layouts, files, sockets, events, beans, RMI and JSP.

Uploaded by

Milan Karki
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views1 page

Advanced Java Programming Exam 2071

This document provides information about a computer science exam for a seventh semester bachelor's level course at Tribhuwan University Institute of Science and Technology. The exam covers advanced Java programming topics and consists of two sections worth 20 and 40 marks respectively. Section A requires answering any two of three questions, while Section B requires answering any eight of eleven questions focusing on topics like multithreading, Swing components, servlets, inheritance, JDBC, exceptions, layouts, files, sockets, events, beans, RMI and JSP.

Uploaded by

Milan Karki
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tribhuwan University

Institute of Science and Technology


2071

Bachelor Level / Seventh Semester / Science Full marks: 60


Computer Science and Information Technology(CSC409) Pass marks: 24
((TU CSIT) Advanced Java Programming) Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Section A

Attempt any Two questions. (2x10=20)

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

Attempt any Eight questions. (8x5=40)

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

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

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

7. Discuss group layout with suitable example.

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

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

10. Discuss any five event classes in java.

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

12. What is RMI? Differentiate it with CORBA?

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

Common questions

Powered by AI

JDBC (Java Database Connectivity) is an API for connecting and executing queries on relational databases . There are four types of JDBC drivers: Type 1 (JDBC-ODBC bridge), Type 2 (Native-API driver), Type 3 (Network Protocol driver), and Type 4 (Thin driver). Each type varies in architecture and usage, with Type 4 being the most popular due to its pure Java implementation .

Multiple inheritance can be achieved in Java using interfaces, which allow a class to inherit from multiple interfaces and thus implement multiple functionalities . This approach avoids the complexity of multiple inheritance in classes, such as the diamond problem, and enables more flexible and reusable code designs through polymorphism .

A TCP socket provides a reliable, connection-oriented protocol for data transmission between two endpoints and ensures data is reliably and securely delivered. In contrast, a UDP socket is connectionless, offering faster, but less reliable communication as it sends packets independently . TCP guarantees data order and retransmission of lost packets, whereas UDP does not .

Servlets are Java programs that handle requests and responses in a web server, whereas JSP (JavaServer Pages) are used to create dynamic web content with HTML-like syntax . Servlets are Java classes whereas JSP are essentially HTML pages with embedded Java code. The servlet life cycle includes initialization (init() method), request handling (service() method), and destruction (destroy() method), which manage the servlet's operation and cleanup .

RMI (Remote Method Invocation) enables Java-to-Java communication over the network by allowing methods to be invoked from a remote location, using Java objects . CORBA (Common Object Request Broker Architecture) supports multi-language interoperability, enabling various programming languages to communicate. While RMI is specific to Java, CORBA is language-independent and more complex due to its broader capabilities .

Multithreading is crucial because it allows multiple threads to run concurrently, optimizing CPU usage and enhancing performance in complex applications . The thread life cycle includes the following states: New (thread is created), Runnable (thread is ready to run), Running (actively executing), Blocked/Waiting (thread is inactive and waiting for a condition), and Terminated (completed execution). Each transition occurs due to specific events, such as the start() method for New to Runnable and completion of run() for Running to Terminated .

GroupLayout provides a way to arrange components hierarchically in swing applications, offering flexibility in designing GUI layouts without requiring nested panels . It aligns components by placing them into groups, adjusting as container size changes. An example includes arranging text fields and buttons within a form by defining layout gaps and component sequences .

Java Beans are reusable software components that follow specific conventions, such as having a no-argument constructor, properties accessed via getter and setter methods, and serialized for persistent storage . Regular Java classes do not necessarily follow these conventions. Java Beans are mainly used in frameworks that utilize property management and event programming .

Exception handling is critical in Java to manage errors and unforeseen issues during program execution, ensuring robust and reliable code that can recover gracefully from errors . For example, in financial applications, handling division by zero exceptions can prevent sudden application crashes . A try-catch block is typically used to catch exceptions and handle them appropriately .

File operations in Java involve using classes in the java.io package, such as FileReader and FileWriter, for reading and writing text data from and to files . A simple program might read content from 'input.txt' and write it to 'output.txt' using these classes. BufferedReader and BufferedWriter are often utilized to enhance performance by buffering input/output streams .

You might also like