← All topics
Quiz: Polymorphism: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Method overriding is an example of:
- Q2. Two methods in the same class named add(int, int) and add(double, double) show:
- Q3. What does this print? (code)
- Q4. "Duck typing" in Python means:
- Q5. Which method lets a + b work for your own Python class?
- Q6. You meant to override equals(Object o) but wrote equals(Student s). What did you actually create?
- Q7. What does this print? (code)
- Q8. What does this print? (code)
- Q9. How does Python usually replace method overloading by parameter count?
- Q10. Which is the best polymorphic replacement for if type == "circle" ... elif type == "square" ...?