Quiz Space

Modern Application Development II · Quiz 2 · 4 Aug 2024 · May 2024 term

Question 8: Consider the following JavaScript code. What will be the …

Question 8

+3 marksOne correct option

Consider the following JavaScript code.

javascript
const library = {
name: "Central Library",
books: [
{ title: "Book A", author: "Author A" },
{ title: "Book B", author: "Author B" },
{ title: "Book C", author: "Author C" },
],
location: "IIT Madras",
};
let propertyList = "";
let bookDetails = "";
for (let key in library) {
if (key === "books") {
for (let book of library[key]) {
bookDetails += `${book.title} by ${book.author}, `;
}
} else {
propertyList += key + " ";
}
}
console.log(propertyList);
console.log(bookDetails);

What will be the output of the above code snippet on the console of the browser?

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

Correct answer

  • C

Question 8 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 4 Aug 2024, in the May 2024 term (IIT M DIPLOMA AN EXAM QDD2 4 Aug 2024). It carries 3 marks.

More questions from this paper

  1. Q1Consider the below JavaScript program. What will be the output of the above program, if executed?
  2. Q2Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: app.js: Suppo…
  3. Q3Consider the following application with markup index.html and script app.js. index.html: app.js: Suppose the applicatio…
  4. Q4Consider the below JavaScript program. What will be the output of the above program?
  5. Q5Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: app.js: Suppo…
  6. Q6Consider the below JavaScript program, and predict the output, if executed.
  7. Q7Consider the following Vue application with markup index.html and JavaScript file app.js. File: index.html File: script…
  8. Q9Consider the following HTML snippet that uses Vue 2 using CDN in the script.js file Filename: index.html Filename: scri…
  9. Q10Suppose you are organizing a felicitation program for the students with exemplary performance in the BS program. You ha…
  10. Q11Figure question
  11. Q12Which of the following statement(s) is/are incorrect regarding Vuex?
  12. Q13Consider the following HTML, with Vue 2 CDN attached to it. Filename: index.html Filename: script.js What will be logge…
  13. Q14Analyze the given HTML with embedded script. What will be the final state of HTML elements, after all the setTimeout() …
  14. Q15Consider the following HTML document embedded with Vue CDN and the script file shown below. Filename: index.html Filena…
  15. Q16Consider the below Vue component template and script definitions that use Vue router. Vue component template Filename: …