Question Bank of OOPS using Java
1. Explain the scope of a variable declared inside a method.
2. Define abstraction in Java with an example.
3. What is the default return type of a method if not specified?
4. How does a constant member function differ from a regular one?
5. Explain runtime polymorphism using a superclass and subclasses.
6. Compare try-catch blocks vs. throws declarations with examples. Which is better in large
applications?
7. Write a Java program to handle exceptions using try-catch.
8. What is stack unwinding in Java exception handling?
9. Create a Java program to demonstrate method types (static, instance, parameterized) and
method overloading.
10. What are the advantages of exception handling in Java?
11. Define encapsulation with a real-world analogy.
12. Explain how inheritance improves code reusability with an example.
13. Differentiate between abstraction and encapsulation.
14. Write an example of a ternary operator and explain its use.
15. Describe how user-defined exceptions are created in Java.
16. Differentiate between compile-time and runtime polymorphism.
17. Write the syntax for defining a class in Java.
18. Describe the hierarchy of exception classes in Java.
19. What is the full form of JVM and what role does it play in Java execution?
20. Differentiate between JVM and JRE.
21. What happens if a non-void method does not return a value?
22. Create a program using multilevel inheritance with method overriding at each level.
23. What is the use of the `this` keyword in Java?
24. Explain how abstract classes can be used to implement polymorphism.
25. What are the types of memory managed by the garbage collector?
26. Can a final class be extended? Justify your answer.
27. What is dynamic method dispatch in Java?
28. Explain the role of the Garbage Collector in Java.
29. Explain the difference between `break` and `continue` with examples.
30. Differentiate between `==` and `equals()` in Java.
31. What happens during stack unwinding when an exception is thrown?
32. Explain method overriding in Java with a simple example.
33. Compare checked and unchecked exceptions with code.
34. Compare call by value vs. call by reference in Java with code examples. Explain the
outcomes clearly.
35. Discuss how access modifiers control access levels in Java.
36. Can interfaces have default methods? Explain with example.
37. List any two types of exceptions in Java with examples.
38. What are the rules for constructor chaining in inherited classes?
39. Write a Java program using loop constructs (`for`, `while`, `do-while`).
40. Why is runtime polymorphism preferred in large systems.
41. Explain how does a derived class access base class members in Java.
42. Write a Java program that demonstrates all four OOP concepts (Encapsulation,
Inheritance, Abstraction, Polymorphism).
43. Can the ternary operator return different types? Justify.
44. What is the behavior of final methods inside classes?
45. How do nested try blocks function in Java?
46. Can a custom exception be both checked and unchecked? Explain.
47. How does Java achieve encapsulation.
48. How does inheritance support code reusability?
49. How do local, instance, and static variables differ?
50. What are the different types of inheritance supported in Java.
51. What are the limitations of final classes.
52. What is the labeled form of break and continue?
53. Differentiate between static binding and dynamic binding.
54. Discuss the concept of a final class in Java.
55. Define abstraction and explain how it is implemented using abstract classes.
56. Write a Java program to check if a given string is a palindrome.
57. Why is encapsulation considered a good practice in OOP?
58. What are the rules for method overriding in Java?
59. Describe how multiple inheritance is achieved using interfaces.
60. When should you prefer custom exception classes?
61. Create a program showing method overriding and polymorphism.
62. How can memory leaks occur even in garbage-collected environments?
63. How does `this` differ from `super` in Java?
64. Can a final class contain final methods? Explain with example.
65. Write a Java program demonstrating constructor overloading and explain how it differs
from method overloading.
66. Which keyword is used to catch exceptions in Java and how does it work?
67. Which keyword is used to inherit a class in Java?
68. Why is it important to use meaningful exception messages in Java?
69. Can constructors be overloaded? Give an example.
70. Explain the contract between `equals()` and `hashCode()`.
71. What is variable shadowing in Java?
72. What are the components of a Java class?
73. How can access modifiers affect base class member accessibility?
74. How is dynamic dispatch implemented using method overriding?
75. Can an abstract class have a constructor? Explain.
76. How do control statements impact loop execution in Java?
77. What is the purpose of the `final` keyword in Java?
78. How does the JVM perform memory management?
79. Explain the try-catch-finally structure in Java.
80. What is the difference between `this` and `super` in Java?
81. Provide examples for both compile-time and runtime polymorphism.
82. What are the advantages of method overloading?
83. What are the benefits of using abstract classes for polymorphism?
84. How do you create an object for a class in Java?
85. How is multiple inheritance implemented using interfaces?
86. Give real-world use cases of final classes.
87. Write a Java program to implement custom exception handling using try-catch.
88. How do constructors support dynamic object creation in Java?
89. Compare the ternary operator with `if-else` in Java.
90. List two types of exception handling mechanisms in Java.