What is the output of the following code? class A: def __init__(self): self.var = 1 a = A() print(a.var)

CC103-1

Quiz
•
Others
•
University
•
Hard
ALVIN CERTEZA
FREE Resource
40 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
0
1
None
Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output? class A: def __init__(self): self.val = 5 def get_val(self): return self.val a = A() a.val = 10 print(a.get_val())
5
10
None
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is called when an object is created? class B: def __init__(self): print("Object created")
__new__()
__init__()
__str__()
__call__()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output? class A: def __str__(self): return "Hello" a = A() print(a)
Hello
A
Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output? class Parent: def greet(self): print("Hello from Parent") class Child(Parent): pass c = Child() c.greet()
Error
Nothing
Hello from Parent
Hello from Child
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following defines inheritance correctly? class Base: pass class Derived(Base): pass
class Base(Derived)
class Derived -> Base
class Derived(Base)
Derived inherits Base()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print? class A: def __init__(self): self.data = "A" class B(A): def __init__(self): super().__init__() self.data = "B" b = B() print(b.data)
A
B
AB
Error
Create a free account and access millions of resources
Similar Resources on Quizizz
35 questions
psychological self

Quiz
•
University
42 questions
QUIZ PPH PASAL 21

Quiz
•
University
40 questions
Quiz on Visual Perception

Quiz
•
University
35 questions
ôn tập tin học 2

Quiz
•
University
36 questions
Evaluating Source Credibility in Research

Quiz
•
University
45 questions
Information Systems Quiz

Quiz
•
University
40 questions
CC103 - Part 2

Quiz
•
University
41 questions
ENGLISH II - GRAMMAR EXAM

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade