
python quiz 4
Authored by karthika karthika
Computers
Professional Development
Used 99+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
Access all questions and much more by creating a free account
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
14 questions
IC3_Test1
Quiz
•
Professional Development
9 questions
Los periféricos del computador
Quiz
•
1st Grade - Professio...
10 questions
História dos Smartphones
Quiz
•
Professional Development
13 questions
Procesadores de texto (Docs de Drive y MS Word)
Quiz
•
Professional Development
15 questions
Quiz Evaluasi 1 Mapel DPJK
Quiz
•
Professional Development
10 questions
OMSPAN DAK DD
Quiz
•
Professional Development
10 questions
Ice Breaker Challenge- Guess the Tool by Its Logo
Quiz
•
Professional Development
13 questions
TIP Trivia
Quiz
•
Professional Development
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...