OOP Senior

1 / 8

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

Select the correct answer

1

Garbage Collection is the process of organizing data within a database

2

Garbage Collection is the process of encapsulating data

3

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

4

Garbage Collection is a method of inheritance in OOP

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

Select the correct answer

1

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

2

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

3

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

4

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

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

2

Hierarchical inheritance is when a class inherits from multiple base classes

3

Hierarchical inheritance is a method of overloading functions

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

2

An interface can contain concrete methods; an abstract class cannot

3

An abstract class can be instantiated; an interface cannot

4

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

Can you create an instance of an abstract class?

Select the correct answer

1

No, you cannot create an instance of an abstract class

2

Yes, you can 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 class that contains only abstract methods

3

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

4

An abstract class is a type of polymorphism in OOP

How is encapsulation different from data abstraction?

Select the correct answer

1

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

2

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

3

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

4

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