qobjects = [
{
question: "What does __call__() let you do?",
options: [
"Call an object like a function, using object()",
"Compare two objects",
"Delete an object"
],
correct: 0
},
{
question: "What will this code print?class Counter:",
options: [
"1
def __init__(self):
self.count = 0
def __call__(self):
self.count += 1
return self.count
c = Counter()
print(c())
print(c())
1",
"1
2",
"Error"
],
correct: 1
},
{
question: "Why is a callable object sometimes more useful than a plain function?",
options: [
"It runs faster than a function",
"It can remember state between calls, a function can't do that on its own",
"It cannot take any arguments"
],
correct: 1
}
]