Object Oriented Programming Quiz – I

0%

Classes declared with the sealed keyword cannot be base class.

Correct! Wrong!

Sealed classes are used to restrict the users from inheriting the class, hence Classes declared with the sealed keyword cannot be base class.

All methods in an abstract base class must be declared abstract.

Correct! Wrong!

Yes, we can have an abstract class without Abstract Methods; hence it's not necessary to have all abstract methods in abstract class. Declaring a class abstract means that it can not be instantiated on its own and can only be subclassed. Declaring a method abstract means that Method will be defined in the subclass

When to say Polymorphism occurs when the methods of the child class.

Correct! Wrong!

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

What composition specifies?

Correct! Wrong!

The composition is a special type of Aggregation. It is a strong type of Aggregation. In this type of Aggregation, the child object does not have their own life cycle. The child object's life depends on the parent's life cycle. Only the parent object has an independent life cycle. If we delete the parent object then the child object(s) will also be deleted. We can define the Composition as a "Part of" relationship. For example, the company and company location, a single company has multiple locations. If we delete the company then all the company locations are automatically deleted. The company location does not have an independent life cycle, it depends on the company object's life (parent object)

How class can user interface?

Correct! Wrong!

The class that implements an interface must implement all the methods and properties of that interface

What is proper way to implemented interface?

Correct! Wrong!

Which keyword is used to refer base class constructor to subclass constructor?

Correct! Wrong!

Which of the following members of base class are accessible to derived class members?

Correct! Wrong!

When deriving from a protected base class, public and protected members of the base class become protected members of the derived class.

Which of the following modifier applies when a virtual method is redefined by a derived class?

Correct! Wrong!

An override method provides a new implementation of a member that is inherited from a base class

Which of the following modifiers can be used to prevent Method overriding?

Correct! Wrong!

When an instance method declaration includes the sealed modifier, the method is said to be a sealed method. It means a derived class cannot override this method.

Object Oriented Programming Quiz - I
Beginner
You need to work hard, keep learning basic concepts.
Intermediate
Good!, But there is work to be done
Pro
Horray!, you are good!!