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 the process of organizing data within a database

3

Garbage Collection is a method of inheritance in OOP

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 the process of defining multiple methods in a class

2

Hybrid inheritance is a special type of polymorphism

3

Hybrid inheritance is a method of encapsulation

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 when a class inherits from multiple base classes

3

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

4

Hierarchical inheritance is a type of polymorphism

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 is a type of abstract class

4

An interface can contain concrete methods; an abstract class cannot

Can you create an instance of an abstract class?

Select the correct answer

1

Yes, you can create an instance of an abstract class

2

No, you cannot create an instance of an abstract class

3

Only if the abstract class contains no abstract methods

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 method used to create objects

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 class that cannot be instantiated and may contain abstract methods

How is encapsulation different from data abstraction?

Select the correct answer

1

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

2

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

3

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

4

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

Types of constructors.

Select the correct answer

1

Constructors can be static, dynamic, and virtual

2

Constructors can be private, public, and protected

3

Constructors can be local, global, and abstract

4

Constructors can be default, parameterized, and copy constructors

What is a destructor?

Select the correct answer

1

A destructor is a type of polymorphism

2

A destructor is a method used to encapsulate data

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 a design principle where a class contains objects of other classes

2

Composition is a method of inheritance in OOP

3

Composition is a way to define multiple methods in a class

4

Composition is the process of hiding data within a class

What is constructor chaining?

Select the correct answer

1

Constructor chaining is a method of overloading functions

2

Constructor chaining is calling one constructor from another constructor

3

Constructor chaining is defining multiple constructors in a class

4

Constructor chaining is a type of polymorphism

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 method used to define class variables

4

A constructor is a special method used to initialize objects

Define virtual functions.

Select the correct answer

1

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

2

Virtual functions are used to hide data within a class

3

Virtual functions are methods that cannot be inherited

4

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

What are the limitations of inheritance?

Select the correct answer

1

Inheritance always simplifies the design of a system

2

Inheritance is the best way to implement all functionalities

3

Inheritance can lead to increased complexity and reduced flexibility

4

Inheritance ensures complete encapsulation

What is coupling in OOP?

Select the correct answer

1

Coupling is a way to define multiple methods in a class

2

Coupling is a method of encapsulation

3

Coupling is the process of inheriting properties from another 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 contract that classes can implement

2

An interface is a special type of function

3

An interface is a type of inheritance in OOP

4

An interface is an instance of a class

What are ‘access specifiers’?

Select the correct answer

1

Access specifiers are used to define the size of a class

2

Access specifiers define the accessibility of class members

3

Access specifiers are methods to overload functions

4

Access specifiers are used to create objects from classes

What is a subclass?

Select the correct answer

1

A subclass is a class that inherits from another class

2

A subclass is a type of object in OOP

3

A subclass is a method within a class

4

A subclass is a type of encapsulation

What is a superclass?

Select the correct answer

1

A superclass is a special type of function in OOP

2

A superclass is a type of polymorphism

3

A superclass is a class from which other classes inherit

4

A superclass is an instance of a class

Explain abstraction in OOP.

Select the correct answer

1

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

2

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

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 a way to define classes; overriding is a way to define methods

2

Overloading is creating multiple objects; overriding is defining multiple 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 ability to create multiple instances of a class

2

Polymorphism is the process of hiding data within a class

3

Polymorphism is a way to define the structure of a class

4

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

What is multiple inheritance?

Select the correct answer

1

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

2

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

3

Multiple inheritance is when a class can inherit from more than one 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 process of inheriting properties from another class

3

Encapsulation is a type of polymorphism used in OOP

4

Encapsulation is the method of overloading functions in OOP

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

Select the correct answer

1

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

2

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

3

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

4

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

What are the core concepts of OOP?

Select the correct answer

1

Encapsulation, Inheritance, Polymorphism, and Abstraction

2

Modularity, Concurrency, Flexibility, and Reusability

3

Compilation, Interpretation, Debugging, and Testing

4

Planning, Analysis, Design, and Implementation

What is object-oriented programming (OOP)?

Select the correct answer

1

A programming paradigm based on the concept of objects

2

A type of database management system

3

A method for processing large sets of data

4

A way of structuring software using functions