Skip to content

Latest commit

 

History

History
196 lines (139 loc) · 2.38 KB

File metadata and controls

196 lines (139 loc) · 2.38 KB

Objects

  1. let a=3; let b = new Number(3); let c=3;

    console.log(a == b); console.log(a === b); console.log(b === c);

    • A: true false true
    • B: false false true
    • C: true false false
    • D: false true true

    Answer

    Option: C


  2. What will be the output of the following code?

    const telegramGroup = {
       name: 'TeamDevkode'
    }
    const { name: TDK } = telegramGroup;
    
    console.log(TDK);
    • A: null
    • B: Error will be thrown
    • C: TeamDevkode
    • D: undefined

    Answer

    Option: C


  3. What will be the output?

    let myName = 'Sunny';
    let groupName = myName;
    
    myName = 'DevKode';
    console.log(groupName);
    
    
    const obj1 = {
        id:1,
        name:"Sunny",
    }
    
    const obj2 = obj1;
    obj2.name = 'DevKode';
    console.log(obj1);
    • A: Sunny , { id: 1, name: 'Sunny' }
    • B: DevKode,{ id: 1, name: 'Sunny' }
    • C: DevKode,{ id: 1, name: 'DevKode' }
    • D: Sunny,{ id: 1, name: 'DevKode' }

    Answer

    Option: D


  4. What will be the output?

     function greet(person) {
      if (person == { name: 'Narendra Modi' }) {
        return 'hey Narendra Modi'
      } else {
        return 'hey Donald Trump'
      }
    }
    
    console.log(greet({ name: 'Narendra Modi' }))
    • A: hey Narendra Modi
    • B: hey Donald Trump

    Answer

    Option: B


  5. What will be the output?

    const sample = ["xyz", "abc", "test", "ryan", "apple"];
    delete sample[3];
    console.log(sample.length);
    • A: 4
    • B: 5
    • C: Error updating the constant variable.

    Answer

    Option: B


  • What will be the output?

    const fruits_obj = { 0 : "apple" , 1 : "mango" ,  2:"banana"};
    const fruits_arr = ["apple","mango", "banana"];
    
    console.log(typeof fruits_obj);
    console.log(typeof fruits_arr);
    console.log(fruits_obj == fruits_arr);
    • A: Object , Array , False
    • B: Object , Array , True
    • C: Object , Object , False
    • D: Object , Object , True

    Answer

    Option: C