Java Programming Lab (IT-306) - Important Questions
-
Unit 57 Marks High Priority
Explain the Delegation Event Model in Java. Describe key components such as event source, event object, and event listener. Illustrate the flow of an event from source to listener and list common listener interfaces used in AWT/Swing.
Core theory question on the Java delegation event model; frequently asked in exams and forms the foundation for event-driven programming in Unit 5.
-
Unit 510 Marks High Priority
Write a Java program (AWT or Swing) that creates a GUI with at least three Buttons (or JButton). Implement event handling using ActionListener so that each button performs a different action (for example: change label text, change background color, and exit application). Use anonymous inner classes or separate listener classes as appropriate and comment key lines.
Standard programming question requiring practical demonstration of event handling using ActionListener; commonly appears in lab and practical papers.
-
Unit 57 Marks Medium Priority
Differentiate between ActionEvent, ItemEvent, KeyEvent, MouseEvent, and WindowEvent in Java. For each event type, name the associated listener interface and give a short, one-line example of a typical use-case.
Concept-comparison question covering multiple event categories; useful to test breadth of event handling knowledge.
-
Unit 510 Marks Medium Priority
Write a Java program using AWT or Swing that allows the user to draw freehand on a drawing area using mouse drag. Use MouseListener and MouseMotionListener (or appropriate adapter classes) to capture press, drag, and release events and render the drawing in real time.
Common practical programming task to assess use of mouse listeners and motion listeners; tests GUI interactivity handling.
-
Unit 55 Marks Medium Priority
What are adapter classes in Java event handling? Explain their purpose and give an example showing how WindowAdapter can be used to handle window closing without implementing every method of WindowListener.
Short conceptual/programming question on adapter classes and window management; often used in practical exams.
-
Unit 514 Marks High Priority
Write a JDBC program to connect to a database, execute a SELECT query on a sample table, and display the results. Demonstrate and use ResultSet navigation methods such as next(), first(), last(), previous(), absolute(n), and relative(n). Include proper resource closing and exception handling in your program.
Core JDBC practical question; highly repeated in past papers and represents the standard JDBC connectivity and ResultSet navigation requirement for Unit 5.
-
Unit 57 Marks High Priority
Explain the differences between Statement, PreparedStatement, and CallableStatement in JDBC. For each type give one example use-case and mention advantages of PreparedStatement over Statement.
Important conceptual question about JDBC API variants; commonly asked to test understanding of statement types.
-
Unit 510 Marks High Priority
Describe different ResultSet types and concurrency modes available in JDBC (for example TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE, CONCUR_READ_ONLY, CONCUR_UPDATABLE). Write a short code snippet (outline) showing how to create a scrollable, updatable ResultSet and update a row using ResultSet.updateXXX() and updateRow().
Directly targets ResultSet types and updatable result sets which are core to Unit 5's JDBC topic and frequently examined.
-
Unit 57 Marks Medium Priority
Explain transaction management in JDBC. Discuss auto-commit mode, how to disable it, how to use commit() and rollback(), and how to use batch updates. Provide a short example showing disabling auto-commit, performing multiple updates, and committing or rolling back based on success.
Transactional control in JDBC is commonly examined to assess knowledge of commit/rollback and batch operations.
-
Unit 55 Marks Low Priority
Write a JDBC snippet that obtains and prints column names and column count for a ResultSet using ResultSetMetaData. Explain why ResultSetMetaData can be useful in generic table-display utilities.
Less frequent but practical question to test use of metadata APIs for dynamic ResultSet handling.
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel