

MCQOPTIONS
Saved Bookmarks
This section includes 36 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
Is it necessary that all the abstract methods must be defined from an abstract class? |
A. | Yes, depending on code |
B. | Yes, always |
C. | No, never |
D. | No, if function is not used, no definition is required |
Answer» C. No, never | |
2. |
How many abstract classes can a single program contain? |
A. | At most 1 |
B. | At least 1 |
C. | At most 127 |
D. | As many as required |
Answer» E. | |
3. |
It is _________________________ to have an abstract method. |
A. | Not mandatory for an static class |
B. | Not mandatory for a derived class |
C. | Not mandatory for an abstract class |
D. | Not mandatory for parent class |
Answer» D. Not mandatory for parent class | |
4. |
Can abstract classes have static methods (Java)? |
A. | Yes, always |
B. | Yes, but depends on code |
C. | No, never |
D. | No, static members can’t have different values |
Answer» B. Yes, but depends on code | |
5. |
Abstract class can’t be final in java. |
A. | True |
B. | False |
Answer» B. False | |
6. |
The abstract classes in java can _________________ |
A. | Implement constructors |
B. | Can’t implement constructor |
C. | Can implement only unimplemented methods |
D. | Can’t implement any type of constructor |
Answer» B. Can’t implement constructor | |
7. |
Use of pointers or reference to an abstract class gives rise to which among the following feature? |
A. | Static Polymorphism |
B. | Runtime polymorphism |
C. | Compile time Polymorphism |
D. | Polymorphism within methods |
Answer» C. Compile time Polymorphism | |
8. |
Which among the following is an important use of abstract classes? |
A. | Header files |
B. | Class Libraries |
C. | Class definitions |
D. | Class inheritance |
Answer» C. Class definitions | |
9. |
We ___________________ to an abstract class. |
A. | Can create pointers |
B. | Can create references |
C. | Can create pointers or references |
D. | Can’t create any reference, pointer or instance |
Answer» D. Can’t create any reference, pointer or instance | |
10. |
Abstract classes can ____________________ instances. |
A. | Never have |
B. | Always have |
C. | Have array of |
D. | Have pointer of |
Answer» B. Always have | |
11. |
Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class A. Class C extends class B and implements the other two member functions of class A. Choose the correct option below. |
A. | Program won’t run as all the methods are not defined by B |
B. | Program won’t run as C is not inheriting A directly |
C. | Program won’t run as multiple inheritance is used |
D. | Program runs correctly |
Answer» E. | |
12. |
If a class is extending/inheriting another abstract class having abstract method, then _______________________ |
A. | Either implementation of method or making class abstract is mandatory |
B. | Implementation of the method in derived class is mandatory |
C. | Making the derived class also abstract is mandatory |
D. | It’s not mandatory to implement the abstract method of parent class |
Answer» B. Implementation of the method in derived class is mandatory | |
13. |
If there is an abstract method in a class then, ________________ |
A. | Class must be abstract class |
B. | Class may or may not be abstract class |
C. | Class is generic |
D. | Class must be public |
Answer» B. Class may or may not be abstract class | |
14. |
Can abstract class have main() function defined inside it? |
A. | Yes, depending on return type of main() |
B. | Yes, always |
C. | No, main must not be defined inside abstract class |
D. | No, because main() is not abstract function |
Answer» C. No, main must not be defined inside abstract class | |
15. |
Which among the following best describes abstract classes? |
A. | If a class has more than one virtual function, it’s abstract class |
B. | If a class have only one pure virtual function, it’s abstract class |
C. | If a class has at least one pure virtual function, it’s abstract class |
D. | If a class has all the pure virtual functions only, then it’s abstract class |
Answer» D. If a class has all the pure virtual functions only, then it’s abstract class | |
16. |
An abstract class can define ____ inside of it. |
A. | Inner abstract class |
B. | Inner concrete class |
C. | static methods |
D. | All the above |
Answer» E. | |
17. |
Abstract classes support ____ inheritance. |
A. | Multiple |
B. | Multilevel |
C. | - |
D. | - |
Answer» C. - | |
18. |
Just like an Interface, you can define constants in abstract classes in Java. State TRUE or FALSE. |
A. | TRUE |
B. | FALSE |
C. | - |
D. | - |
Answer» B. FALSE | |
19. |
Choose correct statements about an Abstract class in Java? |
A. | An abstract class implementing an Interface, need not implement methods of an interface |
B. | An abstract class extending another abstract class, need not define methods of the super abstract class. |
C. | The first subclass of an abstract class should define all the abstract methods inherited from all the interfaces and super abstract classes. |
D. | All the above |
Answer» E. | |
20. |
Choose a correct statement about abstract classes? |
A. | An abstract class can extend a concrete class |
B. | An abstract class can extend another abstract class |
C. | An abstract class can implement any number of interfaces. |
D. | All the above. |
Answer» E. | |
21. |
What is the output of the below Java code with an abstract class and inner class? |
A. | Compiler error |
B. | Inner class is present.. |
C. | No output |
D. | None of the above |
Answer» C. No output | |
22. |
An abstract class with 100% abstract methods is equivalent to ______. |
A. | Concrete class |
B. | Virtual Class |
C. | Interface |
D. | All the above |
Answer» D. All the above | |
23. |
An object of multi-level inherited abstract class can not be created in memory? State TRUE or FALSE. |
A. | TRUE |
B. | FALSE |
C. | - |
D. | - |
Answer» B. FALSE | |
24. |
What is the output of the below Java program with multiple abstract classes? |
A. | Editor method |
B. | Author method |
C. | Editor method |
D. | Compiler error |
Answer» D. Compiler error | |
25. |
What is the output of the below Java program with an abstract class? |
A. | Compiler error |
B. | Inside Constructor of Coffee.. |
C. | Inside Constructor of ColdCoffee.. |
D. | Inside Constructor of Coffee.. |
Answer» C. Inside Constructor of ColdCoffee.. | |
26. |
Does the below Java code with abstract method compile? |
A. | NO |
B. | YES |
C. | - |
D. | - |
Answer» B. YES | |
27. |
An abstract class in Java usually contains one or more abstract ____. |
A. | constructors |
B. | methods |
C. | variables |
D. | None |
Answer» C. variables | |
28. |
Choose a correct implementation of an Abstract class in the below Java code? |
A. | abstract class ClassA { } |
B. | abstract class ClassB |
C. | abstract class ClassC |
D. | All the above |
Answer» E. | |
29. |
Which is the opposite of an Abstract Class? |
A. | Interface |
B. | concrete class |
C. | - |
D. | - |
Answer» C. - | |
30. |
Can you create an object from an abstract class in Java? |
A. | Yes |
B. | No |
C. | - |
D. | - |
Answer» C. - | |
31. |
To create an Abstract class, the keyword "class" is also required. State TRUE or FALSE. |
A. | TRUE |
B. | FALSE |
C. | - |
D. | - |
Answer» B. FALSE | |
32. |
An abstract class in Java can be created using the keyword ____. |
A. | final |
B. | interface |
C. | abstract |
D. | static |
Answer» D. static | |
33. |
USE_OF_POINTERS_OR_REFERENCE_TO_AN_ABSTRACT_CLASS_GIVES_RISE_TO_WHICH_AMONG_THE_FOLLOWING_FEATURE??$ |
A. | Static Polymorphism |
B. | Runtime polymorphism |
C. | Compile time Polymorphism |
D. | Polymorphism within methods |
Answer» C. Compile time Polymorphism | |
34. |
Abstract class can’t be final in java.$# |
A. | True |
B. | False |
Answer» B. False | |
35. |
The_abstract_classes_in_java_can__________________$ |
A. | Implement constructors |
B. | Can’t implement constructor |
C. | Can implement only unimplemented methods |
D. | Can’t implement any type of constructor |
Answer» B. Can‚Äö√Ñ√∂‚àö√ë‚àö¬•t implement constructor | |
36. |
Can_abstract_classes_have_static_methods_(Java)? |
A. | Yes, always |
B. | Yes, but depends on code |
C. | No, never |
D. | No, static members can’t have different values |
Answer» B. Yes, but depends on code | |