What is the role of the __init__ method in a Python class?
Correct answer C. It initialises a newly created instance, typically setting its attributes
Subject / 421 questions
Page 10 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 10 of 22
Correct answer C. It initialises a newly created instance, typically setting its attributes
Correct answer B. A static method receives no implicit first argument, while a class method receives the class as cls
Correct answer D. _Account__balance
Correct answer A. __len__
Correct answer B. C3 linearisation
Correct answer B. The method can be accessed like an attribute, without parentheses
Correct answer D. StopIteration
Correct answer B. Using the yield keyword in its body
Correct answer D. Any integer from 1 to 6, including both 1 and 6
Correct answer D. deque
Correct answer B. 3
Correct answer A. 1, 2, 3
Correct answer C. 3.5
Correct answer A. 5, 4
Correct answer D. 3000
Correct answer B. Only (IT, 9000)
Correct answer D. 3
Correct answer C. 2
Correct answer B. 3
Correct answer A. In the function's __doc__ attribute