BCSL-043 Viva Questions (Java Programming Lab)
Basics of Java
- What is Java? What are its main features?
- What is JVM, JRE, and JDK?
- Why is Java platform-independent?
Data Types and Variables
- What are the primitive data types in Java?
- Difference between int and Integer?
- What is type casting in Java?
Control Structures
- Explain the use of if-else, switch-case, for, while loops.
- Difference between while and do-while loop?
- When do you use switch-case instead of if-else?
OOP Concepts
- What is a class and object in Java?
- What is constructor? Types of constructors?
- What is inheritance? Types?
- Difference between method overloading and overriding?
- What is polymorphism?
- What is encapsulation and how is it implemented?
- What is abstraction? Interface vs Abstract class?
- Can Java support multiple inheritance? How?
Access Modifiers
- What are the different access modifiers in Java?
Exception Handling
- What is exception handling? Why is it important?
- Difference between checked and unchecked exceptions?
- Explain try-catch-finally with example.
- What is the use of throw and throws?
Packages and Interfaces
- What is a package in Java?
- How do you import a package?
- What is the difference between package and class?
- What is an interface and how is it used?
File Handling (I/O)
- How do you read/write from a file in Java?
- Which classes are used for file I/O?
Applets and AWT (if included)
- What is an applet?
- Difference between applet and application?
Miscellaneous
- What is garbage collection in Java?
- What is the significance of the static keyword?
- What is the main method and why is it static?
- Difference between == and .equals()?
- What is a wrapper class in Java?
- What are final, finally, and finalize()?
- Can a constructor be private? Why?