Module 7 quiz on inheritance :Java for Android (Android App Development Specialization) Answers 2025
1. Question 1 — Student, Joanne, PartTime
-
✔️ Student is a → super class
-
✔️ Joanne is a → Student object
-
✔️ PartTime is a → subclass
Correct option: Option 1
2. Question 2 — When creating a subclass
-
❌ write both inherited + additional code
-
❌ only public methods
-
✔️ only write the new instance variables and methods added to the subclass
-
❌ only inherited members
Correct option: Option 3
3. Question 3 — Why avoid repeating code? (Select all that apply)
-
✔️ Improves readability; easier to trace
-
✔️ Facilitates code reuse
-
❌ Makes projects unique (incorrect statement)
-
❌ Makes program run faster (not guaranteed)
-
✔️ Makes debugging easier
Correct options: 1, 2, 5
4. Question 4 — Calling a public, overloaded method in superclass
-
✔️ simply make the call; overloading allows compiler to find correct version
-
❌ implementation in subclass auto-used
-
❌ keyword
sub(does not exist) -
❌ must use
super(not required for overloaded methods)
Correct option: Option 1
5. Question 5 — Calling a public, overridden method in superclass
-
✔️ must use
superto call the superclass version -
❌ subclass cannot call super method
-
❌ simply make the call (would call the overridden subclass method)
-
❌ use
this
Correct option: Option 1
✅ SUMMARY TABLE
| Q.No | Correct Option | Final Answer |
|---|---|---|
| 1 | ✔️ Option 1 | super class • Student object • subclass |
| 2 | ✔️ Option 3 | Only write added fields/methods |
| 3 | ✔️ Options 1, 2, 5 | Readability, reuse, easier debugging |
| 4 | ✔️ Option 1 | Simply call overloaded method |
| 5 | ✔️ Option 1 | Use super for overridden method |