Quiz Space

MAD 2 Quiz 2: 6 August 2023 (May 2023 term)

Question 1

+3 marksOne correct option

Consider the below javascript program.

javascript
function data(d) {
return new Promise((res) => {
setTimeout(() => res('Your Data'), d * 1000)
})
}
function delta(d) {
return new Promise((res) => {
if (d > 3) {
setTimeout(() => res('delta'), d * 500)
} else {
return res('delta')
}
})
}
async function getData(d) {
const start = Date.now()
const _delta = await delta(d)
const _data = await data(d)
const end = Date.now()
const timeDifference = end - start
}
getData(4)

What will be the approximate value of the variable “timeDifference”?

  1. A

    Less than 4000

  2. B

    Is equal to 4000

  3. C

    Greater than or equal to 6000

  4. D

    None of these

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

Question 3

+3 marksOne correct option

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

index.html:

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

app.js:

javascript
const Category = {
template:
`<div>{{$route.params.name}}<router-view></router-view></div>
`,
}
const Error = {
template: `<div><slot> Page Not Found </slot></div>`,
}
const Product = {
template: `
<div>
<div v-if='filteredProducts.length > 0'>
<div v-for='product in filteredProducts'>
Name: {{product.name}}, Price: {{product.price}}
</div>
</div>
<Error v-else> No {{keyword}} Found </Error>
</div>`,
data() {
return {
keyword: this.$route.params.name,
products: [
{ category: 'Mobile', name: 'Samsung', price: '10K' },
javascript
{ category: 'Mobile', name: 'Apple', price: '50K' },
{ category: 'Laptop', name: 'Lenovo', price: '70K' },
],
}
},
computed: {
filteredProducts() {
return this.products.filter(
(product) =>
product.category.toLowerCase() ==
this.keyword.toLowerCase()
)
},
},
components: {
Error,
},
}
const router = new VueRouter({
routes: [
{
path: '/category/:name',
component: Category,
children: [{ path: 'product', component: Product }],
},
{ path: '*', component: Error },
],
})
new Vue({
el: '#app',
template: '<div><router-view /></div>',
router,
})

Suppose the application is running on “http://localhost:8080”. What will be rendered by the browser for the URL “http://localhost:8080/#/”?

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

13 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the MAD 2 Quiz 2 6 Aug 2023 paper

The IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 6 Aug 2023, in the May 2023 term: 16 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureMAD 2 Quiz 2 6 Aug 2023 at a glance
TermMay 2023 term
SubjectModern Application Development II
Course codeBSCS2006
Questions16
Marks50
Duration120 min
MCQ12
MSQ4
Official paperIIT M FOUNDATION AN2 EXAM QPF2 06 Aug 2023
Negative markingNo negative marking.
Updated

Same Quiz 2, other subjects

More MAD 2