2081

BIT401 · TU past paper

Advanced Java Programming 2081 question paper

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

Past Papers208220812080

Tap a question to open its answer.

  1. Q1.10 marksServlet APIsAnswer

    Discuss about any four servlet APIs. Design a form in JSP to take the necessary information about an employee and when the user click submit button, it will be displayed in second page.[10]

    The HttpServletRequest object contains the request sent by the client to the server. Key methods include: - getParameter(String name) - retrieves a single parameter value from the request - getParameterValues(String name) - retrieves multiple values for the same parameter - getMethod() - returns ...

  2. Q2.10 marksMenu items with mnemonics and acceleratorsAnswer

    When do we use JPanel? How do you add mnemonics and accelerators to menu items? Explain.[10]

    JPanel is a lightweight container component in Java Swing used in the following scenarios: 1. Organizing Components: JPanel groups related GUI components together logically. For example, grouping buttons, text fields, or labels that form a functional unit. 2. Layout Management: JPanel allows you ...

  3. Q3.10 marksInner classes and anonymous inner classesAnswer

    How do you create inner class and anonymous inner class? Create a class EMPLOYEE with data members Emp_ID, Name and Occupation, and write those objects to the file DOC.DAT whose occupations is doctor.[10]

    An inner class is a class defined within another class. It has access to the outer class's members. Syntax: Creating objects: An anonymous inner class is a class without a name, typically used to override methods of an interface or abstract class on-the-fly. Syntax: --- Output: --- - Serializable...

  4. Q4.5 marksJavaFX layoutsAnswer

    Describe about any three types of JavaFX layouts. [5]

    JavaFX provides several layout panes to organize and position UI components. Here are three important types: --- BorderPane divides the layout area into five regions: top, bottom, left, right, and center. - Structure: The center region expands to fill available space; edge regions take only requi...

  5. Q5.5 marksEvent handling and action commandsAnswer

    Write a program to design a form with a button and label, such that the number of times the button is clicked will be displayed in label. [5]

    Key Components: 1. Window Creation: tk.Tk() creates the main application window with title and size. 2. Global Counter: clickcount variable stores the number of button clicks. 3. Click Handler Function: onbuttonclick() function: - Increments the counter by 1 each time button is clicked - Updates ...

  6. Q6.5 marksRMI architecture and componentsAnswer

    Explain the architecture of RMI. [5]

    RMI is a Java mechanism that allows a program running on one JVM to invoke methods on objects residing in another JVM. The architecture consists of the following layers: - Contains the client and server applications - Client invokes remote methods as if they were local - Server implements the rem...

  7. Q7.5 marksMouse events and keyboard eventsAnswer

    Write a program to show the use of mouse event. [5]

    Since reference notes are not provided, this answer follows standard web-based mouse event handling appropriate for BSc CSIT curriculum. Event Description -------------------- mouseover Triggered when mouse pointer enters element mouseout Triggered when mouse pointer leaves element click Triggere...

  8. Q8.5 marksPackage definition and organizationAnswer

    Define package. What is the use of final keyword and finally block? [5]

    A package is a namespace mechanism in Java used to organize and group related classes, interfaces, and sub-packages into a hierarchical structure. Packages help avoid naming conflicts and provide a way to control access to classes and members. Example structure: --- The final keyword in Java is u...

  9. Q9.5 marksJDBC architecture and driver typesAnswer

    Explain the architecture of JDBC and list the JDBC driver types. [5]

    JDBC (Java Database Connectivity) follows a layered architecture consisting of two main layers: - This is the top layer where Java applications interact with databases - Applications use JDBC API to communicate with databases - Developers write code using JDBC interfaces and classes - This layer ...

  10. Q10.5 marksUDP socket programming stepsAnswer

    Write the steps of writing socket program using UDP. [5]

    UDP (User Datagram Protocol) is a connectionless, unreliable transport layer protocol. The following are the steps to write a UDP socket program: 1. Create a socket - Use socket() system call with parameters: AFINET (address family), SOCKDGRAM (socket type for UDP), and IPPROTOUDP (protocol) - Ex...

  11. Q11.5 marksScriptlets and JSP access modelsAnswer

    Define scriptlets. Discuss about JSP access models. [5]

    Scriptlets are blocks of Java code embedded directly within JSP (JavaServer Pages) documents. They are enclosed within <% ... % tags and allow developers to write Java logic that executes on the server side during page processing. Syntax: Scriptlets have full access to JSP implicit objects and ca...

  12. Q12.5 marksPort usage and significanceAnswer

    Why do we need ports in socket programming? What types of instructions are written in try block? [5]

    Ports serve the following critical purposes: 1. Process Identification: Ports uniquely identify specific processes or services running on a host machine. Since a single computer can run multiple network applications simultaneously, ports distinguish between them. 2. Multiplexing Communication: Po...