<
RHD
/>
Home
Blog
Quiz
Resources
About
Contact
Enlist
// guest
▾
Login
Request Account
[ light ]
// general
General Quiz
// question 1 of 10
What is printed? x=5 ; def f(): x=2 ; print(x) ; f()?
Error
2
5
// question 2 of 10
What is the result of 5 + float(""2"")?
7
52
7.0
// question 3 of 10
What does % do?
Returns remainder
Adds numbers
Divides numbers
// question 4 of 10
What is method chaining?
Defining a method inside another method
Calling multiple methods on the same object in sequence
Inheriting methods from multiple parents
// question 5 of 10
What does continue do in a while loop?
Stops loop
Starts next iteration
Resets variable
// question 6 of 10
What is the difference between __str__ and __repr__?
__str__ is called by repr() and __repr__ by print()
__str__ is for users and __repr__ is for developers
They are identical in behavior
// question 7 of 10
What is the result of 5 >= 3?
5
True
False
// question 8 of 10
What does a single underscore prefix on an attribute mean?
It is a read-only attribute
It is a class attribute shared by all instances
It is private by convention
// question 9 of 10
What is the result of ""python""[1]?
Error
p
y
// question 10 of 10
What is printed? for i in range(2): print(i) print(""Done"")?
0 1 Done
Done 0 1
0 Done 1 Done
Submit Answers →