250+ TOP MCQs on OOPs Features and Answers

Object Oriented Programming (OOPs) Multiple Choice Questions & Answers (MCQs) on “OOP Features”.

1. Which feature of OOP indicates code reusability?
a) Encapsulation
b) Inheritance
c) Abstraction
d) Polymorphism
Answer: b
Clarification: Inheritance indicates the code reusability. Encapsulation and abstraction are meant to hide/group data into one element. Polymorphism is to indicate different tasks performed by a single entity.

2. If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Answer: c
Clarification: For the feature given above, the OOP feature used is Polymorphism. Example of polymorphism in real life is a kid, who can be a student, a son, a brother depending on where he is.

3. If different properties and functions of a real world entity is grouped or embedded into a single element, what is it called in OOP language?
a) Inheritance
b) Polymorphism
c) Abstraction
d) Encapsulation
Answer: d
Clarification: It is Encapsulation, which groups different properties and functions of a real world entity into single element. Abstraction, on other hand, is hiding of functional or exact working of codes and showing only the things which are required by the user.

4. Which of the following is not a feature of pure OOP?
a) Classes must be used
b) Inheritance
c) Data may/may not be declared using object
d) Functions Overloading
Answer: c
Clarification: Data must be declared using objects. Object usage is mandatory because it in turn calls its constructors, which in turn must have a class defined. If object is not used, it is a violation of pure OOP concept.

5. Which among the following doesn’t come under OOP concept?
a) Platform independent
b) Data binding
c) Message passing
d) Data hiding
Answer: a
Clarification: Platform independence is not feature of OOP. C++ supports OOP but it’s not a platform independent language. Platform independence depends on programming language.

6. Which feature of OOP is indicated by the following code?

class student{  int marks;  };
class topper:public student{  int age;  topper(int age){ this.age=age; } };

a) Inheritance
b) Polymorphism
c) Inheritance and polymorphism
d) Encapsulation and Inheritance
Answer: d
Clarification: Encapsulation is indicated by use of classes. Inheritance is shown by inheriting the student class into topper class. Polymorphism is not shown here because we have defined the constructor in the topper class but that doesn’t mean that default constructor is overloaded.

7. Which feature may be violated if we don’t use classes in a program?
a) Inheritance can’t be implemented
b) Object must be used is violated
c) Encapsulation only is violated
d) Basically all the features of OOP gets violated
Answer: d
Clarification: All the features are violated because Inheritance and Encapsulation won’t be implemented. Polymorphism and Abstraction are still possible in some cases, but the main features like data binding, object use and etc won’t be used hence the use of class is must for OOP concept.

8. How many basic features of OOP are required for a programming language to be purely OOP?
a) 7
b) 6
c) 5
d) 4
Answer: a
Clarification: There are 7 basic features that define whether a programing language is pure OOP or not. The 4 basic features are inheritance, polymorphism, encapsulation and abstraction. Further, one is, object use is must, secondly, message passing and lastly, Dynamic binding.

9. The feature by which one object can interact with another object is _____________
a) Data transfer
b) Data Binding
c) Message Passing
d) Message reading
Answer: c
Clarification: The interaction between two object is called the message passing feature. Data transfer is not a feature of OOP. Also, message reading is not a feature of OOP.

10. ___________ underlines the feature of Polymorphism in a class.
a) Nested class
b) Enclosing class
c) Inline function
d) Virtual Function
Answer: d
Clarification: Virtual Functions can be defined in any class using the keyword virtual. All the classes which inherit the class containing the virtual function, define the virtual function as required. Redefining the function on all the derived classes according to class and use represents polymorphism.

11. Which feature in OOP is used to allocate additional function to a predefined operator in any language?
a) Operator Overloading
b) Function Overloading
c) Operator Overriding
d) Function Overriding
Answer: a
Clarification: The feature is operator overloading. There is not a feature named operator overriding specifically. Function overloading and overriding doesn’t give addition function to any operator.

12. Which among doesn’t illustrates polymorphism?
a) Function overloading
b) Function overriding
c) Operator overloading
d) Virtual function
Answer: b
Clarification: Function overriding doesn’t illustrate polymorphism because the functions are actually different and theirs scopes are different. Function and operator overloading illustrate proper polymorphism. Virtual functions show polymorphism because all the classes which inherit virtual function, define the same function in different ways.

13. Exception handling is a feature of OOP.
a) True
b) False
Answer: a
Clarification: Exception handling is a feature of OOP as it includes classes concept in most of the cases. Also it may come handy while using inheritance.

14. Which among the following, for a pure OOP language, is true?
a) The language should follow 3 or more features of OOP
b) The language should follow at least 1 feature of OOP
c) The language must follow only 3 features of OOP
d) The language must follow all the rules of OOP
Answer: d
Clarification: The language must follow all the rules of OOP to be called a purely OOP language. Even if a single OOP feature is not followed, then it’s known to be a partially OOP language.

15. Does OOP provide better security than POP?
a) Always true for any programming language
b) May not be true with respect to all programming languages
c) It depends on type of program
d) It’s vice-versa is true
Answer: a
Clarification: It is always true as we have the facility of private and protected access specifiers. Also, only the public and global data are available globally or else the program should have proper permission to access the private data.

Leave a Reply

Your email address will not be published. Required fields are marked *