Quiz Space

Modern Application Development II · Quiz 1 · 23 Feb 2025 · January 2025 term

Question 9: Consider the following JavaScript code snippet shown belo…

Question 9

+3 marksOne correct option

Consider the following JavaScript code snippet shown below.

javascript
var value = 50;
const mainObj = {
value: 42,
getValue: function() {
return this.value;
}
};
const nextObj = {
value: 100
};
const getValue1 = mainObj.getValue.bind()(nextObj);
const getValue2 = mainObj.getValue.bind(nextObj)();
console.log(getValue1);
console.log(getValue2);

What will be output on browser’s console for the above JavaScript code?

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answer

  • D

Question 9 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 1 paper sat on 23 Feb 2025, in the January 2025 term (IIT M DIPLOMA AN EXAM QDD2 23 Feb 2025). It carries 3 marks.

More questions from this paper

  1. Q1Which of the following statements is true regarding “v-if” and “v-show” directives in VueJS?
  2. Q2Consider the below JavaScript program. What will be the output of the above program?
  3. Q3What is the output of this code?
  4. Q4Which of the following statements is true about the let, const, and var keywords in JavaScript?
  5. Q5Consider the below JavaScript program. What will be the output of the above program?
  6. Q6Consider the 4 JavaScript code snippets given below. Code Snippet 1: Code Snippet 2: Code Snippet 3: Code Snippet 4: Wh…
  7. Q7Consider the below VueJS application. What will the “p” tag display when the button with the text “Click Me” is clicked…
  8. Q8Consider the following JavaScript code snippet shown below. What will be output on browser’s console for the above Java…
  9. Q10Consider the following JavaScript code What will be the output of the code?
  10. Q11Consider the following HTML with relevant Vue CDN link attached. Given the Vue.js application above, which classes will…
  11. Q12Consider the following Vue2 app and the index file given below. index.html script.js What will be the output on the bro…
  12. Q13Consider the following Vue App and the HTML document given below. index.html script.js What will be rendered on the bro…
  13. Q14Consider the following HTML with relevant Vue CDN link attached. After the code execution above, what will be displayed…
  14. Q15Consider the following HTML with relevant Vue CDN attached. If the user changes the price to 20 and then immediately ch…
  15. Q16Consider the following JavaScript Code. Which of the following expression(s) will cause an error?