Modern Application Development II, Quiz 2
Consider the following Vue application with markup "index.html" and JavaScript file "app.js".
index.html:
<div id="app"> <card-component> <template #title> Welcome Message </template> <p>Main card content here</p> <template #default> Default slot content </template> <template #actions> <button>Click Me</button> </template> </card-component></div><script src="app.js"></script>app.js:
Vue.component("cardComponent", { template: `<div class="card"> <h2> <slot name="title"></slot> </h2> <div class="content"> <slot></slot> </div> <div class="footer"> <slot name="footer"></slot> </div> </div>`,})
const app = new Vue({ el: "#app",})Suppose you open the "index.html" file in a browser. What will be rendered by the browser?
Consider the following Vue application with markup "index.html" and JavaScript file "app.js". index.html: <div id="app"> <card-component> <template #title> Welcome Message </template> <p>Main card content here</p> <template #default> Default slot content </template> <template #actions> <button>Click Me</button> </template> </card-component> </div> <script src="app.js"></script> app.js: Vue.component("cardComponent", { template: `<div class="card"> <h2> <slot name="title"></slot> </h2> <div class="content"> <slot></slot> </div> <div class="footer"> <slot name="footer"></slot> </div> </div>`, }) const app = new Vue({ el: "#app", }) Suppose you open the "index.html" file in a browser. What will be rendered by the browser? Consider the below JavaScript program. new Promise((resolve, reject) => { if (10 > 5) reject(15) else resolve(25) }) .then(d => { console.log("Success handler", d); return d * 2; }, d => { console.log("Error handler", d); throw new Error(30); }) .catch(e => { console.log("Catch block", e.message); return e.message / 2; }) .then(d => { console.log("Next then", d); return d + 10; }) .finally(d => { console.log("Finally block", d); return d * 100; }) .then(d => { console.log("Final then", d); return d * 3; }) What will be the output of the above program? Consider the below Vue component. <template> <div> <p>{{ counter }}</p> <button @click="incrementCounter">Increment</button> </div> </template> <script> export default { data() { return { counter: 0 }; }, methods: { incrementCounter() { this.counter = this.counter + 2; this.counter = this.counter * 2; this.counter = this.counter - 5; } } }; </script> What will be displayed in the `<p>` element after the button with text "Increment" is clicked twice?