OOP Expert

1 / 29

What do you understand by Garbage Collection in the OOP world?

Select the correct answer

1

Garbage Collection is the process of encapsulating data

2

Garbage Collection is a method of inheritance in OOP

3

Garbage Collection is the process of organizing data within a database

4

Garbage Collection is the process of automatically reclaiming memory that is no longer in use by the program

What is the "diamond problem," and how is it resolved?

Select the correct answer

1

The 'diamond problem' occurs when a class has multiple constructors; it is resolved using constructor overloading

2

The 'diamond problem' occurs when a class inherits from two classes that have a common base class; it is resolved using virtual inheritance

3

The 'diamond problem' is a type of polymorphism; it is resolved using encapsulation

4

The 'diamond problem' happens when a class has multiple destructors; it is resolved using destructor chaining

What is hybrid inheritance?

Select the correct answer

1

Hybrid inheritance is a method of encapsulation

2

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

3

Hybrid inheritance is a special type of polymorphism

4

Hybrid inheritance is a combination of two or more types of inheritance

What is hierarchical inheritance?

Select the correct answer

1

Hierarchical inheritance is a method of overloading functions

2

Hierarchical inheritance is a type of polymorphism

3

Hierarchical inheritance is when a class inherits from multiple base classes

4

Hierarchical inheritance is when multiple classes inherit from a single base class

Differentiate between an abstract class and an interface?

Select the correct answer

1

An abstract class can have abstract and concrete methods; an interface can only have abstract methods

2

An abstract class can be instantiated; an interface cannot

3

An interface can contain concrete methods; an abstract class cannot

4

An interface is a type of abstract class

Can you create an instance of an abstract class?

Select the correct answer

1

Only if the abstract class contains no abstract methods

2

Yes, you can create an instance of an abstract class

3

No, you cannot create an instance of an abstract class

4

Only if the abstract class is instantiated within a subclass

What is an abstract class?

Select the correct answer

1

An abstract class is a class that cannot be instantiated and may contain abstract methods

2

An abstract class is a type of polymorphism in OOP

3

An abstract class is a class that contains only abstract methods

4

An abstract class is a method used to create objects

How is encapsulation different from data abstraction?

Select the correct answer

1

Encapsulation is the bundling of data; abstraction is the hiding of implementation details

2

Encapsulation is a type of inheritance; abstraction is a type of polymorphism

3

Encapsulation is the process of defining multiple methods; abstraction is the process of creating objects

4

Encapsulation is a method of overloading; abstraction is a method of overriding

Types of constructors.

Select the correct answer

1

Constructors can be default, parameterized, and copy constructors

2

Constructors can be static, dynamic, and virtual

3

Constructors can be local, global, and abstract

4

Constructors can be private, public, and protected

What is a destructor?

Select the correct answer

1

A destructor is a method called when an object is destroyed

2

A destructor is a method used to create objects

3

A destructor is a method used to encapsulate data

4

A destructor is a type of polymorphism

Explain the concept of composition in OOP.

Select the correct answer

1

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

2

Composition is the process of hiding data within a class

3

Composition is a method of inheritance in OOP

4

Composition is a way to define multiple methods in a class

What is constructor chaining?

Select the correct answer

1

Constructor chaining is defining multiple constructors in a class

2

Constructor chaining is a type of polymorphism

3

Constructor chaining is calling one constructor from another constructor

4

Constructor chaining is a method of overloading functions

What is a constructor?

Select the correct answer

1

A constructor is a special method used to initialize objects

2

A constructor is a method used to encapsulate data

3

A constructor is a type of inheritance in OOP

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 hide data within a class

3

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

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 can lead to increased complexity and reduced flexibility

2

Inheritance always simplifies the design of a system

3

Inheritance ensures complete encapsulation

4

Inheritance is the best way to implement all functionalities

What is coupling in OOP?

Select the correct answer

1

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

2

Coupling is a way to define multiple methods in a class

3

Coupling is the process of inheriting properties from another class

4

Coupling is a method of encapsulation

What is an interface?

Select the correct answer

1

An interface is an instance of a class

2

An interface is a contract that classes can implement

3

An interface is a special type of function

4

An interface is a type of inheritance in OOP

What are ‘access specifiers’?

Select the correct answer

1

Access specifiers are methods to overload functions

2

Access specifiers are used to create objects from classes

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 type of encapsulation

2

A subclass is a class that inherits from another class

3

A subclass is a type of object in OOP

4

A subclass is a method within a class

What is a superclass?

Select the correct answer

1

A superclass is a class from which other classes inherit

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 type of polymorphism

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 defining multiple methods with the same name but different parameters; overriding is redefining a method in a subclass

2

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

3

Overloading is creating multiple objects; overriding is defining multiple methods

4

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

What is polymorphism?

Select the correct answer

1

Polymorphism is the ability to create multiple instances of a class

2

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

3

Polymorphism is the process of hiding data within 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 when a class can inherit from more than one class

2

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

3

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

4

Multiple inheritance is a type of encapsulation in OOP

What is Inheritance?

Select the correct answer

1

Inheritance is a method of encapsulation

2

Inheritance is the process of hiding data within a class

3

Inheritance is a way to define the structure of a database

4

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

What is encapsulation?

Select the correct answer

1

Encapsulation is the bundling of data and methods that operate on the data

2

Encapsulation is the method of overloading functions in OOP

3

Encapsulation is the process of inheriting properties from another class

4

Encapsulation is a type of polymorphism used in OOP

What is the difference between a class and an object in OOP?

Select the correct answer

1

A class is a method of encapsulation, while an object is a method of inheritance

2

A class is a type of function, and an object is a type of class

3

A class is a collection of functions, and an object is a collection of variables

4

A class is a blueprint, while an object is an instance of the class

What are the core concepts of OOP?

Select the correct answer

1

Encapsulation, Inheritance, Polymorphism, and Abstraction

2

Planning, Analysis, Design, and Implementation

3

Modularity, Concurrency, Flexibility, and Reusability

4

Compilation, Interpretation, Debugging, and Testing

What is object-oriented programming (OOP)?

Select the correct answer

1

A way of structuring software using functions

2

A method for processing large sets of data

3

A type of database management system

4

A programming paradigm based on the concept of objects