Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

java-qb

The document is a question bank for the OOPS with JAVA course, covering various topics related to object-oriented programming principles, Java syntax, data types, control structures, and memory management. It includes questions on concepts such as encapsulation, inheritance, polymorphism, method overloading, and the use of keywords, operators, and loops in Java. Additionally, it addresses advanced topics like constructor overloading, garbage collection, and access modifiers.

Uploaded by

dhyaanjnagaraj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

java-qb

The document is a question bank for the OOPS with JAVA course, covering various topics related to object-oriented programming principles, Java syntax, data types, control structures, and memory management. It includes questions on concepts such as encapsulation, inheritance, polymorphism, method overloading, and the use of keywords, operators, and loops in Java. Additionally, it addresses advanced topics like constructor overloading, garbage collection, and access modifiers.

Uploaded by

dhyaanjnagaraj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Question Bank

Subject:OOPS with JAVA(BCS306A))

Semester: 3rd Sem College:BIET,Davanagere

Department:CS&E University: VTU


1. Explain the two programming paradigms in Java.
2. Define abstraction and provide an example of its application in Java.
3. List and explain the three main principles of OOP: encapsulation, inheritance, and
polymorphism.
4. How does polymorphism benefit Java programming?
5. What is the difference between method overloading and method overriding?
6. What is a block of code in Java, and how is it defined?
7. Explain the concept of scope with examples of variable scope in different code blocks.
8. Explain the role of whitespace in Java. Does it affect the functionality of code?
9. What are identifiers in Java? Provide rules for creating valid identifiers.
10. What is a literal in Java? Give examples of different types of literals.
11. Describe the purpose of comments in Java and explain the difference between single-line
and multi-line comments.
12. What are Java keywords? List five keywords and their purpose.
13. List the four main primitive types in Java and provide examples of each.
14. How does Java differentiate between integer and floating-point data types?
15. What is the purpose of the `boolean` data type in Java?
16. How are variables declared in Java? Give examples of declaring and initializing different
types of variables.
17. Explain the difference between local, instance, and static variables in Java.
18. What is type casting, and when is it required in Java?
19. Explain automatic type promotion with an example.
20. Provide an example of explicit type casting and explain why it is necessary.
21. Describe arrays in Java and how they are declared and initialized.
22. How does Java handle multidimensional arrays?
23. What are the advantages and limitations of using arrays in Java?
24. What is type inference, and how does the `var` keyword enable it in Java?
25. Provide examples of type inference with `var` in local variable declarations.
26. List the arithmetic operators in Java and provide examples of their use.
27. What is the purpose of the modulus operator (`%`)? Provide an example.
28. Describe relational operators in Java and explain their role in conditional expressions.
29. How does the `==` operator differ from the `=` operator?
30. List the Boolean logical operators in Java and explain each with examples.
31. Explain the difference between `&&` and `||` operators.
32. What is the purpose of the assignment operator in Java?
33. Describe compound assignment operators and give examples.
34. What is the ternary operator in Java? Provide an example of its use.
35. How does the ternary operator compare to an `if-else` statement?
36. Explain operator precedence in Java and its significance.
37. Why are parentheses important in expressions? Give examples where parentheses change
the outcome.
38. Describe the `if` statement in Java and give an example.
39. What is the purpose of the `switch` statement? Provide an example with multiple cases.
40. Explain the `while` loop in Java with an example.
41. What is the difference between the `for` loop and the `for-each` loop in Java?
42. Describe a nested loop and provide a practical example.
43. What is the purpose of the `break` statement in Java? Give an example.
44. How does the `continue` statement affect loop execution?
45. Explain how the `return` statement is used to exit a method and return a value.
46. Define a class in Java and describe its structure.
47. What is the purpose of fields and methods in a Java class?
48. How are objects created from a class in Java?
49. What is the purpose of an object reference variable?
50. What is a constructor, and why is it used in Java?
51. Explain constructor overloading with an example.
52. What is the `this` keyword, and when is it used?
53. Provide an example where `this` is used to resolve a naming conflict.
54. Explain the concept of garbage collection in Java.
55. How does Java handle memory management for unused objects?
56. What does it mean to overload a method in Java? Provide an example.
57. How can objects be passed as parameters to methods? Provide an example.
58. Explain the difference between passing by value and passing by reference in Java.
59. How can methods return objects? Provide an example.
60. What is recursion, and how is it implemented in Java?
61. Provide a simple example of a recursive method.
62. What are the different access modifiers in Java, and what do they control?
63. Explain the difference between `public`, `private`, and `protected`.
64. What does the `static` keyword do in Java?
65. How are static methods different from instance methods?
66. What is the purpose of the `final` keyword in Java?
67. Explain how `final` is used with variables, methods, and classes.
68. What is a nested class in Java, and why would you use it?
69. Provide an example of an inner class.
70. Explain the concept of inheritance in Java and its benefits.
71. How does inheritance enable code reuse?
72. What is the `super` keyword, and when is it used?
73. Provide an example of calling a superclass method using `super`.
74. Explain multilevel inheritance with an example.
75. How does Java support a multilevel hierarchy?
76. Describe the order of constructor execution in Java inheritance.
77. What is method overriding, and why is it useful in inheritance?
78. Explain the difference between overriding and overloading.
79. Define dynamic method dispatch and explain how it works in Java.
80. What is an abstract class, and why would you use it?
81. Provide an example of an abstract class with an abstract method.
82. Explain how the `final` keyword restricts inheritance.

You might also like