BCA SEMESTER V – JAVA PROGRAMMING USING LINUX (2021)
=====================================
FULL ANSWERS (2, 5, and 15 MARKS)
=====================================
PART A — 2 MARKS QUESTIONS AND ANSWERS
--------------------------------------
1. Numeric vs Non-numeric Literal
- Numeric Literals: Represent numbers like integers or decimals (e.g., 10, 3.14).
- Non-numeric Literals: Represent text or logic values (e.g., 'A', "Java", true).
2. Operators = and ==
- '=' is an assignment operator: assigns value (a = 5).
- '==' is a comparison operator: compares two values (a == 5).
3. Use of this keyword
- Refers to the current class object.
- Used to differentiate instance variables from parameters or to call another constructor.
4. Constructor Overloading
- Defining multiple constructors with different parameters in one class.
Example: class A { A(){} A(int x){} }
5. Derived Class
- A class that inherits properties from another class using the 'extends' keyword.
6. Package
- A collection of related classes and interfaces grouped together.
Example: [Link], [Link]
7. Exception Handling
- A mechanism to handle runtime errors using try, catch, throw, throws, and finally.
8. Delegation Event Model
- A mechanism where an event source delegates event handling to a listener object.
9. JCheckBox
- GUI component allowing multiple selections at once.
10. Layout Manager
- Manages how components are arranged in a container.
Types: FlowLayout, BorderLayout, GridLayout, CardLayout.
11. init() vs start() in Applet
- init(): Called once when applet starts.
- start(): Called each time applet becomes active.
12. JDBC API Components
- DriverManager, Connection, Statement, ResultSet, SQLException.
PART B — 5 MARKS QUESTIONS AND ANSWERS
--------------------------------------
13. Milestones of Java Language
1. Simple & Object-Oriented
2. Platform Independent
3. Robust & Secure
4. Multithreaded
5. Portable
14. Armstrong Number Program
15. Declaring Methods in Java
Syntax: returnType methodName(parameters) { }
16. Final Class Example
A final class cannot be inherited.
17. Creating & Initializing 1D Array
Example: int[] arr = {10,20,30,40};
18. 2D Array Initialization
Example: int[][] a = { {1,2,3}, {4,5,6} };
19. JCheckBox vs JRadioButton and JList vs JComboBox differences.
20. Applet Tag Example
21. Applet to Draw a Human Face
PART C — 15 MARKS QUESTIONS AND ANSWERS
--------------------------------------
22. Branching Statements in Java
Explanation of if, if-else, switch, break, continue.
23. Interfaces in Java
Definition, syntax, example of implementing interfaces, features and advantages.
24. Life Cycle of a Thread & Program for Thread Priorities
Explains stages: New, Runnable, Running, Blocked, Dead.
Includes example of thread creation and priority setting.
25. JLabel and JButton with Real-World Example
Definition, example code using Swing GUI, real-world use in login form.
--------------------------------------
Prepared Answers for: Programming with Java Sem 5 (2021)