OOPs MCQ
OOPS is Object-Oriented Programming. It is an approach to developing software programming. It was introduced to overcome flaws in the procedural approach to programmings such as reusability and maintainability. Object-oriented programming or OOPS is a methodology of designing an application using classes and objects.
The fundamental idea behind object-oriented language is to combine into a single unit with both data and functions.
The data and functions that operate on that data such as a unit are called an object.
A class is a blueprint from which objects are created. A class describes the state or behavior of an object. A class can have attributes and methods:
- Attributes: An Attribute is a public variable inside the class/object. For example, Length is an attribute of int data type. In other words, **class attributes** are the variable within a class. You can access attributes by creating an object of a class and by using dot syntax(.).
- Methods: A method is a group/block of code that takes input from the user, process it, and provides the output. The method runs only when it is called.
Object:
An object is an instance of a class. It contains an address and takes up memory space. Objects have states and behavior defined as per their template definition.
Instance member variable: Attributes, data members, field, properties.
Instance member functions: Methods, procedures, actions, operations, services.
Features of OOPS
There are primarily four pillars of OOPS:
- Data abstraction :
- Data hiding: It hides implementation details while just presenting the features to the outside world
- Reduces code complexity
- Hides details and exposes the essential parts.
- Inheritance: Reusability
- Mechanism of deriving a new class from an existing class.
- Types:
- Single level
- Multi-level
- Multiple
- Hierarchical
- Hybrid
- Polymorphism: Object to take many forms
- Types:
- Compile-time polymorphism
- Run time polymorphism
- Types:
- Encapsulation :
- Hiding the data for purpose of protection.
- Writing data and functions into a single unit.
OOPs MCQs
What is the implicit return type of constructor?
When is the object created with a new keyword?
Identify the incorrect constructor type.
Identify the scope resolution operator.
Choose the option below which is not a member of the class.
Total types of constructors in C++ are?
What is the number of parameters that a default constructor requires?
Data members and member functions of a class are private. default. True or False?
Under which pillar of OOPS do base class and derived class relationships come?
Which of the following functions can be inherited from the base class?
Which of the following is not a type of inheritance?
What is an object in c++?
Why is reusability a desirable feature?
Identify the operators which cannot be overloaded.
Another name of overloading is?
By default, fields in a structure of a C program is?
On what basis is it determined, when a variable comes into existence in memory?
Identify the feature using which, one object can interact with another object.
Total access specifiers in OOPS for C++ are?
Choose the option below which can show polymorphism.
Select the following which shows the correct constructor.
To access data members of a class, which of the following is used?
Identify the feature, which is used to reduce the use of nested classes.
Choose the option below which is used to free the memory allocated for an object in C++.
Identify the option below which is not a property of the object.
What type of inheritance does single-level inheritance support?
In which of the following is memory allocated for the objects?
How do encapsulation and abstraction differ?
Choose the option below which is shown by function overriding
Choose the option below for which instance of the class cannot be created.
Identify the feature which can be implemented using encapsulation.
Why is a virtual function mainly used to achieve?
Virtual functions should be defined in?
Virtual function should be ________.
Choose whether True or False: The constructor function can be constant.
Dynamic memory allocation can be done using?
Total types of polymorphism in C++ are?
Another name of the generic class is?
Choose the option below which overloads using the friend function.
Choose whether True or False: Object cannot be passed as a function.
Identify the pure object-oriented programming language among the following.
Identify the abstract data type among the following.
What are the total catch blocks that can be used using a single Try block?
Choose the incorrect option below which is not a type of constructor.
Total instances of an abstract class that can be created?
Identify the option below which cannot be used with the term “virtual”.
Which type of inheritance is implemented in the following code below?
Choose the option below which is used to implement late binding.
What is cout?
Choose the option below which describes the overloading of functions.
Who developed object-oriented programming?
Which of the following is not an oops concept?