---Advertisement---
Web

Vue JS – Efficacy Interview Question-Answer

By Smart Answer

Updated on:

---Advertisement---

Q.1 How to initialize the root instance in Vue JS (using the CDN method)?

       A. var app = Vue new({…});

       B. var app = Vue.new({…});

       C. var app = Vue({…});

       D. var app = new Vue({…});

Ans : var app = new Vue({…});


Q.2 The following attributes can be used for conditional rendering, except __________.

       A. v-show

       B. v-ifelse

       C. v-else

       D. v-if

Ans : v-ifelse


Q.3 Which is the simplest way to perform attribute binding?

       A. <span :title:=”vue_var”>Some text</span>

       B. <span title=”vue_var”>Some text</span>

       C. <span title:=”vue_var”>Some text</span>

       D. <span :title=”vue_var”>Some text</span>

Ans : <span :title=”vue_var”>Some text</span>


Q.4 What is the shorthand way to invoke a function when a click event is fired?

       A. #click

       B. $click

       C. @click

       D. %click

Ans : @click


Q.5 Vue CLI can be installed using _________.

       A. npm install -g vuecli

       B. npm install -g vue-cli

       C. npm install -g @vue/cli

       D. npm install -g vue

Ans : npm install -g @vue/cli


Q.6 Which among the following is/are cached in the browser?

       A. Computed method

       B. Normal method

       C. Both computed and normal methods

       D. None of the options

Ans : Computed method


Q.7 Communicating events allow data communication in which of the following ways?

       A. From root instance to the component

       B. From component to the root instance

       C. Both the options

Ans : Both the options


Q.8 Vue JS provides different attributes and directives for the Tab display of a web page.

       A. True

       B. False

Ans : False


Q.9 There can be more than one root element in the template of a component.

       A. True

       B. False

Ans : False


Q.10 Vue JS provides the feature to validate and display validation error messages.

       A. True

       B. False

Ans : True


Q.11 Vue JS allows changing the font size of a text dynamically.

       A. True

       B. False

Ans : True


Q.12 Which concept of Vue JS helps to modularize code?

       A. Components

       B. Tabs

       C. Event handling

       D. Forms

Ans : Components


Q.13
<p v-if=”counterVar % 2 == 0″> Value is even </p>
<p v-else> Value is odd </p>
<button v-on:click=”___________________”>Click Me!</button>

Assuming that counterVar variable has been initialized to 0, what must be filled in the click event handling mechanism?

       A. Both the options

       B. None of the options

       C. counterVar++

       D. counterVar + 1

Ans : counterVar + 1


Q.14 To pass the variable value from component to root instance, which method is employed in a Vue JS application?

       A. Attribute binding

       B. Event handling

       C. Forms

       D. Communicating Events

Ans : Communicating Events


Q.15 How many sections does a component have?

       A. 1

       B. 2

       C. 3

       D. 4

Ans : 1


Q.16 Which is the attribute in component to define variables?

       A. Data

       B. Props

       C. Template

       D. Computed

Ans : Data


Q.17 Which attribute in JavaScript/Vue JS is used to pass a variable value from parent component to child component?

       A. Methods

       B. Props

       C. Computed

       D. Template

Ans : Computed


Q.18 Which Vue attribute is used to display an HTML element based on a condition?

       A. Both the options

       B. v-if

       C. v-show

       D. None of the options

Ans : v-show


Q.19 What is the syntax to invoke the method handleUserClick when the user clicks a button?

       A. <button v-on:click=”handleUserClick”>Click Me!</button>

       B. <button :click=”handleUserClick”>Click Me!</button>

       C. Both the options

       D. None of the options

Ans : <button v-on:click=”handleUserClick”>Click Me!</button>


Q.20 What is the syntax to bind a Vue variable domTitle with an attribute?

       A. <span v-bind:title=”domTitle”></span>

       B. <span :title=”domTitle”></span>

       C. None of the options

       D. Both the options

Ans : <span v-bind:title=”domTitle”></span>


Q.21 An array of objects can be iterated using v-for.

       A. True

       B. False

Ans : True


Q.22
<course-section @get-marks=”getMarks”></course-section>
var marks = 100;
this.$emit(___________________);

The developer needs to pass the value of marks to its parent component. Fill in the blank with the correct answer.

       A. { event: ‘get-marks’, parameters: [marks] }

       B. marks, ‘get-marks’

       C. ’getMarks’, marks

       D. ‘get-marks’, marks

Ans : ‘get-marks’, marks


Q.23 A developer must not only know HTML and CSS but should also know JavaScript to develop front-end applications using Vue JS. Do you agree?

       A. Yes

       B. No

Ans : Yes


Q.24 A component in Vue JS can have multiple components within it.

       A. True

       B. False

Ans : True


Q.25 Vue JS can also be used to develop controller code.

       A. True

       B. False

Ans : True


Q.26 Changes in the Vue variable reflects in the HTML element attributes. This concept is known as ________.

       A. Element binding

       B. Attribute binding

       C. Variable binding

       D. HTML binding

Ans : Variable binding


Q.27
<form @submit.prevent=”validateSubmit”>…</form>
What does @submit.prevent do?

       A. Invokes the validateSubmit method before the usual submit action is executed.

       B. Irrespective of the method definition in validateSubmit, default submit action will be executed.

Ans : Invokes the validateSubmit method before the usual submit action is executed.


Q.28 Which of the following statements is true?

       A. Vue JS provides a mechanism to display an HTML element based on a Boolean condition.

       B. Displaying an HTML element based on a Boolean condition is not possible in Vue JS.

Ans : Vue JS provides a mechanism to display an HTML element based on a Boolean condition.


Q.29
<p v-if=”counterVar % 2 == 0″> Value is even </p>
<p v-else> Value is odd </p>
<button v-on:click=”___________________”>Click Me!</button> Assuming that counterVar variable has been initialized to 0, what must be filled in the click event handling mechanism?

       A. counterVar + 1

       B. counterVar++

       C. Both the options

       D. None of the options

Ans : Both the options


Smart Answer

---Advertisement---

Related Post

Workflow Automation with Gulp Interview Question-Answer

Q.1 The default task representation in gulp is _________.        A. ABgulp.call(‘default’,function(){ ‘d’,void});        B. gulp.task(‘default’,function(){ });        C. gulp.call(‘default’,function(){ ‘default’});   ...

Bundling with Webpack Interview Question-Answer

Q.1 The distinct feature of Webpack is ___________.        A. Code-Splitting        B. Bundling        C. Modularity        D. Reusability ...

Styling with CSS3 Interview Question-Answer

Q.1 To make the width of a table adjust to the current width of the viewer’s browser window, you should specify a table width of _______.     ...

Package Management with Bower Interview Question-Answer

Q.1 You are trying to install a particular jQuery version 1.9.15 using Bower install angular. What happens to the installation? ( Hint – jQuery 1.9.15 is not a ...

Leave a Comment