Question 11
EasyCompile-time polymorphism is also called:
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Object-Oriented Programming
Compile-time polymorphism is also called:
Dynamic binding
Late binding
Run-time dispatch
Static (early) binding
Sign up free to see the answer and a step-by-step explanation.
What is function overloading?
Redefining a parent's method in a child class
Calling a function too many times
A function that calls itself
Defining several functions with the same name but different parameter lists
Sign up free to see the answer and a step-by-step explanation.
Which of these is a valid overload of int add(int a, int b) in C++ or Java?
long add(int a, int b)
int add(int x, int y)
double add(double a, double b)
int sum(int a, int b)
Sign up free to see the answer and a step-by-step explanation.
What is upcasting?
Treating a derived-class object as an object of its base class
Copying an object
Converting a number to text
Making a class abstract
Sign up free to see the answer and a step-by-step explanation.
How is polymorphism usually achieved in Python?
Only through function overloading
It isn't possible in Python
Duck typing: any object that has the required method can be used
Only through templates
Sign up free to see the answer and a step-by-step explanation.
What does the @Override annotation do in Java?
Prevents the method from being called
Makes the method private
Asks the compiler to check that the method really overrides a parent method
Makes the method run faster
Sign up free to see the answer and a step-by-step explanation.
In Python, which special method runs when the + operator is used on objects?
plus
sum
add
init
Sign up free to see the answer and a step-by-step explanation.
In Python, which special method decides what len(obj) returns?
count
length
len
size
Sign up free to see the answer and a step-by-step explanation.
In Python, which special method gives the text that print(obj) shows?
text
show
str
Sign up free to see the answer and a step-by-step explanation.
A base-class reference refers to a derived-class object and calls a method that the derived class overrides (as a virtual method). Which version runs?
Neither; it's an error
The derived class's version
The base class's version
Both versions
Sign up free to see the answer and a step-by-step explanation.