Java Programming – Solved Questions
1. Process of Compiling and Executing a Java Program
Java follows two steps: Compilation and Execution. The source code (.java) is compiled using javac
into bytecode (.class).
The JVM executes bytecode and converts it into machine code, ensuring platform independence.
2. Matrix Addition Using 2D Array
Program demonstrates reading two matrices, adding corresponding elements, and displaying the
result.
3. Inheritance and Its Types
Inheritance allows a class to acquire properties of another class using extends keyword.
Types: Single, Multilevel, Hierarchical, Multiple (using interfaces).
4. Abstract Class Example
Abstract classes contain abstract methods that must be implemented by subclasses.
5. Runtime Polymorphism (RBI Example)
Method overriding allows different implementations of getInterestRate() at runtime.
6. Quadratic Equation Program
Uses quadratic formula to find real roots based on discriminant value.
7. Traffic Light Simulation (Swing)
Uses JRadioButtons and ActionListener to simulate traffic signals.
8. Multithreading – Odd and Even Numbers
Two threads print odd and even numbers from 1 to 20 concurrently.
9. Swing Program to Add Two Numbers
Reads input from two text fields and displays sum in third field.
10. Abstract Window Toolkit (AWT) & Event Handling
AWT provides GUI components. Event handling uses Delegation Event Model with listeners.
11. Program to Find C(n, r) Using Inheritance
Factorial class is inherited to compute combinations.
12. Access Protection Levels in Java
Access specifiers: private, default, protected, public – control visibility and security.
13. Event Handling & Delegation Event Model
Handles user interactions using event source, event object, and listener.
--- End of Solved Paper ---