











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
(Full Stack JavaScript) OOP Principles Knowledge Assessment Q & S 2024(Full Stack JavaScript) OOP Principles Knowledge Assessment Q & S 2024(Full Stack JavaScript) OOP Principles Knowledge Assessment Q & S 2024(Full Stack JavaScript) OOP Principles Knowledge Assessment Q & S 2024
Typology: Exams
1 / 19
This page cannot be seen from the preview
Don't miss anything!












Rationale: Compilation is not a principle of OOP, whereas Encapsulation, Polymorphism, and Inheritance are.
Rationale: Encapsulation is the concept where the internal details of an object are hidden, and access is restricted to its specific methods.
b. Observer
c. Factory
d. Strategy
Rationale: The Singleton pattern restricts instantiation of a class to one "single" instance.
Rationale: Inheritance allows a subclass to inherit properties and methods from its superclass.
Rationale: Polymorphism allows methods to do different things based on the object it is acting upon, typically the parent class.
Rationale: JavaScript closures can be used to create private variables and methods.
Rationale: Abstraction exposes only the necessary details to the user while hiding the implementation details.
Rationale: This concept is known as polymorphism, where a parent class reference can be used for objects of its subclasses.
Rationale: JavaScript does support polymorphism. Although it employs prototype-based inheritance, it can still achieve polymorphic behavior.
Rationale: JavaScript does not natively support abstract classes, but abstraction can be achieved through other means, such as closures and factory functions.
Rationale: JavaScript does not support private constructors directly as other languages like Java or C++ do.
Rationale: The Object.assign method is used for this purpose in JavaScript.
Rationale: JavaScript does not support multiple inheritance, but a similar effect can be achieved using mixins.
Rationale: Object.keys() returns an array of a given object's own enumerable property names.
Rationale: Inheritance allows a class to inherit properties and behaviors from another class, promoting code reuse.
Rationale: In JavaScript OOP, 'this' refers to the current object the method or constructor is associated with.
Rationale: Abstraction simplifies the complex reality by modeling classes that are relevant to the problem, providing a more manageable set of features to work with.
Rationale: Favoring composition over inheritance helps to design more flexible systems by composing behaviors at runtime.
Rationale: Recursion is a programming technique, not a principle of OOP.
Rationale: JavaScript implements prototypal inheritance, which differs from the classical inheritance model used in languages like Java and C++.
Rationale: Encapsulation is the OOP feature that restricts access to certain parts of an object, protecting the object's internal state.
Rationale: The 'super' keyword is used within a subclass to call functions on the superclass.
Rationale: Polymorphism allows different classes to be accessed through the same interface, highlighting the importance of interchangeable objects in OOP. Multiple Choice: Question: Which of the following best describes inheritance in OOP?
A) The process by which one class acquires the properties and behaviors of another class B) The process of hiding the complexities of a system by providing a simplified interface C) The ability of an object to take on multiple forms D) The process of creating multiple instances of a class
properties and behaviors of another class Rationale: Inheritance allows a class to inherit attributes and methods from another class, promoting code reusability and establishing a hierarchical relationship between classes. Fill-in-the-Blank: Question: Encapsulation in OOP refers to the bundling of data and methods that operate on the data into a single unit known as _.
Rationale: Encapsulation helps in data hiding and abstraction by restricting access to certain components of an object and promoting modularity in code design. True/False: Question: Polymorphism in OOP allows different objects to respond to the same message in different ways.
Question: Encapsulation and data hiding are interchangeable terms in OOP.
Rationale: Encapsulation involves bundling data and methods within a class to control access, while data hiding specifically refers to restricting access to certain data members within a class. Multiple Choice: Question: Which OOP principle promotes the ability of a single function to perform different actions based on the object calling it? A) Abstraction B) Inheritance C) Polymorphism D) Encapsulation
Rationale: Polymorphism enables the same function to exhibit different behaviors based on the object it is called upon, enhancing flexibility and extensibility in code design. Fill-in-the-Blank: Question: In OOP, the process of combining data and behavior in a single unit is known as _.
Rationale: Encapsulation helps in bundling data and methods within a class, promoting data security, code reusability, and modular design.
True/False: Question: An abstract class can be instantiated to create objects in Java.
Rationale: Abstract classes cannot be instantiated, as they exist solely to provide a blueprint for other classes to extend and implement. Multiple Choice: Question: Which OOP principle emphasizes the ability to define common characteristics and behavior for a group of objects? A) Abstraction B) Inheritance C) Polymorphism D) Encapsulation
Rationale: Inheritance allows classes to inherit attributes and methods from a superclass, facilitating code reuse and establishing a hierarchical structure. Fill-in-the-Blank: Question: In OOP, the process of creating a new object from an existing object is known as _.
Question: In OOP, the principle of code reusability is achieved through _.
Rationale: Inheritance enables the reuse of code from a superclass in a subclass, promoting modularity and reducing redundancy in software development. True/False: Question: Interfaces in Java can contain method implementations.
Rationale: Interfaces in Java define method signatures that must be implemented by classes but do not include method implementations, promoting loose coupling and flexibility in code design.