1. Which of the following is not a Java keyword?
A. static
B. Boolean
C. void
D. private
✅ Answer: B. Boolean
2. What is the default value of a local variable in Java?
A. 0
B. null
C. false
D. No default value
✅ Answer: D. No default value
3. Which concept of OOP is achieved by method overloading?
A. Encapsulation
B. Polymorphism
C. Abstraction
D. Inheritance
✅ Answer: B. Polymorphism
4. What is the size of an int in Java?
A. 2 bytes
B. 4 bytes
C. 8 bytes
D. Depends on OS
✅ Answer: B. 4 bytes
5. Which of these cannot be used for a variable name in Java?
A. myVariable
B. $value
C. _count
D. 123abc
✅ Answer: D. 123abc
6. Which method is the entry point of a Java program?
A. start()
B. run()
C. main()
D. init()
✅ Answer: C. main()
7. What will System.out.println(10 + 20 + "Java"); output?
A. Java30
B. 30Java
C. 1020Java
D. Compilation error
✅ Answer: B. 30Java
8. Which of the following is not a valid access modifier?
A. private
B. protected
C. internal
D. public
✅ Answer: C. internal
9. Which keyword is used to inherit a class in Java?
A. implements
B. extends
C. inherits
D. instanceOf
✅ Answer: B. extends
10. What does the final keyword mean when applied to a variable?
A. It cannot be overridden
B. It cannot be reassigned
C. It cannot be accessed
D. It is public
✅ Answer: B. It cannot be reassigned
11. Which of these statements about constructors is true?
A. Constructors can have a return type
B. Constructors are inherited
C. Constructors initialize objects
D. Constructors can be abstract
✅ Answer: C. Constructors initialize objects
12. Which class is the parent of all classes in Java?
A. System
B. Object
C. Runtime
D. Class
✅ Answer: B. Object
13. What is method overriding?
A. Two methods with the same name in one class
B. Subclass providing a new implementation of a superclass method
C. Two methods differing only by parameters
D. Method hiding
✅ Answer: B. Subclass providing a new implementation of a superclass method
14. Can a constructor be static?
A. Yes
B. No
C. Only in abstract classes
D. Only for inner classes
✅ Answer: B. No
15. Which package is imported by default?
A. java.util
B. java.lang
C. java.io
D. java.net
✅ Answer: B. java.lang
16. Which of these data types can store Unicode characters?
A. int
B. float
C. char
D. String
✅ Answer: C. char
17. What does this keyword refer to?
A. Parent class object
B. Current object
C. Static object
D. Class name
✅ Answer: B. Current object
18. Which of the following cannot be declared abstract?
A. Class
B. Method
C. Variable
D. Interface
✅ Answer: C. Variable
19. Which of the following is not an OOP principle?
A. Inheritance
B. Compilation
C. Polymorphism
D. Abstraction
✅ Answer: B. Compilation
20. Which of these operators is used for string comparison?
A. ==
B. equals()
C. compareTo()
D. Both B and C
✅ Answer: D. Both B and C
 
								 
 


















