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 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' happens when a class has multiple destructors; it is resolved using destructor chaining

2

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

3

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

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 combination of two or more types of inheritance

2

Hybrid inheritance is a special type of polymorphism

3

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

4

Hybrid inheritance is a method of encapsulation

What is hierarchical inheritance?

Select the correct answer

1

Hierarchical inheritance is a method of overloading functions

2

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

3

Hierarchical inheritance is when a class inherits from multiple base classes

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 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

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 is instantiated within a subclass

4

Only if the abstract class contains no abstract methods

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 a method of overloading; abstraction is a method of overriding

2

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

3

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

4

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