Last reviewed
Correct answer: B. A blueprint for creating objects, defining their attributes and behavior
Explanation
A class is the template; the objects you make from it are the instances, and keeping those two apart is most of what this question is worth. The tutorial puts it plainly: "Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made." The glossary is shorter still, calling a class "A template for creating user-defined objects."
Then there is the bug that catches almost everyone once. A name you assign directly in the class body belongs to the class, not to each object: "instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class". Put a mutable list up there and every instance appends to the same list. Anything that should differ per object gets attached to self inside the initialiser instead.
The three wrong answers share a shape — a class mistaken for some other Python thing you met earlier. Printing is a function, looping is a statement, and Python files end in .py.
Sources
“Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made.”
“A template for creating user-defined objects. Class definitions normally contain method definitions which operate on instances of the class.”
“instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class”
Practise 3 questions on this topic
Take Python OOP — Timed Test (3 questions) — scored instantly, explanation for every question, no login.