MCQOPTIONS
Saved Bookmarks
This section includes 25 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
A Static method of an Interface should be accessed with _____ and a DOT operator. |
| A. | Class Name |
| B. | Interface Name |
| C. | An object of a concrete class |
| D. | None of the above |
| Answer» C. An object of a concrete class | |
| 2. |
A Superinterface is comparable to a Superclass. State TRUE or FALSE. |
| A. | TRUE |
| B. | FALSE |
| C. | - |
| D. | - |
| Answer» B. FALSE | |
| 3. |
Which is the missing code to successfully compile the below Java program with abstract classes and Interfaces? |
| A. | @Override |
| B. | @Override |
| C. | @Override |
| D. | All the above |
| Answer» B. @Override | |
| 4. |
Which is the missing java code in the class implementing an Interface below? |
| A. | class Speaker implements Linein, Lineout |
| B. | class Speaker implements Linein, Lineout |
| C. | class Speaker implements Linein, Lineout |
| D. | All the above |
| Answer» B. class Speaker implements Linein, Lineout | |
| 5. |
A Java static method can not be ___. |
| A. | private or protected |
| B. | final |
| C. | abstract |
| D. | All the above |
| Answer» E. | |
| 6. |
It is ___ to override the static method of an Interface in Java. |
| A. | possible |
| B. | not possible |
| C. | - |
| D. | - |
| Answer» C. - | |
| 7. |
The annotation used in Java to override the method of a super-class or interface by the subclass or implementing class is ___. |
| A. | @override |
| B. | @Override |
| C. | @super |
| D. | @subclass |
| Answer» C. @super | |
| 8. |
Is it possible to remove the keyword DEFAULT and make the method abstract again in an Interface, if the Interface belongs to a Closed-Source project? |
| A. | Yes |
| B. | No |
| C. | - |
| D. | - |
| Answer» B. No | |
| 9. |
The DEFAULT methods of an Interface are suitable mostly for ___ type of projects. |
| A. | Open Source (Public Repositories) |
| B. | Closed Source (Private Repositories) |
| C. | - |
| D. | - |
| Answer» B. Closed Source (Private Repositories) | |
| 10. |
Java Interface DEFAULT methods have ___ compatibility with the existing project code. |
| A. | Forward |
| B. | Backward |
| C. | Backward and Forward |
| D. | - |
| Answer» D. - | |
| 11. |
Java Interface static methods have ___ compatibility with the existing project code. |
| A. | Forward |
| B. | Backward |
| C. | Both Forward and Backward |
| D. | - |
| Answer» D. - | |
| 12. |
Java 8 (Java 1.8) introduced the ___ feature. |
| A. | Default methods |
| B. | Static methods |
| C. | Default and Static methods |
| D. | None of the above |
| Answer» D. None of the above | |
| 13. |
A Java Interface can not declare constructors. State TRUE or FALSE. |
| A. | TRUE |
| B. | FALSE |
| C. | - |
| D. | - |
| Answer» B. FALSE | |
| 14. |
A Java Class implementing an Interface can define a variable with the same name as that of the Interface constant. State TRUE or FALSE. |
| A. | TRUE |
| B. | FALSE |
| C. | - |
| D. | - |
| Answer» B. FALSE | |
| 15. |
A Class implementing an Interface can use ____ access modifier before the implemented methods. |
| A. | private |
| B. | protected |
| C. | public |
| D. | All the above |
| Answer» D. All the above | |
| 16. |
All Interface methods in Java are ____ by default. |
| A. | public |
| B. | abstract |
| C. | public and abstract |
| D. | None of the above |
| Answer» D. None of the above | |
| 17. |
All Interface variables are ___ by default in Java. |
| A. | public |
| B. | final |
| C. | public and final |
| D. | None |
| Answer» D. None | |
| 18. |
What is the output of the below Java program with an Interface? |
| A. | No output |
| B. | Implemented move() method. |
| C. | Compiler error |
| D. | None of the above |
| Answer» C. Compiler error | |
| 19. |
A Java Class inherits Constants and Methods of an Interface using ____ keyword. |
| A. | INTERFACE |
| B. | IMPLEMENTS |
| C. | EXTENDS |
| D. | All the above |
| Answer» C. EXTENDS | |
| 20. |
Choose a correct statement about Java Interfaces? |
| A. | Interface contains only abstract methods by default. |
| B. | A Java class can implement multiple interfaces |
| C. | An Interface can extend or inherit another Interface. |
| D. | All the above |
| Answer» E. | |
| 21. |
Choose the correct syntax below for defining an Interface in Java. |
| A. | interface NAME |
| B. | abstract interface NAME |
| C. | public interface NAME |
| D. | All the above |
| Answer» E. | |
| 22. |
A Java Interface is not considered a class. State TRUE or FALSE. |
| A. | TRUE |
| B. | FALSE |
| C. | - |
| D. | - |
| Answer» B. FALSE | |
| 23. |
An interface in Java is like a 100% ____. |
| A. | abstract class |
| B. | public class |
| C. | inner class |
| D. | anonymous class |
| Answer» B. public class | |
| 24. |
Which of the following is an incorrect statement about packages? |
| A. | Interfaces specifies what class must do but not how it does |
| B. | Interfaces are specified public if they are to be accessed by any code in the program |
| C. | All variables in interface are implicitly final and static |
| D. | All variables are static and methods are public if interface is defined pubic |
| Answer» E. | |
| 25. |
Which of the following is the correct way of implementing an interface salary by class manager? |
| A. | class manager extends salary {} |
| B. | class manager implements salary {} |
| C. | class manager imports salary {} |
| D. | none of the mentioned |
| Answer» C. class manager imports salary {} | |