Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

Which of the following best describes JavaScript prototypes?

View

How do you add a method to all instances of a constructor function?

View

What does the following code output?

View

Which of the following statements is true about the __proto__ property?

View

What is the prototype of an object created using object literal notation ({})?

View

How do you set a custom prototype for an object?

View

Which of the following is true about JavaScript prototype chains?

View

In JavaScript, every function has a prototype property. Which statement about this property is correct?

View

What happens when a property is not found on an object?

View

How can you check if an object has a property of its own and not inherited from a prototype?

View

Which of the following best describes JavaScript prototypes?

A method used for copying objects
A mechanism to inherit properties from another object
A function that calls a method
A template for creating classes

How do you add a method to all instances of a constructor function?

Add the method inside the constructor
Add the method to the prototype of the constructor
Define the method as a global function
You cannot add methods to all instances of a constructor

What does the following code output?

function Animal() {} Animal.prototype.sound = "Roar"; let tiger = new Animal(); console.log(tiger.sound);

undefined
Roar
Error
null

Which of the following statements is true about the __proto__ property?

It is the standard way of defining prototypes
It is deprecated and should be avoided in modern code
It is a property used to inherit private methods
It is only available in ES6

What is the prototype of an object created using object literal notation ({})?

Object.prototype
Array.prototype
null
The object itself

How do you set a custom prototype for an object?

Object.assign()
Object.create()
Object.prototype.set()
Object.copy()

Which of the following is true about JavaScript prototype chains?

A prototype chain stops at the global object
A prototype chain stops at null
There is no concept of prototype chains in JavaScript
A prototype chain can loop indefinitely

In JavaScript, every function has a prototype property. Which statement about this property is correct?

It is always null for regular functions
It is only available on constructor functions
It is available for all functions
It is only available on arrow functions

What happens when a property is not found on an object?

JavaScript throws an error
JavaScript checks the object's prototype chain
JavaScript creates the property on the object
JavaScript ignores the request

How can you check if an object has a property of its own and not inherited from a prototype?

Using in operator
Using hasOwnProperty()
Using Object.prototype()
Using getOwnPropertyDescriptor()