OOP Mid

1 / 17

Types of constructors.

Select the correct answer

1

Constructors can be local, global, and abstract

2

Constructors can be static, dynamic, and virtual

3

Constructors can be private, public, and protected

4

Constructors can be default, parameterized, and copy constructors

What is a destructor?

Select the correct answer

1

A destructor is a method used to encapsulate data

2

A destructor is a type of polymorphism

3

A destructor is a method used to create objects

4

A destructor is a method called when an object is destroyed

Explain the concept of composition in OOP.

Select the correct answer

1

Composition is the process of hiding data within a class

2

Composition is a way to define multiple methods in a class

3

Composition is a method of inheritance in OOP

4

Composition is a design principle where a class contains objects of other classes

What is constructor chaining?

Select the correct answer

1

Constructor chaining is calling one constructor from another constructor

2

Constructor chaining is defining multiple constructors in a class

3

Constructor chaining is a type of polymorphism

4

Constructor chaining is a method of overloading functions

What is a constructor?

Select the correct answer

1

A constructor is a type of inheritance in OOP

2

A constructor is a method used to encapsulate data

3

A constructor is a special method used to initialize objects

4

A constructor is a method used to define class variables

Define virtual functions.

Select the correct answer

1

Virtual functions are methods that cannot be inherited

2

Virtual functions are used to define multiple methods with the same name

3

Virtual functions are used to hide data within a class

4

Virtual functions allow derived classes to override methods in a base class

What are the limitations of inheritance?

Select the correct answer

1

Inheritance is the best way to implement all functionalities

2

Inheritance ensures complete encapsulation

3

Inheritance always simplifies the design of a system

4

Inheritance can lead to increased complexity and reduced flexibility

What is coupling in OOP?

Select the correct answer

1

Coupling is the process of inheriting properties from another class

2

Coupling is a method of encapsulation

3

Coupling is a way to define multiple methods in a class

4

Coupling is the degree of direct knowledge that one class has of another

What is an interface?

Select the correct answer

1

An interface is a special type of function

2

An interface is a type of inheritance in OOP

3

An interface is a contract that classes can implement

4

An interface is an instance of a class

What are ‘access specifiers’?

Select the correct answer

1

Access specifiers are used to create objects from classes

2

Access specifiers are methods to overload functions

3

Access specifiers are used to define the size of a class

4

Access specifiers define the accessibility of class members

What is a subclass?

Select the correct answer

1

A subclass is a method within a class

2

A subclass is a type of object in OOP

3

A subclass is a type of encapsulation

4

A subclass is a class that inherits from another class

What is a superclass?

Select the correct answer

1

A superclass is a type of polymorphism

2

A superclass is an instance of a class

3

A superclass is a special type of function in OOP

4

A superclass is a class from which other classes inherit

Explain abstraction in OOP.

Select the correct answer

1

Abstraction is the process of hiding implementation details and showing only functionality

2

Abstraction is the process of defining multiple methods with the same name

3

Abstraction is a type of inheritance in OOP

4

Abstraction is a method for creating objects from classes

What is the difference between overloading and overriding?

Select the correct answer

1

Overloading is creating multiple objects; overriding is defining multiple methods

2

Overloading is a way to define classes; overriding is a way to define methods

3

Overloading is a type of inheritance; overriding is a type of encapsulation

4

Overloading is defining multiple methods with the same name but different parameters; overriding is redefining a method in a subclass

What is polymorphism?

Select the correct answer

1

Polymorphism is the process of hiding data within a class

2

Polymorphism allows methods to do different things based on the object it is acting upon

3

Polymorphism is the ability to create multiple instances of a class

4

Polymorphism is a way to define the structure of a class

What is multiple inheritance?

Select the correct answer

1

Multiple inheritance is the process of defining multiple methods in a class

2

Multiple inheritance is a type of encapsulation in OOP

3

Multiple inheritance is when multiple objects can be created from a class

4

Multiple inheritance is when a class can inherit from more than one class

What is Inheritance?

Select the correct answer

1

Inheritance allows a class to use properties and methods of another class

2

Inheritance is a way to define the structure of a database

3

Inheritance is a method of encapsulation

4

Inheritance is the process of hiding data within a class