
Quiz on Runtime Polymorphism in C++
Quiz
•
Other
•
University
•
Practice Problem
•
Easy
Renugadevi S
Used 4+ times
FREE Resource
Enhance your content in a minute
55 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is runtime polymorphism also known as?
Late binding
Compile-time polymorphism
Dynamic polymorphism
Static polymorphism
Answer explanation
Runtime polymorphism is also known as dynamic polymorphism because it resolves method calls at runtime, allowing for more flexible and reusable code. This contrasts with compile-time or static polymorphism.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which mechanism is used to implement runtime polymorphism in C++?
Function hiding
Operator overloading
Method overriding
Function overloading
Answer explanation
Method overriding is the mechanism used to achieve runtime polymorphism in C++. It allows a derived class to provide a specific implementation of a function that is already defined in its base class.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What must be the same for function overriding to occur?
Return type only
Function name only
Argument list only
Signature or prototype
Answer explanation
For function overriding to occur, the signature or prototype must be the same. This includes the function name and the argument list, ensuring that the derived class method matches the base class method.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In which class is the function overridden?
Base class
Friend class
Abstract class
Derived class
Answer explanation
The function is overridden in the derived class, which inherits from the base class. This allows the derived class to provide a specific implementation of a function that is already defined in the base class.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What keyword is used to declare a virtual function?
static
dynamic
virtual
override
Answer explanation
The keyword 'virtual' is used in C++ to declare a virtual function, allowing derived classes to override it. This enables polymorphism, which is a core feature of object-oriented programming.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the virtual table (VTABLE) contain?
Class definitions
Object instances
Data members
Function pointers
Answer explanation
The virtual table (VTABLE) contains function pointers that link to the appropriate methods for a class. This allows for dynamic method resolution in object-oriented programming, enabling polymorphism.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the _vptr in C++?
To handle exceptions
To manage memory
To point to the VTABLE
To store object data
Answer explanation
The _vptr is a pointer used in C++ to reference the VTABLE, which contains addresses of virtual functions for a class. This mechanism enables dynamic dispatch, allowing the correct function to be called for an object at runtime.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
50 questions
Quiz DASAR DASAR ANIMASI
Quiz
•
10th Grade - University
50 questions
JAMQUIZ '24 : 28.02.2024
Quiz
•
University
60 questions
Soft Skills
Quiz
•
University - Professi...
50 questions
teknologi komputer
Quiz
•
University
53 questions
HTML And CSS
Quiz
•
4th Grade - Professio...
50 questions
GenEd Booster B
Quiz
•
University
54 questions
BİLİŞİM TEKNOLOJİLERİ VE YAZILIM
Quiz
•
10th Grade - University
50 questions
Ujian Akhir Semester Manajemen Logistik
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for Other
7 questions
How James Brown Invented Funk
Interactive video
•
10th Grade - University
5 questions
Helping Build the Internet: Valerie Thomas | Great Minds
Interactive video
•
11th Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
19 questions
Review2-TEACHER
Quiz
•
University
15 questions
Pre2_STUDENT
Quiz
•
University
20 questions
Ch. 7 Quadrilateral Quiz Review
Quiz
•
KG - University
