OOPS WITH JAVA EXAM PREP –
⬛ Short Answer Questions & Answers (Java Syllabus – 1 Mark)
1. Introduction to Java
1. Q: What is Java?
A: Java is an object-oriented, platform-independent programming
language.
2. Q: Name two features of Java.
A: Platform-independent, Object-oriented.
3. Q: What is JVM?
A: JVM (Java Virtual Machine) executes Java bytecode on any platform.
4. Q: What is the difference between PATH and CLASSPATH?
A: PATH specifies location of executables, CLASSPATH specifies
location of classes/libraries.
5. Q: What is bytecode?
A: Intermediate code generated by the Java compiler, executed by JVM.
2. Basics of Java Programming
6. Q: Name two primitive data types in Java.
A: int, float.
7. Q: What is a static variable?
A: A variable shared by all objects of the class.
8. Q: What is a final variable?
A: A constant variable whose value cannot be changed once assigned.
9. Q: Which package provides BigInteger class?
A: java.math.
10. Q: Name two control structures in Java.
A: if-else, switch.
,2|Page
3. Object-Oriented Programming Concepts
11. Q: What are access modifiers in Java?
A: public, private, protected, default.
12. Q: What is encapsulation?
A: Wrapping data and methods together in a class.
13. Q: What is abstraction?
A: Hiding implementation details and showing only essential features.
14. Q: What is constructor chaining?
A: Calling one constructor from another within the same or parent class.
15. Q: What keyword is used to call a constructor from another constructor in
the same class?
A: this().
4. Inheritance and Polymorphism
16. Q: What is inheritance?
A: The mechanism of acquiring properties and methods from another
class.
17. Q: Which keyword is used for inheritance?
A: extends.
18. Q: What is method overloading?
A: Defining multiple methods with the same name but different
parameters.
19. Q: What is method overriding?
A: Redefining a parent class method in a child class with the same
signature.
20. Q: Can we override a static method?
A: No.
5. Arrays and Strings
21. Q: How to declare a single-dimensional array?
A: int arr[] = new int[5];
,3|Page
22. Q: Which class provides utility methods for arrays in Java?
A: java.util.Arrays.
23. Q: Name two methods of the Arrays class.
A: sort(), binarySearch().
24. Q: Difference between String and StringBuilder?
A: String is immutable, StringBuilder is mutable.
25. Q: Which class is thread-safe: StringBuffer or StringBuilder?
A: StringBuffer.
6. Interfaces and Abstract Classes
26. Q: Can an interface have concrete methods?
A: No (except default and static methods from Java 8).
27. Q: Can we create an object of an abstract class?
A: No.
28. Q: How is multiple inheritance achieved in Java?
A: Using interfaces.
7. Exception Handling
29. Q: What are checked exceptions?
A: Exceptions checked at compile time (e.g., IOException).
30. Q: What are unchecked exceptions?
A: Exceptions checked at runtime (e.g., NullPointerException).
31. Q: Which block always executes in exception handling?
A: finally.
32. Q: Which keywords are used to declare exceptions?
A: throw, throws.
33. Q: What is a custom exception?
A: A user-defined exception extending Exception class.
, 4|Page
8. File I/O and Serialization
34. Q: Which package is used for file handling in Java?
A: java.io.
35. Q: What is serialization?
A: The process of converting an object into a byte stream.
36. Q: Which interface must a class implement to be serializable?
A: Serializable.
37. Q: Which classes are commonly used for file reading and writing?
A: FileReader, FileWriter, BufferedReader, BufferedWriter.
9. Multithreading
38. Q: Which two ways can we create a thread in Java?
A: Extending Thread class, implementing Runnable interface.
39. Q: What are the states of a thread lifecycle?
A: New, Runnable, Running, Waiting, Terminated.
40. Q: Which keyword is used for synchronization?
A: synchronized.
41. Q: What methods are used for inter-thread communication?
A: wait(), notify(), notifyAll().
5 MARKS –
Module – 1
Q1. What are the key features of Java?
Answer:
The key features of Java are:
1. Simple: Easy to learn and use with clear syntax.
2. Object-Oriented: Everything is an object; supports classes, inheritance,
polymorphism, and encapsulation.
3. Platform-Independent: Write Once, Run Anywhere (WORA) using
bytecode executed by JVM.