Question 1
A developer opens the Node.js REPL and runs the following line:
Why does this fail?
Node.js cannot execute JavaScript from the terminal.
V8 can execute only arithmetic expressions, not DOM code.

The IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 16 Aug 2026, in the May 2026 term: 15 questions for 47 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
A developer opens the Node.js REPL and runs the following line:
Why does this fail?
Node.js cannot execute JavaScript from the terminal.
V8 can execute only arithmetic expressions, not DOM code.
Correct answer
Consider the following javascript code:
The above code is initially loaded on the browser and then the browser is refreshed two times. What will be the final output?
['Tablet', 'Tablet']
['Tablet', 'Tablet', 'Tablet']
[{ id: 3, name: 'Tablet' }]
[undefined]
Correct answer
['Tablet', 'Tablet', 'Tablet']
Point out the error with the following code that is used to display user data?
Correct answer
What is the correct output order for the following code?
A B C D
C A D B
A D C B
A D B C
Correct answer
A D C B
Consider the following code:
The code throws an error because nested objects cannot be copied with spread syntax.
Correct answer
Consider the following JavaScript code snippet?
What will be the output of above code on the browser’s console?
1 → 2 → 3: done → 4
1 → 4 → 2 → 3: done
1 → 2 → 4 → 3: done
1 → 2 → 4 (3 never prints due to unresolved promise)
Correct answer
1 → 2 → 4 → 3: done
Suppose the following HTML exists:
Which of the following statements are correct?
Correct answers
A Vue frontend, a mobile app, and another backend service all call the same Flask API deployed on multiple servers. The team chooses JWT authentication. Which of the following statements are correct?
Each request can carry the token, so any server can validate it without storing a per-user session in memory.
Session-based authentication is usually easier to scale across multiple servers because no shared storage is needed. The team should have chosen this.
Correct answers
Each request can carry the token, so any server can validate it without storing a per-user session in memory.
A Vue 2 component does the following: •loads initial task data from an API, •starts a timer after the component appears on the page, •clears that timer before the component is removed. Which hook choices are appropriate?
Correct answers
Vue Router removes the need for route components.
Correct answers
Fill in Code1, inside a mutation handler, which can be used to reduce the price of each of the products in the state by a certain discount. app.js:
Correct answer
Consider the following Vuex store and component code. store.js
Component.vue
All three methods will update the cart and all changes will be visible in Vue DevTools mutation history.
Correct answer
Read the following component carefully.
What will be logged in the console when this component first loads?
Correct answer
Read the following code carefully and answer the given sub questions:
file1: router/index.js
file2: ProfileComponent.vue
What should be filled in at Line A to correctly read the username from the URL?
Correct answer
Read the following code carefully and answer the given sub questions:
file1: router/index.js
file2: ProfileComponent.vue
What should be filled in at Line B to navigate to the Settings page?
Correct answer