Skip to content
IT-306 · Java Programming Lab/Important Questions

Java Programming Lab (IT-306) - Important Questions

  1. Unit 414 Marks High Priority

    Explain the architecture of the Abstract Window Toolkit (AWT). Write a Java AWT program that creates a Frame with the following components: Label, TextField, Button, and a Panel. Arrange components appropriately and demonstrate basic event handling for the Button to read text from the TextField and display it on the Label.

    Core AWT / GUI fundamentals question. Directly tests knowledge of AWT architecture and practical creation of a GUI using AWT components; reflected as a high-frequency topic in Unit 4 heatmap.

  2. Unit 414 Marks High Priority

    Write a Java program that demonstrates the use of GridLayout and BorderLayout. The program should provide a way to switch between GridLayout and BorderLayout at runtime (for example using a Checkbox or Button). Explain how components are arranged under each layout manager and show the code that performs the layout switching.

    Directly tests knowledge and implementation of layout managers; high-frequency practical exam-style task focusing on GridLayout and BorderLayout.

  3. Unit 410 Marks High Priority

    Design an AWT program that creates a main Frame containing nested Panels. Use GridLayout to arrange buttons in one Panel and other controls (Label, TextField) in another Panel. Implement event handling so that when a button is clicked, the TextField is updated with the button label.

    Practical AWT programming question combining nested Panels and GridLayout usage with event handling; common pattern in lab exercises and exams.

  4. Unit 47 Marks High Priority

    Explain the difference between heavyweight and lightweight GUI components in Java. Give examples of each and discuss the implications for look-and-feel, painting, and event handling.

    Conceptual question about component types in Java GUIs; frequently asked to test conceptual understanding of AWT vs Swing.

  5. Unit 410 Marks Medium Priority

    Create a simple calculator GUI using AWT. Use BorderLayout for the main Frame and place the display TextField in the North region. Use a Panel with GridLayout for numeric and operator buttons in the Center region. Implement event handling to perform basic arithmetic operations.

    Application-style question focused on building a small utility GUI using BorderLayout and nested layouts; moderate frequency in practical assessments.

  6. Unit 410 Marks High Priority

    Write an AWT program that demonstrates MouseListener and KeyListener. The program should update a Label with the current mouse coordinates when the mouse is moved or clicked, and update another Label when specific keys are pressed. Include code for registering listeners and handling events.

    Tests event handling capabilities for mouse and keyboard interactions in AWT; important for GUI interactivity tasks.

  7. Unit 410 Marks Medium Priority

    Write a Java AWT program to create a button matrix using GridLayout with dimensions $m \times n$. Each cell should contain a Button labeled by its row and column index. Implement event handling so that clicking any button displays its indices in a Label.

    Parameterized GUI generation question using GridLayout with variable dimensions. Tests loop-based component creation and event handling for each generated control.

  8. Unit 47 Marks Medium Priority

    Design an AWT application that demonstrates the use of MenuBar, Menu, and MenuItem. Create at least two menus with multiple MenuItems and implement event handling for menu selections (e.g., File->Exit closes the application).

    Practical question on AWT menu components and event handling; commonly asked in lab exams to test menu creation and action processing.

  9. Unit 47 Marks Medium Priority

    Describe the following AWT layout managers: FlowLayout, BorderLayout, GridLayout, and CardLayout. For each layout manager, explain how components are arranged and give one use-case scenario where it is appropriate.

    Comparative conceptual question about available AWT layout managers; useful for design decisions in GUI development and commonly asked as short-answer theory.

  10. Unit 47 Marks Medium Priority

    Write an AWT program that uses Checkbox, CheckboxGroup, Choice, and List components. Demonstrate how to retrieve the selected values from each component and display them in a TextArea when a Button is clicked.

    Practical question focusing on selection components in AWT and retrieving user choices; typical lab question to assess use of specialized components and their listeners.

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in