Q: 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; } };
Solution: 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.
Q: Which feature may be violated if we don’t use classes in a program?
Solution: 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.
Q: How many basic features of OOP are required for a programming language to be purely OOP?
Solution: 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.
Q: The feature by which one object can interact with another object is _____________
Solution: 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.
Q: ___________ underlines the feature of Polymorphism in a class.
Solution: 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.
Q: Which feature in OOP is used to allocate additional function to a predefined operator in any language?
Solution: 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.
Q: Which among doesn’t illustrates polymorphism?
Solution: 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.
Q: Exception handling is a feature of OOP.
Solution: 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.
Q: Which among the following, for a pure OOP language, is true?
Solution: 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.
Q: Does OOP provide better security than POP?
Solution: 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.
You Have Score    | /10 |