
DCS2103 - Week 13 (Inheritance)
Presentation
•
Computers
•
University
•
Practice Problem
•
Easy
Yasmin Basiran
Used 1+ times
FREE Resource
24 Slides • 13 Questions
1
2
3
Multiple Choice
Which of the following best describes inheritance in object-oriented programming?
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Multiple Choice
In Python, what does the super() function do?
20
Multiple Choice
What is the output of:
class Parent:
def init(self):
self.value = 5
class Child(Parent):
def init(self):
super().__init__()
self.value = 10
c = Child()
print(c.value)
21
Multiple Choice
What is the output of
class A:
def init(self, val):
self.val = val
class B(A):
def init(self):
super().__init__(10)
b = B()
print(b.val)
22
Multiple Choice
Is there an error in this code?
class A:
def init(self):
self.x = 5
class B(A):
def init(self):
self.y = 10
print(B().x)
23
Multiple Choice
If a child class defines its own init but doesn’t call super().__init__(), what happens?
24
25
26
27
28
29
30
Multiple Choice
Which of the following is true about multiple inheritance in Python?
A class can inherit from multiple parent classes
Python does not support multiple inheritance
Only methods are inherited, not attributes
Constructors cannot be inherited
31
Multiple Choice
What is the output of
class Engine:
def init(self, hp):
self.hp = hp
class Car:
def init(self):
self.engine = Engine(150)
c = Car()
print(c.engine.hp)
32
Multiple Choice
What is the main benefit of composition over inheritance?
33
Draw
Draw a multiple inheritance diagram: Bird and Animal as parents, FlyingAnimal as child.
34
Open Ended
Explain composition in Python with a real-life example.
35
Open Ended
What is one concept, function, or trick in Python that you are most proud of learning?
36
Open Ended
What one piece of advice would you give someone taking this course next semester?
37
Show answer
Auto Play
Slide 1 / 37
SLIDE
Similar Resources on Wayground
29 questions
Fast & Curious: Elevating EduProtocols with Quizizz
Presentation
•
Professional Development
32 questions
EOP PROPOSAL - Goals & Objectives
Presentation
•
University
32 questions
Java GUI Unit 7
Presentation
•
University
29 questions
ISWS 2025 - Human-centric AI Evaluation
Presentation
•
University
29 questions
Java GUI Unit 3
Presentation
•
University
28 questions
Python 3 - szakmérnök
Presentation
•
University
28 questions
230 Prenatal
Presentation
•
University
36 questions
HCI DESIGN PRINCIPLES
Presentation
•
University
Popular Resources on Wayground
20 questions
Math Review
Quiz
•
3rd Grade
15 questions
Fast food
Quiz
•
7th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
10 questions
Identify Fractions, Mixed Numbers & Improper Fractions
Quiz
•
3rd - 4th Grade
Discover more resources for Computers
20 questions
Guess The App
Quiz
•
KG - Professional Dev...
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
19 questions
Minecraft
Quiz
•
6th Grade - Professio...
40 questions
8th Grade Math Review
Quiz
•
8th Grade - University
20 questions
Block Buster Movies
Quiz
•
10th Grade - Professi...
10 questions
Would you rather...
Quiz
•
KG - University
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
14 questions
Superhero
Quiz
•
1st Grade - University