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