OOPs Features Questions and Answers

Object Oriented Programming using C++ Questions and Answers– OOPs Features

This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “OOP Features”.

1. 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

Explanation: The use of classes indicates encapsulation. By inheriting the student class into the topper class, inheritance is demonstrated. Because the function Object() { [native code] } is defined in the topping class, polymorphism is not displayed; nevertheless, this does not imply that the default function Object() { [native code] } is overloaded.
2. 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

Explanation: Because derivation and isolation will not be applied, all of the characteristics will be violated. In some cases, polymorphism and abstraction are still feasible, but the primary aspects of OOP, such as data binding and object use, will not be employed, therefore the use of classes is required.
3. How many basic features of OOP are required for a programming language to be purely OOP?
a) 7
b) 6
c) 5
d) 4

Explanation: There are seven main characteristics that determine whether or not a programming language is pure OOP. Inheritance, polymorphism, encapsulation, and abstraction are the four basic aspects. Additionally, object use is required, followed by message transmission, and finally, dynamic binding.
4. The feature by which one object can interact with another object is _____________
a) Data transfer
b) Data Binding
c) Message Passing
d) Message reading

Explanation: The message passing feature refers to the interaction between two objects. OOP does not support data transfer. Message reading is also not an OOP feature.
5. ___________ underlines the feature of Polymorphism in a class.
a) Nested class
b) Enclosing class
c) Inline function
d) Virtual Function

Explanation: The keyword virtual can be used to define virtual functions in any class. The virtual function is defined as needed in all classes that inherit the virtual function class. Polymorphism is represented by redefining the function on all derived classes according to class and use.
6. 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

Explanation: Operator overloading is a feature. There is no special functionality called operator overriding. Overloading and overriding functions does not provide any operator the ability to add.
7. Which among doesn’t illustrates polymorphism?
a) Function overloading
b) Function overriding
c) Operator overloading
d) Virtual function

Explanation: Because the functions are different and their scopes are distinct, function overriding does not demonstrate polymorphism. Overloading of functions and operators exemplifies correct polymorphism. Because all classes that inherit virtual functions define the same function in various ways, virtual functions exhibit polymorphism.
8. Exception handling is a feature of OOP.
a) True
b) False

Explanation: Exception handling is a characteristic of OOP since it incorporates the concept of classes in most circumstances. It may also be useful when employing inheritance.
9. 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

Explanation: To be labelled a totally OOP language, the language must follow all of the OOP rules. It is known to be a partly OOP language if only one OOP feature is not followed.
10. 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

Explanation: Because we have the option of specifying private and protected access, this is always true. Furthermore, only public and global data are accessible globally; otherwise, the programme must have legal permission to access private data.

11. Which feature of OOP indicates code reusability?
a) Encapsulation
b) Inheritance
c) Abstraction
d) Polymorphism

Explanation: The usage of code is indicated via derivation. The purpose of enclosure and abstraction is to hide/group data into a single unit. Polymorphism is a term used to describe how a single entity can fulfil multiple jobs.
12. 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

Explanation: Polymorphism is the OOP characteristic utilised for the trait mentioned above. A real-life example of diversity is a child who, depending on where he is, can be a student, a son, or a brother.
13. 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

Explanation: It’s called encapsulation, and it’s when a real-world entity’s various attributes and functionalities are grouped into a single element. Abstraction, on the other hand, is the concealment of a code’s functional or exact operation in favour of merely displaying what the user requires.
14. 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

Explanation: Objects must be used to declare data. The use of objects is required since they call constructors, which must have a class declared. It is a breach of the pure OOP notion if an object is not used.
15. Which among the following doesn’t come under OOP concept?
a) Platform independent
b) Data binding
c) Message passing
d) Data hiding

Explanation: OOP does not have platform independence. Although C++ supports OOP, it is not a platform universal language. The programming language determines platform independence.

Classes, objects, data abstraction, data encapsulation, inheritance, polymorphism, and dynamic binding are the most significant elements of OOP. A class is a container for data members and functions that manipulate it. In Java, a software object can be implemented as a real-world object. OOP does not have platform independence. Although C++ supports OOP, it is not a platform agnostic language. The programming language determines platform independence. OOPs (Object-Oriented Programming System) is a programming concept based on abstraction, isolation, ownership, and polymorphism.

Leave a Reply

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