LogIn
I don't have account.

Practice inheritance Quizzes

Prepare for technical interviews with high-quality inheritance quizzes that mirror real industry questions. Each quiz helps you master concepts, improve problem-solving speed and gain the confidence needed for coding tests. Whether revising basics or tackling advanced scenarios, these quizzes ensure structured, effective preparation.

Explore All inheritance Quizzes

Learn inheritance step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in inheritance.
Question 1
What is inheritance in Object-Oriented Programming (OOP)?
1
The ability to define multiple methods with the same name
2
The process of restricting access to data members
3
The ability of one class to derive properties and behaviors from another class
4
The mechanism of wrapping data and methods into a single unit
Question 2
What is multilevel inheritance?
1
When a class does not inherit anything
2
When a class inherits multiple classes
3
When a class inherits from a derived class
4
When multiple classes inherit a single base class
Question 3
Which of the following statements is true about constructors in inheritance?
1
A derived class constructor automatically calls the base class constructor
2
Constructors are not inherited in OOP
3
A derived class constructor can call only its own constructor
4
A base class constructor is never called when an object of the derived class is created
Question 4
What is the keyword used to inherit a class in C#?
1
: (colon)
2
implements
3
extends
4
inherits
Question 5
Which keyword is used to prevent a class from being inherited?
1
sealed
2
abstract
3
private
4
static
Question 6
Which of the following correctly implements an interface in C#?
1
interface ITest { void Show(); }
class MyClass { public void Show() { Console.WriteLine("Hello"); } }
2
interface ITest { void Show(); }
class MyClass : ITest { void Show() { Console.WriteLine("Hello"); } }
3
interface ITest { void Show(); }
class MyClass : ITest { protected void Show() { Console.WriteLine("Hello"); } }
4
interface ITest { void Show(); }
class MyClass : ITest { public void Show() { Console.WriteLine("Hello"); } }
Question 7
What type of inheritance is not supported in C#?
1
Multilevel Inheritance
2
Multiple Inheritance
3
Single Inheritance
4
Hierarchical Inheritance
Question 8
What is the output of the following code?
#include <iostream>
using namespace std;

class A {
public:
    A() { cout << "A "; }
};
class B : public A {
public:
    B() { cout << "B "; }
};
int main() {
    B obj;
    return 0;
}
1
A B
2
Compilation error
3
B A
4
Runtime Error
Question 9
In C++, which type of inheritance allows all members of the base class to become private in the derived class?
1
Private Inheritance
2
Multilevel Inheritance
3
Public Inheritance
4
Protected Inheritance
Question 10
What happens when a base class function is declared as virtual in C++?
1
The function call is resolved at runtime using vtable
2
The function call is resolved at compile-time
3
The function cannot have a body
4
The function cannot be overridden in derived classes
Question 11
What happens if a class contains at least one pure virtual function in C++?
1
It does not support polymorphism
2
It becomes an abstract class
3
It can be instantiated normally
4
It cannot have constructors
Question 12
What is the default behavior if a base class pointer points to a derived class object but does not use virtual functions in C++?
1
Compilation error
2
The derived class method is called
3
The base class method is called
4
Runtime error
Question 13
What will happen if a C++ derived class does not override a virtual function of the base class?
1
Compilation error
2
The program crashes
3
Runtime Error
4
Undefined behavior
5
The base class function is called
Question 14
Which statement is true about interfaces and abstract classes?
1
Interfaces can have constructors
2
An abstract class can have both abstract and concrete methods
3
Interfaces cannot be implemented by multiple classes
4
Abstract classes cannot have concrete methods
Question 15
Which of the following statements about interfaces in Java is true?
1
An interface can have final methods
2
An interface can have constructors
3
An interface supports multiple inheritance
4
A class can implement only one interface