From ed06b9f4e94d5cb2722701f4be1ed77bb476bc59 Mon Sep 17 00:00:00 2001 From: DevFreezy <64470491+franfreezy@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:26:23 +0300 Subject: [PATCH] feat(curriculum): Add questions to javascript Object oriented programming (#56519) Co-authored-by: Naomi Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com> --- .../66edd5267b52f8f617d8364f.md | 216 ++++++++++-------- 1 file changed, 116 insertions(+), 100 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/quiz-javascript-object-oriented-programming/66edd5267b52f8f617d8364f.md b/curriculum/challenges/english/25-front-end-development/quiz-javascript-object-oriented-programming/66edd5267b52f8f617d8364f.md index 43ae0c69b66..ff3b12ca21d 100644 --- a/curriculum/challenges/english/25-front-end-development/quiz-javascript-object-oriented-programming/66edd5267b52f8f617d8364f.md +++ b/curriculum/challenges/english/25-front-end-development/quiz-javascript-object-oriented-programming/66edd5267b52f8f617d8364f.md @@ -17,439 +17,455 @@ To pass the quiz, you must correctly answer at least 17 of the 20 of the questio #### --text-- -Placeholder question +From the statements below, which one correctly defines OOP? #### --distractors-- -Placeholder distractor 1 +It is a programming model that is more concerned with functions. --- -Placeholder distractor 2 +It is a programming model that is focused on the logic of the program. --- -Placeholder distractor 3 +It is a programming model that applies to all programming problems to solve challenges. #### --answer-- -Placeholder answer +It is a programming model concerned with data. ### --question-- #### --text-- -Placeholder question +The following are advantages of OOP except ONE, which one? #### --distractors-- -Placeholder distractor 1 +Achieves security. --- -Placeholder distractor 2 +Enhances code reusability. --- -Placeholder distractor 3 +It makes a program flexible. #### --answer-- -Placeholder answer +It makes multi-threading easier. ### --question-- #### --text-- -Placeholder question +Which of the following statements is true for OOP? #### --distractors-- -Placeholder distractor 1 +Multiple instances of objects cannot exist. --- -Placeholder distractor 2 +OOP can be applied in all cases. --- -Placeholder distractor 3 +Procedural programs are more secure than OOP programs. #### --answer-- -Placeholder answer +Private members are meant to achieve encapsulation. ### --question-- #### --text-- -Placeholder question +The following are concepts of OOP except ONE. Which one? #### --distractors-- -Placeholder distractor 1 +Polymorphism. --- -Placeholder distractor 2 +Encapsulation. --- -Placeholder distractor 3 +Inheritance. #### --answer-- -Placeholder answer +Data destruction. ### --question-- #### --text-- -Placeholder question +Which statement is FALSE for OOP in Javascript language? #### --distractors-- -Placeholder distractor 1 +Classes are absent in traditional Javascript language. --- -Placeholder distractor 2 +Objects inherit from other objects. --- -Placeholder distractor 3 +Constructors initialize objects. #### --answer-- -Placeholder answer +Methods can be public, or protected. ### --question-- #### --text-- -Placeholder question +From the statements below, which one is FALSE about an object? #### --distractors-- -Placeholder distractor 1 +It is also called an instance. --- -Placeholder distractor 2 +Models a real-world. --- -Placeholder distractor 3 +It can be broken down into properties and methods. #### --answer-- -Placeholder answer +Objects have to be unique. ### --question-- #### --text-- -Placeholder question +```js +function Person(age, gender) { + this.age = age; + this.gender = gender; +} +``` + +What is `this` used for in the code above ? #### --distractors-- -Placeholder distractor 1 +It is used to emphasize an object. --- -Placeholder distractor 2 +It is used to achieve inheritance. --- -Placeholder distractor 3 +It is used to achieve polymorphism. #### --answer-- -Placeholder answer +It refers to the newly created instance of an object. ### --question-- #### --text-- -Placeholder question +Which concept of OOP is achieved by using the 'extends' keyword? #### --distractors-- -Placeholder distractor 1 +Abstraction. --- -Placeholder distractor 2 +Aggregation. --- -Placeholder distractor 3 +Metamorphism. #### --answer-- -Placeholder answer +Inheritance. ### --question-- #### --text-- -Placeholder question +Which of the following is NOT an advantage of encapsulation? #### --distractors-- -Placeholder distractor 1 +Integrity. --- -Placeholder distractor 2 +Security. --- -Placeholder distractor 3 +Maintainability. #### --answer-- -Placeholder answer +Efficiency. ### --question-- #### --text-- -Placeholder question +From the statements below, which one differentiates encapsulation from data abstraction? #### --distractors-- -Placeholder distractor 1 +Data abstraction binds data while encapsulation removes unnecessary detail. --- -Placeholder distractor 2 +Data abstraction subtracts additional data while encapsulation exposes data. --- -Placeholder distractor 3 +Data abstraction exposes data while encapsulation binds data. #### --answer-- -Placeholder answer +Data abstraction removes unnecessary details while encapsulation binds data. ### --question-- #### --text-- -Placeholder question +Which keyword is used to create a new instance of an object in JavaScript? #### --distractors-- -Placeholder distractor 1 +This. --- -Placeholder distractor 2 +Class. --- -Placeholder distractor 3 +Function. #### --answer-- -Placeholder answer +New. ### --question-- #### --text-- -Placeholder question +Which of the following is TRUE? #### --distractors-- -Placeholder distractor 1 +Code reusability is achieved by polymorphism. --- -Placeholder distractor 2 +OOP in Javascript is different from other programming languages. --- -Placeholder distractor 3 +Objects contain methods and properties. #### --answer-- -Placeholder answer +All of the options are true. ### --question-- #### --text-- -Placeholder question +What is the purpose of a constructor function in JavaScript? #### --distractors-- -Placeholder distractor 1 +To extend object properties. --- -Placeholder distractor 2 +To encapsulate methods. --- -Placeholder distractor 3 +To create classes. #### --answer-- -Placeholder answer +To instantiate objects. ### --question-- #### --text-- -Placeholder question +Which one of the following is TRUE about classes? #### --distractors-- -Placeholder distractor 1 +A class contains objects with similar properties and methods. --- -Placeholder distractor 2 +Objects are instances of classes. --- -Placeholder distractor 3 +Different classes can have similar methods. #### --answer-- -Placeholder answer +All of the options are true. ### --question-- #### --text-- -Placeholder question +What instantiates a class? #### --distractors-- -Placeholder distractor 1 +Object. --- -Placeholder distractor 2 +Keywords. --- -Placeholder distractor 3 +Variables. #### --answer-- -Placeholder answer +Constructor. ### --question-- #### --text-- -Placeholder question +```js +class Course { + #module; + constructor(module) { + this.#module = module; + } +} +``` + +Which access modifier is added to `#module` above? #### --distractors-- -Placeholder distractor 1 +Public. --- -Placeholder distractor 2 +Personal. --- -Placeholder distractor 3 +Global. #### --answer-- -Placeholder answer +Private. ### --question-- #### --text-- -Placeholder question +The keyword `super` is used to call the properties and methods of which class? #### --distractors-- -Placeholder distractor 1 +Child. --- -Placeholder distractor 2 +Private. --- -Placeholder distractor 3 +Personal. #### --answer-- -Placeholder answer +Parent. ### --question-- #### --text-- -Placeholder question +Which of the following is true about private members? #### --distractors-- -Placeholder distractor 1 +It can be accessed from outside of the class. --- -Placeholder distractor 2 +It can be called at any point in the program. --- -Placeholder distractor 3 +It enhances security. #### --answer-- -Placeholder answer +None of the above. ### --question-- #### --text-- -Placeholder question +which of the following is FALSE in OOP? #### --distractors-- -Placeholder distractor 1 +Polymorphism changes the characteristics. --- -Placeholder distractor 2 +Inheritance gets the characteristics from a base class. --- -Placeholder distractor 3 +Both inheritance and polymorphism can be used to reduce redundancy in the code. #### --answer-- -Placeholder answer +Private members can be inherited outside the class. ### --question-- #### --text-- -Placeholder question +Which of the following is FALSE about encapsulation? #### --distractors-- -Placeholder distractor 1 +It restricts access to members. --- -Placeholder distractor 2 +It binds data. --- -Placeholder distractor 3 +It binds methods. #### --answer-- -Placeholder answer +Encapsulation is the way in which the same method is applied to different objects and the methods respond with different outputs.