JavaScript implements inheritance exclusively through a prototype-based model rather than traditional class-based mechanics found in languages like Java or C++. Every object in JavaScript contains an internal hidden link known as [[Prototype]] (commonly exposed via proto or Object.getPrototypeOf()) pointing to another object. When a property or method access is attempted, the JavaScript engine searches the object directly; if unassigned, it climbs up the prototype chain recursively until it locates the matching identifier or encounters null. Understanding constructor functions, prototype property bindings, property shadowing, and Object.create() utility behavior is fundamental for mastering JavaScript and clearing senior-level technical interviews.
JavaScript Prototypes & Inheritance MCQs for Developer Interviews
1 min read
Correct Answer: a) An object from which other objects inherit properties and methods
Explanation:
Every JavaScript object has an internal link to another object called its prototype, which acts as a fallback storage for property and method lookups.
Correct Answer: a) The prototype object of the constructor that created the instance
Explanation:
The `[[Prototype]]` reference points directly to the prototype object from which the current object inherits.
Correct Answer: a) Object.prototype
Explanation:
Virtually all standard objects inherit from Object.prototype, whose own internal prototype is `null`, terminating the prototype chain.
Correct Answer: a) null
Explanation:
Object.prototype is at the root of the prototype chain, so its internal prototype reference is explicitly set to `null`.
Correct Answer: a) JavaScript checks the object itself first; if not found, it traverses up the `[[Prototype]]` chain until the property is found or `null` is reached.
Explanation:
Property access triggers prototype chain delegation, moving upward until the identifier is matched or the chain terminates.
Correct Answer: a) It creates a new empty object, links its `[[Prototype]]` to the constructor's `prototype` property, binds `this` to the new object, and returns it.
Explanation:
The `new` operator automates instance creation, prototype linking, context binding, and object return.
Correct Answer: a) The instance's `__proto__` points to the constructor function's `prototype` object.
Explanation:
When created with `new`, the instance inherits from `Constructor.prototype`, establishing `instance.__proto__ === Constructor.prototype`.
Correct Answer: a) Creates a new object with its internal `[[Prototype]]` explicitly set to the specified `proto` object
Explanation:
Object.create() is the standard API for pure prototypal inheritance without needing constructor functions.
Correct Answer: a) Whether a property exists directly on the object itself rather than being inherited along its prototype chain
Explanation:
hasOwnProperty() returns true only for direct (own) properties, ignoring inherited prototype properties.
Correct Answer: a) It returns true if the property exists on the object itself OR anywhere along its prototype chain.
Explanation:
The `in` operator tests for property presence across the entire prototype inheritance chain.
Correct Answer: a) Returns the internal prototype (`[[Prototype]]`) of the specified object
Explanation:
Object.getPrototypeOf() is the standard, recommended method for inspecting an object's prototype.
Correct Answer: a) Sets the prototype (`[[Prototype]]`) of a specified object to another object or null
Explanation:
Object.setPrototypeOf() modifies an object's prototype linkage, though it can impact engine performance if used heavily after object creation.
Correct Answer: a) true
Explanation:
isPrototypeOf() checks if an object exists anywhere within another object's prototype chain.
Correct Answer: a) A reference back to the constructor function that generated the prototype object
Explanation:
The `constructor` property points back to the function associated with that prototype.
Correct Answer: a) Instances created from it will point their `constructor` reference to `Object` instead of the original constructor function.
Explanation:
Replacing `Constructor.prototype = {}` severs the original `constructor` link, inheriting Object's constructor unless explicitly reassigned.
Correct Answer: a) By attaching methods to the constructor's `prototype` object rather than inside the constructor function itself
Explanation:
Placing methods on the prototype ensures all instances share a single method reference in memory rather than duplicating function definitions.
Correct Answer: a) Every new instance creates a duplicate copy of the method in memory, wasting resources.
Explanation:
Constructor-defined methods are re-instantiated for every `new` call, whereas prototype methods are shared globally by all instances.
Correct Answer: a) A style of object-oriented programming where objects inherit directly from other objects via prototype delegation
Explanation:
JavaScript relies on prototypal inheritance, where objects delegate property lookups directly to their prototype objects.
Correct Answer: d) Both a and c
Explanation:
Classical inheritance simulation requires prototype chaining (`Object.create`) and constructor borrowing (`Parent.call(this)`).
Correct Answer: a) To execute the parent constructor logic with the child's `this` context, ensuring instance properties are initialized correctly
Explanation:
Constructor borrowing initializes own properties defined on the parent instance.
Correct Answer: a) Parent constructor execution side-effects run prematurely, and unwanted parent instance properties become own prototype properties.
Explanation:
Using `new Parent()` for inheritance initializes properties on the prototype object unnecessarily, which `Object.create` avoids.
Correct Answer: a) Syntactic sugar over JavaScript's existing prototype-based inheritance model
Explanation:
ES6 classes do not introduce a new object model; they provide a cleaner, more readable syntax for constructor functions and prototypes.
Correct Answer: a) "function"
Explanation:
Classes in JavaScript are special types of functions under the hood.
Correct Answer: a) Classes are hoisted to the scope top, but they remain uninitialized in the Temporal Dead Zone, throwing a ReferenceError if accessed before declaration.
Explanation:
Class declarations exhibit TDZ behavior similar to `let` and `const`.
Correct Answer: a) Using the `static` keyword before the method name, e.g., `static create() {}`
Explanation:
Static methods belong to the class constructor function itself rather than class instances.
Correct Answer: a) No, static methods are called on the class constructor itself, not on instantiated objects.
Explanation:
Static methods are utility functions attached to the class constructor, inaccessible from instance objects.
Correct Answer: a) To call the parent class constructor and bind its prototype context before accessing `this`
Explanation:
Derived subclass constructors must execute `super()` before referencing `this`.
Correct Answer: a) A ReferenceError is thrown when attempting to instantiate the subclass.
Explanation:
Subclasses must invoke `super()` in their constructor to initialize parent instance bindings.
Correct Answer: a) Objects that define the internal attributes of a property, such as writable, enumerable, configurable, and value.
Explanation:
Property descriptors give granular control over property behavior using `Object.defineProperty()`.
Correct Answer: a) The property is hidden from loops like `for...in` and methods like `Object.keys()`.
Explanation:
Non-enumerable properties are skipped during iteration enumerations.
Correct Answer: a) Prevents the property value from being changed via assignment operators
Explanation:
A read-only property (`writable: false`) throws an error in strict mode when reassignment is attempted.
Correct Answer: a) The property cannot be deleted, and its descriptor attributes (except writable) cannot be changed.
Explanation:
Non-configurable properties are locked down against structural descriptor modifications and deletion.
Correct Answer: a) Object.getOwnPropertyDescriptor(obj, prop)
Explanation:
Object.getOwnPropertyDescriptor retrieves the attribute configuration of a specific own property.
Correct Answer: a) Makes the object immutable: existing properties cannot be added, deleted, or modified, and their descriptors are set to non-writable and non-configurable.
Explanation:
Object.freeze provides shallow immutability across an object's own properties.
Correct Answer: a) Freeze prevents property modification and makes properties non-writable, whereas seal prevents adding/deleting properties but allows existing properties to be modified.
Explanation:
Sealed objects allow mutating values of existing writable properties, while frozen objects lock those down as well.
Correct Answer: a) Prevents any new properties from ever being added to the object
Explanation:
Preventing extensions locks the object's shape, though existing properties can still be modified or deleted.
Correct Answer: a) Special functions defined in property descriptors that intercept property retrieval (get) and assignment (set).
Explanation:
Getters and setters allow computed property access and validation during assignment.
Correct Answer: a) Using the `get` keyword before the method name, e.g., `get area() { return this.w * this.h; }`
Explanation:
ES6 getter methods are accessed like properties without parentheses (`obj.area`).
Correct Answer: a) Delegation links objects dynamically to a prototype fallback chain, whereas classical inheritance traditionally copies properties or structures down a hierarchy.
Explanation:
JavaScript uses dynamic delegation rather than structural class-based copying.
Correct Answer: a) true
Explanation:
Array instances inherit directly from Array.prototype.
Correct Answer: a) Object.prototype
Explanation:
Array.prototype is an object, so its internal prototype points to Object.prototype.
Correct Answer: a) Modifying or extending built-in prototype objects (like `Array.prototype`) at runtime
Explanation:
Monkey patching adds custom methods to native prototypes, though it is generally discouraged due to global scope pollution risks.
Correct Answer: a) It risks naming collisions with future language specifications or third-party libraries, leading to subtle bugs.
Explanation:
Modifying built-in prototypes globally can pollute codebases and conflict with future ECMAScript additions.
Correct Answer: a) A pattern where methods from multiple independent object sources are copied or combined into a target prototype or object
Explanation:
Mixins enable horizontal code reuse across disparate prototype chains since JavaScript does not support classical multiple inheritance.
Correct Answer: a) An inheritance pattern where an object constructor parasitically absorbs methods from another object and enhances them before returning
Explanation:
Parasitic inheritance takes an existing object, augments it with custom methods, and returns it as a new enhanced instance.
Correct Answer: a) Deep prototype chains can slow down property resolution if the engine has to traverse many levels, though modern engines optimize this heavily using hidden classes.
Explanation:
While traversal adds overhead, modern JS engines use inline caches and hidden classes to optimize property access speed.
Correct Answer: a) Internal engine structures used to optimize property offsets and avoid slow dictionary lookups on objects with matching prototype shapes.
Explanation:
Hidden classes allow JIT compilers to optimize property lookups based on object shape consistency.
Correct Answer: a) It transitions the object to a new hidden class shape, which can degrade optimization if done frequently.
Explanation:
Dynamically adding properties forces shape transitions, highlighting why defining object shapes in constructors is efficient.
Correct Answer: a) `Object.keys()` returns only own enumerable properties, whereas `for...in` iterates over both own and inherited enumerable properties along the prototype chain.
Explanation:
Object.keys restricts results to direct properties, while for...in traverses the prototype chain.
Correct Answer: a) An array of all own property names (both enumerable and non-enumerable) found directly on the object
Explanation:
getOwnPropertyNames includes non-enumerable own properties, excluding inherited ones.
Correct Answer: a) Symbol properties can be inherited via prototypes, but they are ignored by standard enumeration methods like `Object.keys()` and `for...in` loops.
Explanation:
Symbols require special iteration methods like `Object.getOwnPropertySymbols()`.
Correct Answer: a) Returns an array of all own property keys, including both strings and symbols, as well as enumerable and non-enumerable properties.
Explanation:
Reflect.ownKeys combines string and symbol own keys into a single comprehensive array.
Correct Answer: a) Yes, JavaScript temporarily boxes primitives into wrapper objects, granting them access to prototype methods like `.toFixed()` or `.toUpperCase()`.
Explanation:
Autoboxing wraps primitives in temporary wrapper objects during method access, utilizing prototype methods.
Correct Answer: a) String.prototype
Explanation:
Boxed string instances inherit from String.prototype.
Correct Answer: a) "object"
Explanation:
Object.create(null) creates a dictionary object with a null prototype (`[[Prototype]]: null`).
Correct Answer: a) It lacks any prototype chain, meaning it does not inherit built-in methods like `toString()`, `hasOwnProperty()`, or `valueOf()`.
Explanation:
Null-prototype objects are completely clean dictionaries free of prototype pollution risks and inherited methods.
Correct Answer: a) A security exploit where an attacker injects properties into `Object.prototype`, unintentionally altering the behavior of all objects in the application.
Explanation:
Prototype pollution occurs when untrusted input modifies shared prototypes like Object.prototype, compromising application security.
Correct Answer: a) By using null-prototype objects (`Object.create(null)`), freezing Object.prototype, or validating recursive object merging operations.
Explanation:
Defensive programming practices like freezing prototypes or sanitizing keys prevent prototype pollution.
Correct Answer: a) Function.prototype
Explanation:
All functions inherit from Function.prototype.
Correct Answer: a) Object.prototype
Explanation:
Function.prototype is an object, so its prototype points to Object.prototype.
Correct Answer: a) true
Explanation:
The constructor function `Function` is an instance of itself, so its `__proto__` points to Function.prototype.
Correct Answer: a) No, arrow functions lack a `prototype` property and throw a TypeError if invoked with `new`.
Explanation:
Arrow functions do not have a `prototype` property and cannot be instantiated as constructors.
Correct Answer: a) No, arrow functions have `undefined` for their `prototype` property.
Explanation:
Arrow functions do not maintain a prototype object because they cannot be used as constructors.
Correct Answer: a) Invoking a method defined on one prototype or object using an entirely different object as its `this` context.
Explanation:
Method borrowing allows array methods to operate on array-like objects.
Correct Answer: a) It ignores inherited prototype properties, copying only enumerable own properties from the sources.
Explanation:
Object.assign operates exclusively on own enumerable properties.
Correct Answer: a) It strips prototype chains, returning a plain object whose prototype is Object.prototype.
Explanation:
structuredClone discards custom prototype information, returning standard plain data objects.
Correct Answer: a) To test whether a constructor's `prototype` property appears anywhere within an object's prototype chain
Explanation:
The `instanceof` operator evaluates prototype chain membership against a constructor function.
Correct Answer: a) By defining a static `[Symbol.hasInstance](instance)` method on the class.
Explanation:
The `Symbol.hasInstance` well-known symbol allows customizing `instanceof` logic.
Correct Answer: a) The class's `prototype` property object
Explanation:
Instances of an ES6 class inherit from `ClassName.prototype`.
Correct Answer: a) Function.prototype (or the parent class constructor if extending)
Explanation:
Since classes are functions, the class constructor function inherits from Function.prototype, and static inheritance links child class to parent class.
Correct Answer: a) Subclasses inherit static methods and properties from their parent class via prototype linkage of the constructor functions themselves.
Explanation:
Extending a class links the child constructor's `[[Prototype]]` to the parent constructor, enabling static method inheritance.
Correct Answer: a) No, `this` inside an instance method refers to the instance object, not the constructor function where static methods reside.
Explanation:
Instance methods operate on instances, whereas static methods operate on the class constructor.
Correct Answer: a) No, `this` inside a static method refers to the class constructor function itself, which has no access to specific instance properties.
Explanation:
Static `this` points to the class constructor, so it cannot access individual instance states directly without an instance argument.
Correct Answer: a) Class properties prefixed with `#` that are strictly encapsulated within the class body and inaccessible from outside or via prototype chains.
Explanation:
Private fields provide true language-level encapsulation, inaccessible via inheritance or external prototype inspection.
Correct Answer: a) No, private fields are strictly scoped to the declaring class and cannot be accessed or inherited by subclasses.
Explanation:
Private fields (`#`) are not part of the prototype chain and cannot be accessed by subclasses.
Correct Answer: a) To check if an object exists within another object's prototype chain
Explanation:
isPrototypeOf() tests whether the calling object exists in the prototype chain of the argument.
Correct Answer: a) true
Explanation:
Object.prototype is in the prototype chain of all standard objects like `{}`.
Correct Answer: a) false
Explanation:
Objects created with `Object.create(null)` have a null prototype, meaning Object.prototype is not in their chain.
Correct Answer: a) Array.prototype
Explanation:
Array instances inherit directly from Array.prototype.
Correct Answer: a) RegExp.prototype
Explanation:
Regular expression objects inherit from RegExp.prototype.
Correct Answer: a) Error.prototype
Explanation:
Error objects inherit from Error.prototype.
Correct Answer: a) By extending `Error` (`class MyError extends Error {}`), ensuring stack traces and prototype chains are wired properly.
Explanation:
Extending Error ensures proper prototype chaining and correct stack trace generation for custom errors.
Correct Answer: a) "object"
Explanation:
Object.prototype is a standard built-in object, unlike constructor functions which evaluate to "function".
Correct Answer: a) "function" (in most engines for historical reasons, though spec-defined as callable)
Explanation:
Function.prototype is a callable function object in JavaScript for historical compatibility reasons.
Correct Answer: a) Object.prototype
Explanation:
Function.prototype inherits from Object.prototype.
Correct Answer: a) Object.prototype (whose own prototype is null)
Explanation:
Object.prototype sits at the base of the standard prototype hierarchy, terminating with null.
Correct Answer: a) It underpins JavaScript's object model, memory sharing, inheritance mechanics, and performance optimization.
Explanation:
Mastering prototypes provides deep insight into how JavaScript structures objects, shares memory, and handles inheritance.
Related Posts
New
New
New

JavaScript DOM Manipulation MCQs
The Document Object Model (DOM) is a cross-platform programming interface that treats HTML and XML documents as a hierarchical tree…
August 29, 2026By MCQs Generator

JavaScript This Keyword & Scope MCQs
Variable scoping and declaration keywords (var, let, and const) determine where identifiers are visible and accessible within a JavaScript execution…
August 29, 2026By MCQs Generator

Python Arrays MCQs
Unlike many other programming languages, Python does not have a built-in static array data structure in its core syntax, instead…
August 27, 2026By MCQs Generator
Related Categories
New












AI & Data Science MCQ
5 topics
By MCQs Generator
New
Arts & Humanities MCQ
4 topics
By MCQs Generator
New
Civil Engineering MCQ
4 topics
By MCQs Generator
New
Commerce & Business MCQ
4 topics
By MCQs Generator
New
Competitive Exams MCQ
5 topics
By MCQs Generator
New
Electrical & Electronics Engineering MCQ
3 topics
By MCQs Generator
New
General Knowledge MCQ
2 topics
By MCQs Generator
New
General Science MCQ
4 topics
By MCQs Generator
New
Law & Judiciary MCQ
3 topics
By MCQs Generator
New
Mechanical Engineering MCQ
4 topics
By MCQs Generator
New
Medical & Health Sciences MCQ
4 topics
By MCQs Generator
New
Modern Tech Fields MCQ
3 topics
By MCQs Generator