Quiz Space

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

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

Question 10

+4.5 marksOne correct option

Consider the below JavaScript program.

javascript
const obj = [{
id: "1"
}, {
id: "2"
}, {
id: "3"
}, {
id: " 4"
}, {
id: " 5 "
}];
const finalObj = obj.map((element) => element.id).map((element) =>
element.trim()).map((element) => parseInt(element)).filter((element) =>
element % 2);
console.log(finalObj, finalObj.length);

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

  1. A

    [‘1’, ‘3’, ‘5’] 3

  2. B

    [‘2’, ‘4’] 2

  3. C

    [1, 3, 5] 3

  4. D

    [2, 4] 2

  5. E

    [‘1’, ‘2’, ‘3’, ‘4’, ‘5’] 5

  6. F

    [1, 2, 3, 4, 5] 5

Show answer

Correct answer

  • C

    [1, 3, 5] 3

Question 10 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. Q11Which of the following is/are example(s) of application state (i.e., system as seen by an individual user)?
  11. Q12Which of the following statement(s) is/are true?
  12. Q13Which of the following is a valid function definition to return the sum of 2 numbers passed as parameter?
  13. Q14Consider the below JavaScript program. What will be the output of the above program, if executed?
  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?