Quiz Space

Modern Application Development II · Quiz 2 · 6 Aug 2023 · May 2023 term

Question 2: Consider the following Vue application with javascript fi…

Question 2

+3 marksOne correct option

Consider the following Vue application with javascript file “app.js” and markup file “index.html”.

app.js:

javascript
const Teams = {
template: `<ol><li v-for='team in
teams'>{{team.name}}</li></ol>`,
data() {
return {
teams: [
{ name: 'India', points: 827 },
{ name: 'Australia', points: 820 },
],
}
},
}
const Rankings = {
template: `<ol><li v-for='team in sortedTeams'>
{{team.name}}</li></ol>`,
data() {
return Teams.data()
},
computed: {
sortedTeams() {
return this.teams.sort((team1, team2) => {
return team1.points - team2.points // Statement 1
})
},
},
}
const router = new VueRouter({
routes: [
{ path: '/', component: Teams },
{ path: '/ranking', component: Rankings },
],
})
new Vue({
el: '#app',
template: `<div> <router-view /> </div>`,
router,
})

index.html:

html
<div id="app"></div>

Suppose the application is running on “http://localhost:8080”. If the developer wants to display the teams in descending order with respect to the points of team, for the URL “http://localhost:8080/#/ranking”. What should be the value of return statement in “sortedTeams” computed property (Marked by statement1)?

  1. A

    team1.points - team2.points

  2. B

    team2.points - team1.points

  3. C

    team1 > team2

  4. D

    team2 < team1

Show answer

Correct answer

  • B

    team2.points - team1.points

Question 2 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 6 Aug 2023, in the May 2023 term (IIT M FOUNDATION AN2 EXAM QPF2 06 Aug 2023). It carries 3 marks.

More questions from this paper

  1. Q1Consider the below javascript program. What will be the approximate value of the variable “timeDifference”?
  2. Q3Consider the following Vue application with javascript file “app.js” and markup file “index.html”. index.html: app.js: …
  3. Q4Consider the following Vue application with javascript file “app.js” and markup file “index.html”. index.html: app.js: …
  4. Q5Consider the following Vue application with javascript file “app.js” and markup file “index.html”. index.html app.js Su…
  5. Q6Consider the below javascript program, and predict the output, if executed.
  6. Q7Which of the following is correct regarding the finally block of Promise?
  7. Q8Which of the following statements is true?
  8. Q9Consider the following Vue application with javascript file “app.js” and markup file “index.html”. index.html: Suppose …
  9. Q10Consider the following Vue application with javascript file “app.js” and markup file “index.html”. index.html: app.js: …
  10. Q11Consider the below javascript program, and predict the output, if executed.
  11. Q12Consider the below javascript program. Assuming the variable “x” passed to the “result” function is a whole number betw…
  12. Q13Which of the following statement(s) is/are true regarding javascript?
  13. Q14Figure question
  14. Q15Consider the below Vue class bindings: Code 1: Code 2: Which of the following statement(s) is/are true?
  15. Q16Which of the following statement(s) is/are correct in the context of REST and GraphQL?