Programming in Java - Answer Key
Section A – Answer All Questions (10 × 1 = 10 Marks)
1. Java is a platform-independent programming language.
2. 'this' keyword refers to the current class instance variable.
3. Incorrect: Thread can be formed by implementing Runnable interface only.
4. Exceptions can occur any time during program execution.
5. Swing is a lightweight GUI toolkit.
6. Literal is the value assigned to a variable.
7. Method Overriding implements polymorphism.
8. Interface achieves full abstraction.
9. try block is used for checking exceptions.
10. Java language is used in Swing framework.
Section A (Short Answers)
11. Keyword – reserved word with predefined meaning.
12. Class – blueprint for objects with data & methods.
13. Abstract Class – class with abstract methods, cannot be instantiated.
14. this Keyword – refers to current object.
15. Exception – runtime error disrupting normal flow.
Section B – Answer Any Five (5 × 5 = 25 Marks)
16. Features – Simple, Object-oriented, Platform Independent, Secure, Robust, Multithreaded.
17. Access Modifiers – public, protected, default, private.
18. Superclass & Subclass – use 'extends' for inheritance.
19. Exception Keywords – try, catch, finally, throw, throws.
20. JButton & JTextField – GUI components for button and text input.
21. ByteStreams handle binary, CharacterStreams handle text.
22. Type Conversion – implicit (widening) & explicit (casting).
23. Recursive Factorial Program – uses self-calling method.
Section C – Answer Any Three (3 × 10 = 30 Marks)
24. Decision-Making – if, if-else, nested if, switch.
25. Parameterized Constructor – initializes objects using parameters.
26. Packages – use 'package' to create and 'import' to use.
27. Multithreading – concurrent execution via Thread/Runnable.
28. Layout Managers – FlowLayout, BorderLayout, GridLayout, CardLayout, BoxLayout.