Interfaces in Java MCQs

@T-Bone

This question paper focuses on the "Interfaces" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This question paper focuses on the "Interfaces" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. Which of these keywords is used to define interfaces in Java?

Mark the correct option

2. A java interface can contain _______.

Mark the correct option

3. Which of these access specifiers can be used for an interface?

Mark the correct option

4. Which of the following is a correct interface?

Mark the correct option

5. Which of the following classes directly implement Set interface?

Mark the correct option

6. Which of these can be used to fully abstract a class from its implementation?

Mark the correct option

7. What is the output of this program? interface calculate { void cal(int item); } class display implements calculate { int x; public void cal(int item) { x = item * item; } } class Main { public static void main(String args[]) { display arr = new display(); arr.x = 0; arr.cal(2); System.out.print(arr.x); } }

Mark the correct option

8. All methods must be implemented of an interface.

Mark the correct option

9. What type of variable can be defined in an interface?

Mark the correct option

10. What does an interface contain?

Mark the correct option

11. Which of these keywords is used by a class to use an interface defined previously?

Mark the correct option

12. Which is the correct way to inherit and implement the interface?

Mark the correct option

13. which of the following is true about methods in an interface in java?

Mark the correct option

14. Which of the following is the correct way of implementing an interface salary by class manager?

Mark the correct option

15. Which of the following is an incorrect statement about packages?

Mark the correct option

16. What type of methods an interface contain by default?

Mark the correct option

17. What will happen if we provide concrete implementation of method in interface?

Mark the correct option

18. What happens when a constructor is defined for an interface?

Mark the correct option

19. What happens when we access the same variable defined in two interfaces implemented by the same class?

Mark the correct option

20. Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.

Mark the correct option

Index of Questions