2078

CSC419 · TU past paper

Advanced Java Programming 2078 question paper

The complete TU 2078 exam paper for Advanced Java Programming (CSC419), all 12 questions with solved model answers written to the mark scheme.

Tap a question to open its answer.

  1. Q1.10 marksIntroductionAnswer

    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.[10]

    --- Feature AWT (Abstract Window Toolkit) Swing --------- Package java.awt javax.swing Components Heavyweight (depend on OS native components) Lightweight (drawn by Java itself, not OS) Look and Feel Platform dependent (looks different on each OS) Platform independent (consistent look on all OS) ...

  2. Q2.10 marksWeb Container, Introduction to Servlets, LAnswer

    Explain life-cycle of servlet in detail. Create a simple servlet that reads and displays data from HTML form. Assume form with two fields username and password.[10]

    The servlet life cycle defines how a servlet is loaded, initialized, used, and destroyed by the servlet container (e.g., Apache Tomcat). It is managed entirely by the servlet container. --- - When the servlet container starts (or when the first request arrives), it loads the servlet class into me...

  3. Q3.10 marksJava ArchitectureAnswer

    Explain RMI architecture layers in detail. Write a Java programs using RMI to find product of two numbers.[10]

    Remote Method Invocation (RMI) is a Java API that allows an object running in one Java Virtual Machine (JVM) to invoke methods on an object running in another JVM. It is the mechanism that makes Java truly distributed (as mentioned in Java's distributed feature using RMI and EJB). --- --- This is...

  4. Q4.5 marksPackagesAnswer

    What is package? How can you create your own package in Java? Explain with example. [5]

    A package in Java is a namespace that organizes a set of related classes and interfaces together. It is essentially a folder/directory that groups related Java classes, interfaces, and sub-packages. Packages help in: - Avoiding name conflicts between classes - Controlling access (access protectio...

  5. Q5.5 marksGUI ControlsAnswer

    Why do we need swing components? Explain the uses of check boxes and radio buttons in GUI programming. [5]

    --- Java Swing is part of the Java Foundation Classes (JFC) used to create window-based (GUI) applications. It is built on top of AWT (Abstract Windowing Toolkit) and is entirely written in Java. We need Swing components because of the following advantages over AWT: Feature AWT Swing --------- Pl...

  6. Q6.5 marksEvent Handling Concept, Listener InterfaceAnswer

    How can we use listener interface to handle events? Compare listener interface with adapter class. [5]

    A listener interface is a predefined interface in Java (in java.awt.event package) that contains abstract methods corresponding to specific events. To handle events using a listener interface, the following steps are followed: Step 1: Implement the listener interface The class must implement the ...

  7. Q7.5 marksDDL and DML Operations using Java, PrepareAnswer

    What is row set? Explain cached row set in detail. [5]

    A RowSet is a Java interface that extends the ResultSet interface and provides a more flexible and convenient way to handle tabular data from a database. It is part of the javax.sql package. - It is a JavaBean component, meaning it supports event handling, serialization, and can be used in GUI en...

  8. Q8.5 marksJava Mail API, Sending and Receiving EmailAnswer

    What is Java Mail API? How can you use this API to send email messages? [5]

    The JavaMail API is an API used to compose, write, and read electronic messages (emails). It provides a protocol-independent and platform-independent framework for sending and receiving emails. The core classes of JavaMail API are found in the java.mail and java.mail.activation packages. Note on ...

  9. Q9.5 marksIntroduction, JavaFX vs Swing, JavaFX LayoAnswer

    Compare JavaFX with swing. Explain HBox and BBox layouts of JavaFX. [5]

    Swing JavaFX ----------------------- Swing is the standard toolkit for Java developers in creating GUI. JavaFX provides platform support for creating desktop applications. Swing has a more sophisticated set of GUI components. JavaFX has decent but lesser number of GUI components. Swing does not h...

  10. Q10.5 marksServlet vs JSP, JSP Access Model, JSP SyntAnswer

    What is servlet? Write a simple JSP file to display 'Tribhuvan University' five times. [5]

    --- A Servlet is a Java program that runs on the server side and is used to handle client requests and generate dynamic web content (typically HTML) as a response. Key points about Servlet: - It is a Java class that extends HttpServlet - It runs inside a Servlet Container (e.g., Apache Tomcat) - ...

  11. Q11.5 marksIntroduction to CORBA, RMI vs CORBA, ArchiAnswer

    Why CORBA is important? Compare CORBA with RMI. [5]

    CORBA (Common Object Request Broker Architecture) is a standard defined by the Object Management Group (OMG) that enables communication between objects written in different programming languages running on different platforms. 1. Language Independence: CORBA allows objects written in different la...

  12. Q12.5 marksJDBC Architecture, JDBC Driver Types, JDBCAnswer

    Write short notes on: a. JDBC drivers b. Java server pages [2.5+2.5]

    --- JDBC (Java Database Connectivity) provides a standard API for Java applications to interact with databases. A JDBC driver is a software component that enables Java applications to communicate with a database by translating JDBC method calls into database-specific calls. Type 1: JDBC-ODBC Brid...