Q. Which one of the following is the correct output for the given JavaScript code?

Code:
    const obj ={prop:12};  
    Object.preventExtensions(obj);  
    console.log(Object.isExtensible(obj));  
  • (A) 12
  • (B) Error
  • (C) True
  • (D) False
πŸ’¬ Discuss
βœ… Correct Answer: (D) False

Q. Which one of the following is the correct output for the given JavaScript code?

Code:
    const obj1 ={ property1:'15'};  
    const obj2 =Object.freeze(obj1);  
    obj2.property1='20';  
    console.log(obj2.property1);  
  • (A) Runtime error
  • (B) 20
  • (C) 15
  • (D) Compilation error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 15

Q. Which one of the following is the correct output for the given JavaScript code?

Code:
    const object1 ={  
      property1:20  
    };  
    console.log(Object.is(object1));  
  • (A) False
  • (B) true
  • (C) 20
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (A) False

Q. What will be the output of the following JavaScript code?

Code:
const obj1 =  
{  
    property1:21  
}  
const descriptor1 =Object.getOwnPropertyDescriptor(obj1),'
console.log(descriptor1.configurable);  
console.log(descriptor1.enumerable);  
  • (A) true false
  • (B) true 21
  • (C) false false
  • (D) true true
πŸ’¬ Discuss
βœ… Correct Answer: (D) true true

Q. Which one of the following is the correct output for the given JavaScript code?

Code:
    const object1 ={};  
    a = Symbol('a');  
    b =Symbol.for('b');  
    object1[a]='harry';  
    object1[b]='derry';  
    constobjectSymbols=Object.getOwnPropertySymbols(object1);  
    console.log(objectSymbols.length);  
  • (A) 0
  • (B) 1
  • (C) 2
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2

Q. What kind of work is being performed in the following given part of JavaScript's code?

Code:
    <script>  
      
    o = {x:1, y:{z:[false,null,""]}};   
    s = JSON.stringify(o);   
    p = JSON.parse(s);  
    </script>  
  • (A) Object Encoding
  • (B) Object Encapsulation
  • (C) Object Serialization
  • (D) Object Abstraction
πŸ’¬ Discuss
βœ… Correct Answer: (C) Object Serialization

Q. A collection of elements of the same data type which may either in order or not, is called _____.

  • (A) String
  • (B) Array
  • (C) Serialized Object
  • (D) Object
πŸ’¬ Discuss
βœ… Correct Answer: (B) Array

Q. Every object contains three object attributes that are _______.

  • (A) Prototype, class, object's extensible flag
  • (B) Prototype, class, objects' parameters
  • (C) Class, parameters, object's extensible flag
  • (D) Native object, Classes and Interfaces and Object's extensible flag
πŸ’¬ Discuss
βœ… Correct Answer: (A) Prototype, class, object's extensible flag

Q. What will be the output of the following JavaScript code?

Code:
    <script>  
      
    var article = {  
                  "main title": "How to learn JavaScript",   
                  'sub-title': "The Definitive Guide",   
                  "for": "all audiences",   
                  author: {   
    firstname: "Scott",   
                             surname: "McCall"   
                          }  
               }  
    </script>  
  • (A) Properties
  • (B) property values
  • (C) property names
  • (D) objects
πŸ’¬ Discuss
βœ… Correct Answer: (C) property names

Q. JavaScript is invented by

  • (A) Helsinki, Linus
  • (B) W3 Group
  • (C) Brendan Eich
  • (D) James Gosling
πŸ’¬ Discuss
βœ… Correct Answer: (C) Brendan Eich