qobjects = [
{
draganddroptext: "___ Person: ___ ___(self, name, age): self.name = name self.age = age
def ___(self):
return f'{___.___}({self.___})p1 = Person('John', 36)print(p1)",
draganddropquestion: "Insert the missing parts to make the code return: John(36):",
options: [
"__init__",
"__str__",
"name",
"self",
"age",
"def",
"class",
"post"
],
correct: [6, 5, 0, 1, 3, 2, 4]
},
{
question: "What is the first parameter that all class methods must have?",
options: [
"this",
"self",
"me"
],
correct: 1
},
{
question: "What will be the result of the following code:class Calculator:",
options: [
"5",
"3",
"8",
"53"
],
correct: 2
},
{
question: "When the class object is represented as a string, there is a method that controls what should be returned, which one?",
options: [
"
def add(self, a, b):
return a + b
calc = Calculator()
print(calc.add(5, 3))__init__()",
"__str__()",
"__return__()"
],
correct: 1
},
{
question: "What is the purpose of the __str__() method?",
options: [
"To convert a number to a string",
"To control what is returned when the object is printed",
"To create a new string property"
],
correct: 1
}
]