You are on page 1of 3

1.Which polymorphism behavior do you see in below class?

class Paint {
// all methods have same name
public void Color(int x) {
}

public void Color(int x, int y) {


}

public void Color(int x, int y, int z) {


}
}

Method overloading
Constructor overloading
Method overriding
Run time polymorphism

2. Which polymorphism concept is applied to inheritance relationship in java


programming?

Method overloading
Constructor overloading
Method overriding
None

3.class Father {

public void car() {


System.out.println("Father's Car");
}
}

class Son extends Father {

public void car() {


System.out.println("Son's Car");
}
}

public class Sample {

public static void main(String[] args) {

Son john = new Son();


john.car();
}

Father�s Car
Son�s Car
There is an ambiguity, so no one Car
Compiler Error

4. Provision of a single interface to entities of different types is termed as


polymorphism
dimorphism
trimorphisim
automorphism

5.When an existing operator, such as + or =, is given capacity to operate on a new


data type, is said to be

overloaded
loaded
unloaded
None of these

6.Which among the following is the language which supports classes but not
polymorphism?
a) SmallTalk
b) Java
c) C++
d) Ada

7. If same message is passed to objects of several different classes and all of


those can respond in a different way, what is this feature called?
a) Inheritance
b) Overloading
c) Polymorphism
d) Overriding

8.What do you call the languages that support classes but not polymorphism?
a) Class based language
b) Procedure Oriented language
c) Object-based language
d) If classes are supported, polymorphism will always be supported

9.Which among the following best describes polymorphism?


a) It is the ability for a message/data to be processed in more than one form
b) It is the ability for a message/data to be processed in only 1 form
c) It is the ability for many messages/data to be processed in one way
d) It is the ability for undefined message/data to be processed in at least one
way

10. Which class/set of classes can illustrate polymorphism in the following code:

abstract class student


{
public : int marks;
calc_grade();
}
class topper:public student
{
public : calc_grade()
{
return 10;
}
};
class average:public student
{
public : calc_grade()
{
return 20;
}
};
class failed{ int marks; };
a) Only class student can show polymorphism
b) Only class student and topper together can show polymorphism
c) All class student, topper and average together can show polymorphism
d) Class failed should also inherit class student for this code to work for
polymorphism

11. Which type of function among the following shows polymorphism?


a) Inline function
b) Virtual function
c) Undefined functions
d) Class member functions

12.In case of using abstract class or function overloading, which function is


supposed to be called first?
a) Local function
b) Function with highest priority in compiler
c) Global function
d) Function with lowest priority because it might have been halted since long
time, because of low priority

13. Which among the following can�t be used for polymorphism?


a) Static member functions
b) Member functions overloading
c) Predefined operator overloading
d) Constructor overloading

14. Which among the following can show polymorphism?


a) Overloading ||
b) Overloading +=
c) Overloading <<
d) Overloading &&

15.Polymorphism is possible in C language.


a) True
b) False

You might also like