LogIn
I don't have account.

Practice polymorphism Quizzes

Enhance your polymorphism skills with carefully curated quizzes designed to improve concept clarity and real-world application. Each question reinforces key principles through active practice. Ideal for students and professionals, these quizzes help you learn faster, stay sharp and strengthen your overall technical expertise.

Explore All polymorphism Quizzes

Learn polymorphism step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in polymorphism.
Question 1
What is polymorphism in Object-Oriented Programming (OOP)?
1
The ability to use the same function name for different functionalities.
2
The process of restricting access to certain members of a class.
3
The mechanism of wrapping data and methods into a single unit.
4
The ability to inherit properties from a base class.
Question 2
What are the types of polymorphism in OOP?
1
Inheritance and Encapsulation
2
Public and Private
3
Single and Multiple
4
Static and Dynamic
Question 3
Which of the following is an example of compile-time polymorphism?
1
Function Overloading
2
Interfaces
3
Function Overriding
4
Abstract Classes
Question 4
What is the difference between method overloading and method overriding?
1
Overloading is runtime polymorphism, overriding is compile-time polymorphism
2
Overloading requires inheritance, overriding does not
3
Overloading happens in a subclass, overriding happens in the same class
4
Overloading occurs in the same class, overriding occurs in a derived class
Question 5
Which statement about polymorphism is correct?
1
Polymorphism is only applicable to function overloading.
2
Polymorphism allows multiple classes to have the same properties.
3
Polymorphism prevents method overriding.
4
Polymorphism enables a function to be used for different types of objects.
Question 6
What is the key feature of runtime polymorphism?
1
Dynamic method dispatch
2
Compile-time resolution
3
No inheritance required
4
Method overloading
Question 7
Which of the following statements about function overloading and function overriding is correct?
1
Function overloading is resolved at compile-time, while function overriding is resolved at runtime
2
Function overloading requires inheritance, while function overriding does not
3
Function overriding does not support dynamic binding
4
Function overloading occurs at runtime, while function overriding occurs at compile time
Question 8
What is method overriding in Java?
1
Declaring a new method with the same name in the same class
2
Making a method static
3
Changing the return type of an existing method
4
Defining a method with the same name and parameters in a child class
Question 9
Which keyword is used in Java to prevent method overriding?
1
static
2
abstract
3
super
4
final
Question 10
What will be the output of the following Java program?
class A {
    void display() { System.out.println("Class A"); }
}
class B extends A {
    void display() { System.out.println("Class B"); }
}
public class Main {
    public static void main(String[] args) {
        A obj = new B();
        obj.display();
    }
}
1
Class B
2
Class A
3
Runtime Error
4
Compilation Error
Question 11
Which of the following statements is true about operator overloading in C++?
1
It is a type of compile-time polymorphism
2
It is achieved using function overloading
3
It allows redefining how operators work for user-defined types
4
All of the above
Question 12
In C++, which keyword is used to achieve runtime polymorphism?
1
friend
2
override
3
static
4
virtual
Question 13
What is an abstract class in Java?
1
A class that cannot be instantiated
2
A class that must contain at least one abstract method
3
A class that allows method overriding
4
All of the above
Question 14
How does Java implement runtime polymorphism?
1
Function overloading
2
Early binding
3
Dynamic method dispatch
4
Virtual function table (vtable)
Question 15
What is a virtual function in C++?
1
A function with no implementation
2
A function that cannot be overridden
3
A function that supports operator overloading
4
A function that is resolved at runtime
Question 16
What is the role of the vtable in C++?
1
It speeds up compile-time polymorphism.
2
It prevents method overriding.
3
It stores a list of all functions in a class.
4
It stores pointers to virtual functions.
Question 17
Which keyword in Java is used to call the parent class method explicitly in method overriding?
1
parent
2
override
3
super
4
base
Question 18
What will be the output of the following program?
#include <iostream>
using namespace std;

class Base {
public:
    virtual void show() { cout << "Base"; }
};
class Derived : public Base {
public:
    void show() { cout << "Derived"; }
};
int main() {
    Base b;
    Derived d;
    Base* ptr = &b;
    ptr->show();
    return 0;
}
1
Undefined Behavior
2
Base
3
Compilation Error
4
Derived
Question 19
What will be the output of the following program?
#include <iostream>
using namespace std;

class Base {
public:
    virtual void show() { cout << "Base"; }
};
class Derived : public Base {
public:
    void show() { cout << "Derived"; }
};
int main() {
    Base b;
    Derived d;
    Base* ptr = &d;
    ptr->show();
    return 0;
}
1
Derived
2
Undefined Behavior
3
Compilation Error
4
Base
Question 20
What will be the output of the following program?
#include <iostream>
using namespace std;

class Base {
public:
    virtual void show() { cout << "Base"; }
};
class Derived : public Base {
public:
    void show() { cout << "Derived"; }
};
int main() {
    Base b;
    Derived d;
    Derived* ptr = &b;
    ptr->show();
    return 0;
}
1
Undefined Behavior
2
Base
3
Derived
4
Error
Question 21
Which of the following is true about abstract classes in C#?
1
An abstract class can have concrete methods.
2
Interfaces and abstract classes are the same.
3
Abstract classes must have at least one abstract method.
4
Abstract classes can be instantiated.
Question 22
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 cannot be overridden in derived classes
3
The function call is resolved at compile-time
4
The function cannot have a body
Question 23
What is true about method overriding in Java?
1
The return type of the overriding method can be a subclass of the return type of the overridden method
2
Overriding methods must have the same return type and parameters
3
Overriding is determined at compile time
4
A method cannot be overridden if it is declared static
Question 24
Which keyword prevents method overriding in C#?
1
abstract
2
final
3
private
4
sealed
Question 25
What happens if a class contains at least one pure virtual function in C++?
1
It can be instantiated normally
2
It cannot have constructors
3
It does not support polymorphism
4
It becomes an abstract class
Question 26
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
The derived class method is called
2
Compilation error
3
Runtime error
4
The base class method is called
Question 27
What will happen if a C++ derived class does not override a virtual function of the base class?
1
Runtime Error
2
Compilation error
3
Undefined behavior
4
The base class function is called
5
The program crashes
Question 28
Which statement is true about interfaces and abstract classes?
1
An abstract class can have both abstract and concrete methods
2
Interfaces cannot be implemented by multiple classes
3
Abstract classes cannot have concrete methods
4
Interfaces can have constructors
Question 29
Which principle of OOP is illustrated by defining different methods with the same name but different parameters?
1
Abstraction
2
Inheritance
3
Polymorphism
4
Encapsulation
Question 30
Which concept in OOP allows for the same function to be used in different ways based on the object it is associated with?
1
Abstraction
2
Inheritance
3
Polymorphism
4
Encapsulation