Home / MAD2 / Week 1 / Real questions
60 questions pulled from past papers whose wording matches this week's topics, newest first, duplicates removed. Pick your answers, then press Check answers. Figures and answer keys are the originals.
and JavaScript
for a Vue application: File: index.html
File: app.js
Suppose the application is running on
, and the user visits the URL:
What will be rendered by the browser? [NOTE:
is divided in two images, consider them as one file content.]

index.html
app.js
```html
<div id="app">
<router-view></router-view>
</div>
```
```javascript
const Flights = {
template: `<h2>{{ result }}</h2>`,
data() {
return {
routes: [
{ city: "Delhi", connectedTo: ["Mumbai", "Pune"] },
{ city: "Indore", connectedTo: ["Bhopal", "Jaipur"] },
{ city: "Raipur", connectedTo: ["Nagpur", "Hyderabad"] },
{ city: "Rewa", connectedTo: ["Delhi", "Indore", "Raipur"] }
],
result: ""
};
},
created() {
const destination = this.$route.params.city.toLowerCase();
for (let i = 0; i < this.routes.length; i++) {
const connections = this.routes[i].connectedTo;
for (let j = 0; j < connections.length; j++) {
if (connections[j].toLowerCase() === destination) {
this.result = this.routes[i].city;
break;
}
}
if (this.result) {
break;
}
}
}
};
```
```
http://localhost:8080
```
```
http://localhost:8080/#/raipur
```
app.js
```javascript
const router = new VueRouter({
routes: [
{
path: "/:city",
component: Flights
}
]
});
new Vue({
el: "#app",
router
});
```
The
getter is used in a Vue component as shown below:
Now suppose the Vuex getter
is removed, while the temperature state continues to be updated through Vuex mutations. Which of the following implementations correctly recreates
in the component so that it automatically reacts whenever the Vuex
changes?```javascript
const store = new Vuex.Store({
state: {
temperature: 30
},
getters: {
weatherStatus(state) {
return state.temperature >= 35 ? "Hot" : "Normal"
}
}
})
```
weatherStatus
```javascript
computed: {
weatherStatus() {
return this.$store.getters.weatherStatus
}
}
```
weatherStatus
weatherStatus
temperature
```javascript
computed: {
weatherStatus() {
return this.$store.state.temperature >= 35
? "Hot"
: "Normal"
}
}
```
```javascript
watch: {
weatherStatus() {
return this.$store.state.temperature >= 35
? "Hot"
: "Normal"
}
}
```
```javascript
methods: {
weatherStatus() {
this.$store.state.temperature >= 35
? "Hot"
: "Normal"
}
}
```
```javascript
watch: {
weatherStatus() {
return this.$store.state.temperature >= 35
}
}
```
What will be output on the browser’s console?```javascript
function outerFunc() {
const val1 = 10;
var val2 = 20;
function innerFunc() {
var val2 = 30;
console.log(val1)
console.log(val2)
}
innerFunc()
console.log(val1)
console.log(val2)
}
outerFunc()
```
``` 10 20 10 30 ```

``` 10 20 10 20 ```

``` 10 30 10 20 ```

```javascript const numbers = [10, 20, 30, 40, 50]; const [num1, , num2, ...rest] = numbers; const [a = 100, b = 200] = [undefined, 0]; console.log(num1, num2, rest); console.log(a, b); ```

```javascript
const user = {
id: 1,
profile: {
name: "Riya",
address: {
city: "Pune",
zip: "411001"
}
}
};
const {
profile: {
name,
address: { city, state = "Maharashtra" }
},
role = "guest",
profile
} = user;
console.log(name, city, state, role);
console.log(profile);
```

Riya Pune Maharashtra guest
```
{ name: "Riya", address: { city: "Pune", zip: "411001" } }
```

Riya Pune Maharashtra guest undefined

```
undefined undefined Maharashtra guest
```
```json
{ "name": "Riya", "address": { ...} }
```
, because you cannot destructure profile into nested variables and also assign it to a plain variable profile in the same statement.SyntaxError
What is the order of console output?```javascript
console.log("1");
setTimeout(() => console.log("2"), 0);
Promise.resolve().then(() => console.log("3"));
console.log("4");
Promise.resolve().then(() => {
console.log("5");
setTimeout(() => console.log("6"), 0);
});
```
| Directive | Description | |---|---| | 1. v-if | A. Two-way binding between input and data | | 2. v-for | B. Conditionally renders DOM elements | | 3. v-bind | C. Binds HTML attributes dynamically | | 4. v-model | D. Renders a list of items |

```javascript
const calculator = {
value: 10,
add(a, b) {
return this.value + a + b;
}
};
const rawAdd = calculator.add;
const boundAdd = calculator.add.bind({ value: 100 }, 5);
console.log(rawAdd(1, 2));
console.log(boundAdd(10));
console.log(calculator.add.apply({ value: 50 }, [1, 2]));
```
evaluates to 
``` rawAdd(1, 2) ``` NaN
evaluates to 
``` boundAdd(10) ``` 115
evaluates to 
```
calculator.add.apply({ value: 50 }, [1, 2])
```
53
throws a 
```
calculator.add.apply({ value: 50 }, [1, 2])
```
TypeError
about its output:

TRUE
```javascript
const value = "global";
const obj = {
value: "objectValue",
regularMethod: function () {
console.log(this.value);
},
arrowMethod: () => {
console.log(this.value);
},
nested: {
value: "nestedValue",
regularInNested: function () {
console.log(this.value);
},
arrowInNested: () => {
console.log(this.value);
},
},
delayedRegular: function () {
setTimeout(function () {
console.log(this.value);
}, 100);
},
delayedArrow: function () {
setTimeout(() => {
console.log(this.value);
}, 100);
},
};
```
```javascript
obj.regularMethod();
obj.arrowMethod();
obj.nested.regularInNested();
obj.nested.arrowInNested();
obj.delayedRegular();
obj.delayedArrow();
```
logs "objectValue"``` obj.regularMethod() ```
logs "objectValue"``` obj.arrowMethod() ```
logs "nestedValue"``` obj.nested.regularInNested() ```
logs 
``` obj.nested.arrowInNested() ``` undefined
logs "objectValue"``` obj.delayedArrow() ```
logs "objectValue"``` obj.delayedRegular() ```
Note: Each sub question runs on its own, starting from the original 'user' object. Based on the above data, answer the given subquestions.
```javascript
const cloned = { ...user }
cloned.name = "Amit"
cloned.skills.push("JavaScript")
console.log(user.name)
console.log(user.skills.length)
```
Note: Each sub question runs on its own, starting from the original 'user' object. Based on the above data, answer the given subquestions.
```javascript
const cloned = {
...user,
skills: [...user.skills]
}
cloned.skills.push("JavaScript")
console.log(user.skills.length)
console.log(cloned.skills.length)
```
Based on the above data, answer the given subquestions.
pauses the execution of the
function until the Promise resolves.await ``` display() ```
immediately returns the resolved string "Data Received".``` fetchData() ```
functions cannot return a
.async Promise
would cause
to store a
object instead of the resolved value.await result Promise
file:index.html
Select all statements that correctly describe the console output:```javascript
new Vue({
el: "#app",
data: {
message: "Hello"
},
beforeCreate() {
console.log("1:", this.message);
},
created() {
console.log("2:", this.message);
},
beforeMount() {
console.log("3:", this.$el.textContent);
},
mounted() {
console.log("4:", this.$el.textContent);
}
});
```
```html
<div id="app">{{ message }}</div>
```
undefined

hello

hello

hello
Assume the API returns:
Complete the missing code so that all course names are rendered correctly. Which of the following code snippets can correctly replace
?```html
<div id="app">
<ul>
<!-- Missing Code -->
</ul>
</div>
<script>
new Vue({
el: '#app',
data: {
courses: []
},
async mounted() {
const response = await fetch('https://example.com/api/courses')
this.courses = await response.json()
}
})
</script>
```
```json
[
{ "id": 1, "name": "MAD-2" },
{ "id": 2, "name": "DBMS" }
]
```
```html
<!-- Missing Code -->
```
```html
<li v-for="course in courses" :key="course.id">
{{ course.name }}
</li>
```
```html
<li v-for="(course, index) in courses" :key="index">
{{ course.name }}
</li>
```
```html
<li v-if="course in courses">
{{ course.name }}
</li>
```
```html
<li v-for="courses in course">
{{ courses.name }}
</li>
```
```javascript
const products = [
{ name: "Laptop", price: 1200, inStock: true },
{ name: "Mouse", price: 25, inStock: false },
{ name: "Keyboard", price: 75, inStock: true },
{ name: "Monitor", price: 300, inStock: false }
];
const result = products.filter(item => item.inStock && item.price < 500);
```
```json
{ "name": "Keyboard", "price": 75, "inStock": true }
```
```
[[{ name: "Laptop", price: 1200, inStock: true }, { name: "Keyboard", price: 75, inStock: true }]]
```
```
[[{ name: "Keyboard", price: 75, inStock: true }]]
```
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
width: 100px;
height: 100px;
background-color: lightblue;
margin: 10px;
border: 1px solid black;
}
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
align-content: flex-start;
height: 300px;
border: 2px solid red;
}
</style>
</head>
<body>
<div class="container">
<div class="box">Box 1</div>
<div class="box">Box 2</div>
<div class="box">Box 3</div>
<div class="box">Box 4</div>
<div class="box">Box 5</div>
<div class="box">Box 6</div>
</div>
</body>
</html>
```
Which of the following statements correctly describes what happens in Tab 2?```javascript
// Executed in Tab 1
localStorage.setItem("theme", "dark");
sessionStorage.setItem("cart", "3-items");
```
and
return their respective values.```javascript
localStorage.getItem("theme")
```
```javascript
sessionStorage.getItem("cart")
```
returns "dark", but
returns null.```javascript
localStorage.getItem("theme")
```
```javascript
sessionStorage.getItem("cart")
```
returns "3-items", but
returns null.```javascript
sessionStorage.getItem("cart")
```
```javascript
localStorage.getItem("theme")
```
Based on the above data, answer the given subquestions.
Based on the above data, answer the given subquestions.
gets its own
binding.```javascript
setTimeout(function(){})
```
this
from the surrounding lexical scope.this
automatically binds
to the surrounding object.``` setTimeout ``` this
in
, it will print "Rahul".``` setTimeout ``` ``` normalFunction ```


Why does this fail?```javascript
const heading = document.querySelector("h1")
```
document
works only after using 
```javascript document.querySelector() ``` ``` setTimeout() ```
The above code is initially loaded on the browser and then the browser is refreshed two times. What will be the final output?```javascript
function addProduct(product) {
let products = JSON.parse(localStorage.getItem('products')) || [];
products.push(product);
localStorage.setItem('products', JSON.stringify(products));
}
function getProducts() {
return JSON.parse(localStorage.getItem('products')) || [];
}
addProduct({ id: 3, name: 'Tablet' }.name);
console.log(getProducts());
```
```javascript
async function getUser() {
const response = await fetch("https://api.example.com/user/1");
if (!response.ok) {
throw new Error("Request failed");
}
const data = await response.json();
console.log(data.name);
}
getUser();
```
should use POST method by default, not GET``` fetch() ```
and
will throw errors because response is a 
response.ok ``` response.json() ``` Promise
cannot be called on a
response; use
instead``` .json() ``` fetch ``` .text() ```
does not work inside
functions``` fetch() ``` async

```javascript
console.log("A")
setTimeout(() => console.log("B"), 0)
Promise.resolve().then(() => console.log("C"))
console.log("D")
```
What happens to
?```javascript
const settings = { theme: "light", layout: { sidebar: true } }
const copy = { ...settings }
copy.layout.sidebar = false
```
```
settings.layout.sidebar
```
because spread syntax always creates a deep copy.true
because the nested object is still shared in a shallow copy.false
because
is removed from the original object.undefined layout
What will be the output of above code on the browser’s console?```javascript
async function fetchData() {
console.log("1");
const result = await new Promise((resolve) => {
setTimeout(() => resolve("done"), 1000);
console.log("2");
});
console.log("3:", result);
}
fetchData();
console.log("4");
```
```
mutations: {
ADD_TO_CART(state, product) {
state.cart.push(product)
}
}
```
```javascript
mutations: {
ADD_TO_CART(state, product) {
setTimeout(() => {
state.cart.push(product)
}, 500)
}
}
```
```javascript
mutations: {
ADD_TO_CART(state, product) {
fetch('/api/add').then(() => {
state.cart.push(product)
})
}
}
```
```javascript
mutations: {
ADD_TO_CART(state, product) {
Promise.resolve().then(() => {
state.cart.push(product)
})
}
}
```
Which of the following statements are correct?```html
<div class="card" data-price="499">
<span id="title">Vue Book</span>
</div>
```
returns
.```javascript
document.querySelector(".card").dataset.price
```
"499"
converts the value to numeric
.```javascript
Number(document.querySelector(".card").dataset.price)
```
499
can read the visible text
.```javascript
document.getElementById("title").innerText
```
"Vue Book"
returns a single element, not a collection.```javascript
document.querySelectorAll(".card")
```
for loading initial data.``` created() ```
for starting DOM-related work or timers.``` mounted() ```
for cleanup.``` beforeDestroy() ```
for declaring reactive
.``` destroyed() ``` data
inside a parent route, •
, •
inside a method. Which statements are correct?children
```
{ path: '*', component: NotFound }
```
```javascript
this.$router.go(-1)
```
can be used to organize nested routes under a parent route.children
can act as a fallback for unknown routes.*
tries to go back one step in browser history.```javascript this.$router.go(-1) ```

```javascript
const store = new Vuex.Store({
state: {
discount: 10,
products: [
{name: 'apple',
price: 120
},
{
name: 'banana',
price: 60
}
]
},
mutations: {
reducePrice: state=>{
// Code1
}
}
})
```
```javascript
this.$store.state.products.forEach(product => { product.price -= (state.discount)/100*product.price; })
```
```javascript
state.products.forEach(product => { product.price -= (state.discount)/100*product.price;})
```
```javascript
commit.products.forEach(product => { product.price -= (state.discount)/100*product.price;})
```
```javascript
dispatch.products.forEach(product => { product.price -= (state.discount)/100*product.price;})
```
Component.vue
After triggering all three methods (
,
and
) one by one, which of the following statements is correct?```javascript
const store = new Vuex.Store({
state: {
cart: []
},
mutations: {
ADD_TO_CART(state, product) {
state.cart.push(product)
}
},
actions: {
addToCart({ commit }, product) {
setTimeout(() => {
commit('ADD_TO_CART', product)
}, 500)
}
}
})
```
```javascript
methods: {
addItem_A(product) {
this.$store.commit('ADD_TO_CART', product)
},
addItem_B(product) {
this.$store.dispatch('addToCart', product)
},
addItem_C(product) {
this.$store.state.cart.push(product)
}
}
```
addItem_A
addItem_B
addItem_C
and
will appear in Vue DevTools mutation history, but
will appear with a delay.addItem_A addItem_B addItem_B
will update the cart because mutations cannot be called directly from components.addItem_B
will throw an error because Vuex prevents direct state modification.addItem_C
What will be logged in the console when this component first loads?```html
<template>
<div>
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
data() {
return {
message: ""
};
},
beforeCreate() {
console.log("A:", this.message);
},
created() {
console.log("B:", this.message);
this.message = "Hello from Vue!";
},
mounted() {
console.log("C:", document.querySelector("p").textContent);
}
};
</script>
```
A: "" → B: Hello from Vue! → C: Hello from Vue!

A: undefined -> B: Hello from Vue! -> C: Hello from Vue!

A: undefined → B: "" → C: Hello from Vue!

A: undefined → B: undefined → C: Hello from Vue!

A: "" -> B: "" -> C: Hello from Vue!
Which of the following statements are correct?```javascript console.log(typeof setTimeout) console.log(typeof document) ```
."function"
."undefined"
will work in Browser by default because V8 provides the DOM.```javascript document.querySelector() ```

```javascript items.forEach(item => console.log(item)) ```

```javascript setTimeout(showMessage, 1000) ```

```javascript const result = showMessage() ```

```javascript
button.addEventListener("click", handleClick)
```
```javascript
console.log("1")
setTimeout(() => {
console.log("2")
setTimeout(() => console.log("3"), 0)
}, 0)
console.log("4")
```
What will be the output of the above code on the browsers’ console?```javascript
let var1 = 20;
var var2 = 30;
const val = 10;
{
let var1 = 40;
console.log(var1 + val);
}
console.log(var1 + val);
{
var var2 = 50;
console.log(var2 + val);
}
console.log(var2 + val);
```
What will be the output of the above code on the browsers’ console?```javascript
const obj1 = {
prop1: "Germany",
prop2: "Spain",
prop3: 50,
method1: function(){
console.log(`The European countries are ${this.prop2} and ${this.prop1}.`)
},
method2: function(param){
let value = param + 2*this.prop3;
console.log(`The final numerical value is: ${value}.`)
}
}
const obj2 = {
prop1: "England",
prop2: "Italy",
prop3: "25"
}
const func1 = obj1.method1;
const func2 = obj1.method2;
func1.apply(obj1);
func2.bind(obj2)(15);
```
What will be the output of the above code on the browsers’ console?```javascript
const obj1 = {
prop1: "Aluminium",
prop2: "Gold",
prop3: "Silver"
}
const obj2 = {
propA: "Argon",
propB: "Neon"
}
const {prop2: element1, propA: element2} = {...obj2, ...obj1};
console.log(`The selected elements are: ${element1} and ${element2}`);
```
and inside the child:
Which statements are correct?```html
<child-box :message="parentMsg" @reply="handleReply"></child-box>
```
```javascript
this.$emit('reply', 'ok')
```
flows from parent to child through props.message
is a custom event sent from child to parent.reply
to update the parent source of truth.message
changes in the parent, the child can receive the updated prop value.parentMsg
Why does the
value not update correctly when the button is clicked?```html
<div id="app">
<p>{{ message }}</p>
<button @click="changeMessage">Click</button>
</div>
<script>
new Vue({
el: '#app',
data: {
message: "Hello"
},
methods: {
changeMessage: () => {
this.message = "Updated"
}
}
})
</script>
```
message
should be used instead of 
v-on ``` @click ```

this
should be a function in all Vue instancesdata
Which of the following statements is/are correct?```javascript
class MathUtils {
static add(a, b) {
return a + b;
}
multiply(a, b) {
return a * b;
}
}
const utils = new MathUtils();
```
will work correctly and return 8``` MathUtils.add(5, 3) ```
will work correctly and return 8``` utils.add(5, 3) ```
will work correctly and return 15``` utils.multiply(5, 3) ```
will work correctly and return 15``` MathUtils.multiply(5, 3) ```
What will be the output of the above code on the browsers’ console?```javascript
var var1 = 25;
var var2 = 35;
const obj = {
var1: 45,
var2: 55,
func1: function(){
console.log(`You are accessing: ${var1}`)
},
func2: () => {
console.log(`You are accessing: ${this.var2}`)
},
}
obj.func1()
obj.func2()
```
What will be the output of the above code on the browsers’ console in correct order?```javascript
console.log(z);
var a = "alpha";
console.log(a);
let b = "beta"
console.log(b);
d();
console.log(c);
const c = "charlie"
function d(){
console.log("delta")
}
var z = function(){
console.log("zeta")
}
```
What will be the output of the above code on the browsers’ console?```javascript
let myArr = ["January", "March", "April", "August", "September", "October"]
let modArr = myArr.map((m) => m.slice(2)).
filter((m) => m.length < 5).
sort();
console.log(modArr[1]);
```
What will be the output of the above code on the browsers’ console?```javascript
function first() {
console.log("First start");
setTimeout(function () {
console.log("First timeout");
}, 0);
console.log("First end");
}
function second() {
console.log("Second start");
setTimeout(function () {
console.log("Second timeout");
}, 0);
}
console.log("Program start");
first();
second();
console.log("Program end");
```
What will be the output of the above program?```javascript let arr = [1, 2, 3]; let sum = arr.reduce((acc, val, idx, array) => acc + val, 0); console.log(sum); ```
In another file app.js, which of the following import statements will correctly import both strikeRate and playerName ? ( Assume both files are in the same directory )```javascript
export const strikeRate = (runs, balls) => {
return (runs / balls) * 100;
};
export const playerName = "Virat Kohli";
```
```javascript import strikeRate, playerName from "./battingStats.js"; ```

```javascript
import { strikeRate, playerName } from "./battingStats.js";
```
```javascript import * as stats from "./battingStats.js"; ```

```javascript
require("./battingStats.js");
```
What will be the output of the above program?```javascript
const promise = new Promise((resolve, reject) => {
resolve('Success!');
reject('Error!');
});
promise.then(console.log).catch(console.log);
```
If the addItemAsync action is dispatched with the item 'React', what will be the state of items after 2 seconds?```javascript
const store = new Vuex.Store({
state: {
items: ['Angular', 'Vue'],
},
mutations: {
addItem(state, item) {
state.items.push(item);
},
},
actions: {
addItemAsync({ commit }, item) {
setTimeout(() => {
commit('addItem', item);
}, 500);
},
},
});
```
What happens when the user navigates to an undefined route like "/random"?```html
<div id="app">
<router-link to="/about">Go to About</router-link>
<router-view></router-view>
</div>
<script>
const Home = { template: '<div>Home</div>' };
const About = { template: '<div>About</div>' };
const routes = [
{ path: '/home', component: Home },
{ path: '/about', component: About },
{ path: '*', redirect: '/about' }
];
const router = new VueRouter({ routes });
new Vue({
el: '#app',
router
});
</script>
```
```javascript console.log(typeof NaN); console.log(typeof null); console.log(NaN == null); console.log(NaN === null); ```
What will be the output of the above program on a browser's console?```javascript
class Animal {
constructor(type) {
this.type = type;
}
speak() {
console.log(`${this.type} makes a sound`);
}
getType() {
return `This is a ${this.type}`;
}
}
class Dog extends Animal {
constructor(type, breed) {
super(type);
this.breed = breed;
}
speak() {
console.log(`${this.type} ${this.breed} barks`);
}
}
const myDog = new Dog('Dog', 'Labrador');
myDog.speak();
console.log(myDog.getType());
console.log(myDog instanceof Dog);
console.log(myDog instanceof Animal);
console.log(Dog.prototype.__proto__ === Animal.prototype);
```
``` Dog Labrador barks This is a Dog true true true ```

``` Dog makes a sound This is a Dog Labrador true false true ```

``` Dog Labrador barks This is a Dog Labrador true true false ```

``` Dog Labrador barks This is a Dog false true true ```
What will be the output of the above program?```javascript
const person = {
firstName: 'John',
lastName: 'Doe',
age: 30,
city: 'New York'
};
const { firstName, city, ...rest } = person;
const newPerson = { firstName, location: city, ...rest };
console.log(firstName);
console.log(rest);
console.log(newPerson);
```
```
John
{ city: 'New York', lastName: 'Doe', age: 30 }
{ firstName: 'John', location: 'New York', city: 'New York', lastName:
'Doe', age: 30 }
```
```
John
{ 'lastName': 'Doe', 'age': 30 }
{ 'firstName': 'John', 'location': 'New York', 'lastName': 'Doe', 'age': 30 }
```
```
John
{ 'lastName': 'Doe', 'age': 30 }
{ 'firstName': 'John', 'location': 'New York', 'city': 'New York', 'lastName':
'Doe', 'age': 30 }
```
```
undefined
{ firstName: 'John', city: 'New York', lastName: 'Doe', age: 30 }
{ firstName: 'John', location: 'New York' }
```
What will be printed in the console when the above code is executed?```javascript
const CAPACITY = 75;
const TOTAL_PEOPLE = 213;
function allocatePeople() {
return new Promise((resolve, reject) => {
let slots = [0, 0, 0];
let remaining = TOTAL_PEOPLE;
for (let i = 0; i < slots.length; i++) {
if (remaining >= CAPACITY) {
slots[i] = CAPACITY;
remaining -= CAPACITY;
} else {
slots[i] = remaining;
remaining = 0;
}
}
reject(slots);
});
}
async function startAllocation() {
try {
const result = await allocatePeople();
console.log("Passed " + JSON.stringify(result));
} catch (error) {
console.log("Failed " + JSON.stringify(error));
}
}
startAllocation();
```
| Directive | Description | |---|---| | 1. v-if | A. Two-way data binding between input and data | | 2. v-for | B. Conditionally renders elements in the DOM | | 3. v-bind | C. Binds HTML attributes dynamically | | 4. v-model | D. Renders a list of items |
Suppose the application is running on http://127.0.0.1:8080. What will be rendered by the browser?File: index.html
```html
<div id="app"></div>
<script src="script.js"></script>
```
File: script.js
```javascript
new Vue({
el: '#app',
template: `<div>
Status: {{status}}<br>
Value: {{value}}
</div>`,
data: {
status: "Initial",
value: 10,
},
beforeCreate() {
this.status = this.status + " -> Created"
this.value = this.value + 5
},
beforeMount() {
this.status = this.status + " -> Ready"
this.value = this.value - 2
},
created() {
this.status = this.status + " -> Mounted"
this.value = this.value * 2
},
mounted() {
this.status = this.status + " -> Done"
this.value = this.value / 2
},
})
```