curriculum/challenges/english/blocks/quiz-object-oriented-programming/67f4131db7777346b1b3dc6f.md
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
What serves as the blueprint for creating objects?
Functions
Variables
Loops
Classes
Which module does Python use to implement abstract classes?
Time
xyz
Random
abc
What defines the data and behaviors of an object?
Functions and classes.
Variables and loops.
Seeders and databases.
Attributes and methods.
What is single inheritance?
A child class inheriting attributes and methods from a single function.
A child class inheriting attributes and methods from multiple functions.
A child class inheriting attributes and methods from multiple classes.
A child class inheriting attributes and methods from a single class.
Which of the following is NOT one of the key principles of object-oriented programming?
Encapsulation
Inheritance
Abstraction
Don't repeat yourself (DRY)
What is the difference between prefixing attributes and methods with a double underscore and single underscore?
Single underscore hides the attribute completely, double underscore makes it readable only inside methods.
Single underscore means private, double underscore means protected.
Single underscore makes them public, double underscore makes them static.
Single underscore is just a convention for internal use, double underscore triggers name mangling to prevent accidental attribute and method overriding.
Which OOP concept lets you hide complex implementation details and only shows the essential features of an object or system?
Inheritance
Polymorphism
Encapsulation
Abstraction
Which decorator do you use to create a setter?
@<property_name>.creator
@<method_name>.creater
@<method_name>.creator
@<property_name>.setter
Which OOP concept lets you hide the internal state of the object behind a set of public methods and attributes that act like doors?
Polymorphism
Abstraction
Single inheritance
Encapsulation
What is a getter?
A method that updates or changes the value of an attribute.
A method that deletes an attribute from an object.
A method that creates a new attribute in an object.
A method that retrieves or returns the value of an attribute.
What is a setter?
A method that retrieves the value of an attribute.
A method that deletes the value of an attribute.
A method that deletes an attribute from an object.
A method that sets or updates the value of an attribute.
What lets you delete a value you set and get with a setter and getter?
Remover
Eraser
Delayer
Deleter
What promotes code reuse, provides clear hierarchies, and allows customization of behavior without rewriting everything?
DRY
WET
Abstraction
Inheritance
Which of these is the correct syntax of inheritance?
class Parent:
pass
class Child(InheritParent):
pass
class Parent:
pass
class Child(Inheriter):
pass
class Child:
pass
class Parent(Parent):
pass
class Parent:
pass
class Child(Parent):
pass
What connects setters and getters?
Methods
Functions
Classes
Properties
What is the process by which Python internally renames an attribute prefixed with a double underscore by adding an underscore and the class name as a prefix?
Name Mingling
Polymorphism
Abstraction
Name Mangling
Which function lets you invoke a method from a parent inside a child class?
constructor()
__init__()
property()
super()
Which of the following statements best describes polymorphism in OOP?
It allows a class to have multiple constructors with different attributes and methods.
It allows a class to inherit attributes and methods from another class.
It allows creating objects with the class keyword.
It allows different classes to use the same method name while performing different actions when called.
Why does Python mangle the name of an attribute prefixed with double underscores?
To make the attribute completely private and inaccessible from outside the class.
To improve performance by storing attributes more efficiently.
To automatically convert attributes into read-only properties.
To prevent accidental attribute and method overriding in subclasses when using inheritance.
Why are properties used instead of methods for getters and setters?
To make code longer and more explicit.
To prevent access to the value entirely.
To automatically log every value change.
To allow direct attribute-like access with dot notation for better readability.