
python quiz 4
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Medium
karthika karthika
Used 99+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Q.1. What is the output of this code?
a,b=1,0
a=a^b
b=a^b
a=a^b
print(a)
0
1
2
error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
what is output of following code −
class Count:
def __init__(self, count=0):
self.__count=count
a=Count(2)
b=Count(2)
print(id(a)==id(b), end = '' '')
c= ''hello''
d= ''hello''
print(id(c)==id(d))
A - True False
B - False True
C - False False
D - True True
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code snippet?class Sales:
def __init__(self, id):
self.id = id
id = 100
val = Sales(123)
print (val.id)
A. SyntaxError, this program will not run
B. 100
C. 123
D. None of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code snippet?class Person:
def __init__(self, id):
self.id = id
sam = Person(100)
sam.__dict__['age'] = 49
print (sam.age + len(sam.__dict__))
1
2
50
51
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following can be used to invoke the __init__ method in B from A, where A is a subclass of B?
A. super().__init__()
B. super().__init__(self)
C. B.__init__()
D. B.__init__(self)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code snippet?class A:
def __init__(self):
self.calcI(30)
print("i from A is", self.i)
def calcI(self, i):
self.i = 2 * i;
class B(A):
def __init__(self):
super().__init__()
def calcI(self, i):
self.i = 3 * i;
b = B()
A. The __init__ method of only class B gets invoked.
B. The __init__ method of class A gets invoked and it displays “i from A is 0”.
C. The __init__ method of class A gets invoked and it displays “i from A is 60”.
D. The __init__ method of class A gets invoked and it displays “i from A is 90”.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is not a complex number?
a) k = 2 + 3j
b) k = complex(2, 3)
c) k = 2 + 3l
d) k = 2 + 3J
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Pos-Prueba (Libreta Profesional-One Note)
Quiz
•
Professional Development
15 questions
Guess The Logo
Quiz
•
5th Grade - Professio...
10 questions
TRIVIA CIBERSEGURIDAD MINTEL
Quiz
•
Professional Development
15 questions
Mensajería Instantánea y Netiqueta
Quiz
•
Professional Development
10 questions
NHANH TAY, NHANH MẮT
Quiz
•
Professional Development
10 questions
Microsoft 365 for Teachers
Quiz
•
Professional Development
10 questions
Introduction to AI - Healthcare & Business
Quiz
•
University - Professi...
15 questions
SEC+ Ch.8 Review Test
Quiz
•
Professional Development
Popular Resources on Wayground
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
15 questions
Solving Equations with Variables on Both Sides Review
Quiz
•
8th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
Disney Characters
Quiz
•
Professional Development
20 questions
Customer Service
Quiz
•
Professional Development
10 questions
Food Idioms
Quiz
•
Professional Development
20 questions
NCCER Power Tools Quiz
Quiz
•
Professional Development
