0% found this document useful (0 votes)
70 views5 pages

Java Programming Exam Questions and Solutions

This document provides instructions and questions for an exam on Java programming and related technologies. It consists of 6 questions worth a total of 100 marks. The questions cover topics like fonts, swing controls, JDBC, applets, servlets, networking, and databases. Students are instructed to show code examples and illustrations where appropriate. They are also told they can assume additional details as needed to fully answer the questions.
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)
70 views5 pages

Java Programming Exam Questions and Solutions

This document provides instructions and questions for an exam on Java programming and related technologies. It consists of 6 questions worth a total of 100 marks. The questions cover topics like fonts, swing controls, JDBC, applets, servlets, networking, and databases. Students are instructed to show code examples and illustrations where appropriate. They are also told they can assume additional details as needed to fully answer the questions.
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

12259

11122 3 Hours / 100 Marks


Instructions

Seat No.

(1) All Questions are compulsory. (2) Illustrate your answers with neat sketches wherever necessary. (3) Figures to the right indicate full marks. (4) Assume suitable data, if necessary.

Marks 1. Attempt any FOUR of the following: a) How to check, how many fonts are available in the computer system? Explain with example. b) Explain following checkbox class methods with appropriate example: (i) (ii) (i) (ii) void setLabel(string str) boolean getState( Scrollpanes Tree ) 16

c) Give the use of following swing controls.

d) What is the use of Generic Servlet? State the difference between generic servlet and http servlet. e) Describe the use of the following: (i) (ii) f) (i) (ii) Reserved sockets DNS (Domain Naming Service) getConnection( createStatement( ) )
P.T.O.

State the use of following methods

12259 2.

[2] Marks Attempt any THREE of the following: 18

a) What is Frame? Write a procedure to close frame with the help of example. b) WAP to create following tabbed pane (FONT) Tab l - Font (Three combo boxes: font, font style, font size) Tab 2 - Effects (Four check boxes: subscript, super script, strike, shadow) Tab 3 - Spacing (List : spacing, position margin) c) Classify JDBC driver types according to their architecture. d) Write a program to display three text fields, and a button below to all on Applet. Insert the integer values from three text fields. After pressing the button the background colour of the applet will be changed as per the RGB combination of the values given in the text field. 3. Attempt any TWO of the following: a) Write a program to create an applet that will accept values of three test marks i.e. test1, test2, test3 each out of 25. The user will enter the marks in three separate text fields. The applet will have a button labeled Find Average. When the user will click on the button the average of test marks will be displayed in the fourth text field. b) Give the use of following methods of connection and statement interface: (i) (ii) createStatement( ) executeQuery( ) 16

(iii) getResultSet( ) c) WAP to create menubar in frame. Where menubar contains menu items such as File, Edit and View and sub menu items included under file menu such as New, Open using AWT.

12259 4.

[3] Marks Attempt any FOUR of the following: 16

a) What is InetAddress? Explain the factory methods of InetAddress. b) Describe the syntax and use of four methods for navigation through data base records using result set objects. c) Illustrate the use of accept( ) and close( socket with suitable example. ) methods of server

d) What is default Mutable Tree Node? Elaborate its use by giving example. e) Write a program to display a JcomboBox on an Applet. The comboBox will have following items - mouse, keyboard, battery, UPS, Stabilizer. 5. a) Attempt any THREE of the following: (i) (ii) 12

What is the purpose of using URL connection class? Illustrate with suitable example. Give the use of following methods of URL class with example. (1) getProtocol( (2) getPort( (3) getHost( (4) getFile( ) ) ) )

(iii) Explain the techniques of session tracking/management. (iv) Describe servlet life cycle in brief. b) Attempt any ONE of the following: (i) (ii) Explain use of cookies with example. Describe how to Update, insert and delete records in the result set. 6

P.T.O.

12259 6.

[4] Marks Attempt any TWO of the following: 16

a) Create Database table, write a java program. Columns : Company, number, cost, memory capacity. DSN : Mobile Entries : 05 Using above database, determine total number of mobiles belongs to ABC company. Arrange them in ascending order. b) Write a program to display a JcomboBox and a just on an Applet. ComboBox will have five country names as members and list will have their capitals as members when user selects a particular country from comboBox the equivalent capital should get selected from list. Display them on Applet window. c) Write a program to create a servlet that handles HttpGET and HttpPOST requests.

12259
11122 3 Hours / 100 Marks

Common questions

Powered by AI

Scrollpanes in Java Swing allow for viewing content that exceeds the visible area by adding horizontal and vertical scroll bars. They provide enhanced navigation within an application window, significantly improving user experience for applications with extensive content. Trees, on the other hand, present hierarchical data structures, allowing users to navigate complex data sets intuitively. Their ability to expand and collapse makes them perfect for settings like file directories or product categories, enhancing organization and accessibility within the UI .

Session tracking is vital in web applications as it maintains a user's state and data across multiple HTTP requests. Techniques like cookies, URL rewriting, and session objects allow for differentiating between different sessions and track user activity, preferences, and identity. For instance, logging in creates a session holding user credentials, enabling personalized interactions throughout the session until they logout. This management is crucial for application usability and security, preventing unauthorized access and ensuring consistent user experience .

HTTP Servlets significantly streamline web-based application development by providing a robust framework for serving HTTP requests. They handle client-server communication with specific methods like doGet() for GET requests and doPost() for POST requests. Servlets can maintain session data across multiple requests and respond dynamically based on user input. They enhance scalability, security, and performance, allowing developers to integrate business logic within presentations, considerably improving the user experience on web applications .

The setLabel(String str) method in a checkbox class sets the label displayed next to the checkbox. For example, if you want a checkbox for 'Subscribe' options, setLabel("Subscribe") makes the label 'Subscribe' visible. The getState() method returns a boolean value indicating whether the checkbox is checked (true) or unchecked (false). For instance, you can use getState() to execute certain code only if the checkbox is checked, enhancing interactivity and control over the application .

A JcomboBox enhances UI by providing a compact selection mechanism from a limited set of choices, reducing screen clutter. This component allows users to select one item from a drop-down list, minimizing typographical errors and improving data consistency. A practical example is displaying a JcomboBox for device selection, such as choosing between 'mouse', 'keyboard', 'battery', 'UPS', or 'Stabilizer', which provides a clear and user-friendly interface element that enhances user interaction .

The InetAddress class in Java is used to encapsulate both the numerical IP address and the domain name for that address. Factory methods like getByName(String host) return the InetAddress object of a domain, while getAllByName() retrieves all IP addresses associated with a host. These methods are crucial for network operations that require DNS lookups or need to establish connections using domain names instead of raw IP addresses, providing flexibility and ease in managing network addresses .

A Generic Servlet is protocol-independent, meaning it can handle requests from any protocol, but is primarily extended to create servlets that don't require HTTP-specific functionalities. In contrast, HTTP Servlet is a subclass of Generic Servlet specifically designed for HTTP protocol, providing methods like doGet() and doPost() for handling HTTP requests. Generic Servlets are useful for general tasks like reading and writing data, while HTTP Servlets are ideal for web-based applications where you need HTTP-specific request handling .

The getConnection() method is crucial as it facilitates establishing a connection to a database. This method is part of the DriverManager class, which manages the set of Java Database Connectivity (JDBC) drivers. By specifying a database's URL and login credentials, getConnection() opens a secure and reliable connection, allowing structured data queries and operations. This method is foundational for any database interaction, as it initiates the sessions allowing for data manipulation and retrieval .

Updating, inserting, and deleting records in a result set involve using the ResultSet interface in JDBC, which allows interaction with the database. The updateRow(), insertRow(), and deleteRow() methods facilitate these operations, providing real-time changes to data. For instance, executing an updateRow() after modifying data in a result set column updates the database immediately. Similarly, deleteRow() removes the current row from the database, while insertRow() adds a new record. These operations are essential for maintaining dynamic and flexible data management in applications .

Cookies are small data units stored in browsers, used for maintaining state across HTTP requests in web applications. They retain user-specific data, such as login status or preferences, facilitating a seamless user experience. For example, a cookie might store authentication information to keep a user logged into a site. When a browser makes subsequent requests to the server, these cookies are sent along, allowing the server to recognize the user and serve personalized content without requiring login on every visit .

You might also like