Quiz Space

Modern Application Development II · Quiz 1 · 25 Feb 2024 · January 2024 term

Question 14: Consider the below JavaScript program. What will be the …

Question 14

+4.5 marksOne correct option

Consider the below JavaScript program.

javascript
const property1 = 10;
const obj1 = {
property1: 20,
property2: function () {
console.log(property1, this.property1);
return this.property1;
}
}
const obj2 = {
property1: 30,
property2: () => {
console.log(property1, this.property1);
console.log(this.property2);
}
}
obj2.property2();

What will be the output of the above program, if executed?

  1. A

    10 30
    20

  2. B

    10 30
    undefined

  3. C

    10 undefined
    30

  4. D

    10 undefined
    undefined

  5. E

    10 30
    10 20
    20

  6. F

    10 undefined
    10 undefined
    undefined

Show answer

Correct answer

  • D

    10 undefined
    undefined

Question 14 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 1 paper sat on 25 Feb 2024, in the January 2024 term (IIT M DIPLOMA AN2 EXAM QDD2 25 Feb 2024). It carries 4.5 marks.

More questions from this paper

  1. Q1Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  2. Q2Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  3. Q3Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  4. Q4Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  5. Q5Consider the following Vue application with markup index.html and JavaScript app.js index.html app.js Suppose the appli…
  6. Q6Consider the following Vue application with markup index.html and JavaScript app.js index.html app.js Suppose the appli…
  7. Q7Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  8. Q8Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  9. Q9Which of the following statement(s) is/are true regarding JavaScript language?
  10. Q10Consider the below JavaScript program. What will be the output of the above program, if executed?
  11. Q11Which of the following is/are example(s) of application state (i.e., system as seen by an individual user)?
  12. Q12Which of the following statement(s) is/are true?
  13. Q13Which of the following is a valid function definition to return the sum of 2 numbers passed as parameter?
  14. Q15Which of the following is not a valid Vue directive?
  15. Q16Consider the below javascript program. What will be the output of the above program, if executed?