
DCS2103- Week 12 (Objects and Classes)
Presentation
•
Computers
•
University
•
Practice Problem
•
Medium
Yasmin Basiran
Used 1+ times
FREE Resource
39 Slides • 11 Questions
1
2
3
Word Cloud
What is one thing you remember from Object Oriented Programming?
4
5
6
7
8
9
10
11
Multiple Choice
What is a class in Python?
12
Multiple Choice
Which keyword is used to create a class?
13
14
15
16
17
18
19
20
21
22
Multiple Choice
What does self refer to?
23
Multiple Choice
What is the output?
class A:
x = 5
a1 = A()
a2 = A()
print(a1.x, a2.x)
24
Multiple Choice
What will happen if a class has no init?
25
Multiple Choice
What is the purpose of str?
26
Multiple Choice
What happens if you modify a class variable using the class?
27
Multiple Choice
Calling an instance method from the class without passing an object causes:
ValueError
TypeError
NameError
No error
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Multiple Choice
Which method lets you modify class attributes?
Class methods (@classmethod)
Static methods (@staticmethod)
48
Open Ended
Explain the difference between instance variables and class variables using a real-life example.
49
Feature | Instance Variable | Class Variable |
|---|---|---|
Belongs to | Each object individually | The class itself |
Shared among objects | No | Yes |
Example | Student's name, grade | School name, total students |
Changes affect | Only that object | All objects |
50
Show answer
Auto Play
Slide 1 / 50
SLIDE
Similar Resources on Wayground
45 questions
Software
Presentation
•
University
45 questions
Module 2 - Purposive Comm.
Presentation
•
University
44 questions
Modelo Cliente-Servidor
Presentation
•
University
44 questions
Cyber Security, PwC & Ada
Presentation
•
University
43 questions
Consideraciones de Rendimiento - Parte 3
Presentation
•
University
43 questions
DCS2103 - Week 11 (Dictionary)
Presentation
•
University
43 questions
Quiz Laylat al Qadr partie 2
Presentation
•
KG - University
48 questions
CS124 - Programming Language - Operators, Expressions and As
Presentation
•
University
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Review 4
Quiz
•
3rd Grade
11 questions
HSMS - Standard Response Protocol
Quiz
•
6th - 8th Grade
16 questions
1.1-1.2 Quiz Review
Quiz
•
9th - 12th Grade
12 questions
Exponent Expressions
Quiz
•
6th Grade
20 questions
Adding and Subtracting Integers
Quiz
•
6th - 7th Grade
11 questions
Northeast States
Quiz
•
3rd - 4th Grade
10 questions
Characterization
Quiz
•
3rd - 7th Grade
10 questions
Common Denominators
Quiz
•
5th Grade