0% found this document useful (0 votes)
34 views3 pages

Java MCQ Questions

Uploaded by

rajukumbhar2323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views3 pages

Java MCQ Questions

Uploaded by

rajukumbhar2323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java and OOP - MCQ Question Bank

Q1. Which of the following is NOT a feature of Java?


- Platform independent
- Object-oriented
- Pointer arithmetic
- Automatic memory management
Answer: Pointer arithmetic

Q2. Which component executes Java bytecode?


- JVM
- JDK
- JRE
- Compiler
Answer: JVM

Q3. Which keyword is used to refer to the current object in Java?


- super
- this
- self
- current
Answer: this

Q4. Which OOP principle involves using a single method name with different signatures?
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
Answer: Polymorphism

Q5. Which Java feature restricts access to certain parts of a class?


- Abstraction
- Encapsulation
- Inheritance
- Overloading
Answer: Encapsulation

Q6. Which class type cannot be instantiated directly?


- Concrete class
- Abstract class
- Interface
- Anonymous class
Answer: Abstract class

Q7. Which keyword is used to inherit a class in Java?


- super
- this
- extends
- implements
Answer: extends

Q8. Which keyword is used to inherit an interface in Java?


- extends
- implements
- inherits
- super
Answer: implements

Q9. Which access specifier allows access within the same package only?
- private
- public
- protected
- default
Answer: default

Q10. Which of the following is NOT an access specifier in Java?


- private
- internal
- protected
- public
Answer: internal

Q11. How do you define a user-defined package in Java?


- use package keyword
- use import keyword
- use define keyword
- use include keyword
Answer: use package keyword

Q12. Which block is always executed in exception handling?


- try
- catch
- throw
- finally
Answer: finally

Q13. Which keyword is used to explicitly throw an exception?


- throws
- throw
- try
- catch
Answer: throw

Q14. Which keyword declares exceptions in method signatures?


- throw
- throws
- try
- catch
Answer: throws

Q15. Which of the following is a checked exception in Java?


- ArithmeticException
- NullPointerException
- IOException
- ArrayIndexOutOfBoundsException
Answer: IOException

Q16. Which method is used to start a thread in Java?


- run()
- execute()
- start()
- init()
Answer: start()

Q17. Which method causes the current thread to wait until another thread notifies it?
- sleep()
- wait()
- notify()
- notifyAll()
Answer: wait()

Q18. Which keyword is used to synchronize methods in Java?


- sync
- synchronized
- lock
- wait
Answer: synchronized

Q19. Which method wakes up a single waiting thread?


- notify()
- notifyAll()
- signal()
- wake()
Answer: notify()

Q20. Which interface must be implemented to create a thread in Java?


- Runnable
- Threadable
- Executable
- Callable
Answer: Runnable

You might also like