Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

OOPs Interview Questions and Answers

Ques 26. What is the role of the 'super()' statement in a constructor?

The 'super()' statement is used in a subclass constructor to call the constructor of its superclass. It initializes the inherited properties and ensures that the superclass's constructor is executed before the subclass's constructor.

Example:

class Subclass extends Superclass {
  constructor() {
    super();
  }
}

Is it helpful? Add Comment View Comments
 

Ques 27. What is an abstract class in C#?

In C#, an abstract class is a class that cannot be instantiated and may contain abstract methods. It is used to provide a common base for related classes and enforce a certain structure on derived classes.

Example:

abstract class Shape {
  public abstract void Draw();
}

Is it helpful? Add Comment View Comments
 

Ques 28. Explain the 'is-a' and 'has-a' relationships in OOP.

'is-a' relationship represents inheritance, where a class is a specialized version of another class. 'has-a' relationship represents composition, where a class contains an instance of another class as a member.

Is it helpful? Add Comment View Comments
 

Ques 29. What is the purpose of the 'sealed' keyword in C#?

In C#, the 'sealed' keyword is used to prevent a class from being inherited. It ensures that the class cannot be used as a base class for other classes.

Example:

sealed class MySealedClass {
  // class content
}

Is it helpful? Add Comment View Comments
 

Ques 30. Explain the term 'covariant return type' in OOP.

Covariant return type allows a method in a subclass to return a more derived type than the method in the base class. It is a feature supported by some programming languages, including C++ and Java.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2026 WithoutBook