wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Intro to Vue

Total questions: 11

Worksheet time: 8mins

Name
Class
Date
1.

What is the difference between v-show and v-if?

a)

Nothing. It's just syntactic sugar.

b)

v-show uses styles to hide the element

c)

v-if removes the element from the DOM

2.

What types of objects can you iterate over using v-for?

a)

Arrays

b)

Objects

c)

Numbers

3.

In Vue, if you want to apply a class conditionally to a DOM element what would you do?

a)

In the created lifecycle hook, use dollar-js to apply a class that is defined inside of a scoped style tag.

b)

Use class="{{someComputedProperty}}" in the DOM element

c)

Use :class="{ 'myClass': myBoolean }" in the DOM element

d)

Use v-bind:class="{ 'myClass': myBoolean }" in the DOM element

4.

What does the scoped attribute on the style tag do?

a)

It's like an !important on all of our Vue styles. They'll always win.

b)

It prevents our styles from affecting other styles. It does not protect us from publisher styles affecting our Vue markup.

c)

It's required on the template so that we can add IM_ad_unit before it.

5.

Can you have multiple style tags?

a)

Yes

b)

No

6.

What are the different ways you can style a DOM node inside of a template?

a)

Create a class in the style section of the Vue file.

b)

Inline styles.

c)

Use dollar-js to affect the styles.

7.

From reading the following code, what assumptions can you make about the structure of the component?

a)

The IM_fancy_pirate class is defined in the Pirate component's styles, and we will apply it.

b)

The IM_fancy_pirate class is defined in the current component's style tag and we will apply it.

c)

Inside the Pirate Component, there is a function called isFancyPirate.

d)

Inside the current component's script, there is a function called isFancyPirate

e)

There is an Object or Array containing pirates in the current component.

8.

How can you import code in a Vue file?

a)

You have to bind every module you want to share to a window global and use GlobalGetter

b)

You can use the import statement

c)

You can use the require statement

9.

How do you define a new component?

a)

Create a Vue file which exports an object literal.

b)

Create a Vue file which exports a class.

c)

Create a Vue file which exports a class decorated by @Component

10.

What are the ways you can define a variable called {{amazingAds}} for use in the <template> of your Vue file?

a)

get amazingAds() { return this.ads.amazing ? 'Amazing Ads' : 'Not very amazing'; }

b)

amazingAds() { return this.ads.amazing ? 'Amazing Ads' : 'Not very amazing'; }

c)

Define a data property in the class called amazingAds.

d)

Take amazingAds in as a property.

11.

What is the difference between properties and data?

a)

Properties are passed in from the parent, via template attributes.

b)

Data is passed in from the parent, via template attributes.

c)

Data should be private to the component

d)

Data is immutable from within the component

e)

Properties should not be mutated from within the component.