Chapter 9 Subprograms of Concepts of Programming Languages MCQ 19. _____ polymor
ID: 3706108 • Letter: C
Question
Chapter 9 Subprograms of Concepts of Programming Languages MCQ
19. _____ polymorphism is usually, though not always, implemented by creating multiple copies of the polymorphic code, one specialized for each needed concrete type.
A. ad-hoc
B. generic
C. inheritance
D. subtype
E. supertype
20. _____ polymorphism is also called explicit parametric polymorphism.
A. ad-hoc
B. generic
C. inheritance
D. subtype
E. supertype
21. Overloaded subprograms provide a particular kind of polymorphism called ___ polymorphism.
A. ad-hoc
B. generic
C. inheritance
D. subtype
E. supertype
22. Languages that support object-oriented programming usually support ____ polymorphism.
A. ad-hoc
B. generic
C. inheritance
D. subtype
E. supertype
23. ____ polymorphism means that a variable of type T can access any object of type T or any type derived from T.
A. ad-hoc
B. generic
C. inheritance
D. subtype
E. supertype
Explanation / Answer
19. b) Generic
Explanation: - Generic polymorphism creates a copies of code as templates. For eg. Public class Variable<T> is the definition of class. Here T can be anything like Number, String, Object etc.
20. b) Generic
Explanation: - Explicit parametric polymorphism is also known as genericity. So Generic is the right answer.
21. a) Ad- hoc
Explanation: - Ad- hoc polymorphism commonly called overloading allows subprograms with same name to act differently. For e.g. Area() method to calculate area for triangle, circle and square objects works in a different manner.
22. d) subtype
Explanation: - This type of polymorphism means we have a superclass and child classes which specifies types of super classes. Eg. Vehicle is super class and car, bike , scooter is child classes.
23. d) subtype
Explanation: - This is the definition of subtype polymorphism.