OOP Features Five
OOP Features Five
a) Inheritance
b) Polymorphism
c) Inheritance and polymorphism
d) Encapsulation and Inheritance
View Answer
Answer: d
Explanation: 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
View Answer
Answer: d
Explanation: 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
View Answer
Answer: a
Explanation: 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
View Answer
Answer: c
Explanation: 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
View Answer
Answer: d
Explanation: 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
View Answer
Answer: a
Explanation: 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
View Answer
Answer: b
Explanation: 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
View Answer
Answer: a
Explanation: 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
View Answer
Answer: d
Explanation: 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
View Answer
Answer: a
Explanation: 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.