Java MCQ – Interfaces – Part 1
This collection of Java Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “Java Interfaces”.
1. What keyword is used to declare an interface in Java?
A class
B interface
C implements
D abstract
2. Java interface can contain ____________
A Final variables
B Abstract methods
C Non-abstract methods
D Final variables and abstract methods
3. What is the correct way to implement an interface?
Example, ‘Operation’ interface implements ‘Add’ class.
A class Add implements Operation{}
B class Add extends Operation{}
C class Add import Operation{}
D None of the above
4. Which of the following statements applies to methods of an interface in Java?
A An interface can only contain abstract methods.
B You can define a method in an interface
C Private and protected access modifiers can also be used to declare methods in an interface
D None of the above
5. Which is the correct declaration to implement two interfaces?
A class A implements B, implements C {}
B class A implements B, C {}
C class A implements B C {}
D None of the above
6. Can we declare an interface as final?
A Yes
B No
7. All methods must be implemented in an interface?
A Yes
B No
8. What does an interface contain?
A Method definition
B Method declaration
C Declaration and definition of the method
D Method name
9. What kind of methods does an interface contain by default?
A abstract
B static
C final
D private
10. What type of variable can be defined in an interface?
A public static
B private final
C public final
D static final