Skip to content
codinganthem

Vue skill check

Practise Vue 3: reactivity, the Composition API, directives, computed values and watchers, component communication, and Pinia.

15

Questions

11 min

Timer can't pause

Multiple choice

Vue 3

Choose a level

Topics

  • Reactivity
  • Composition API
  • Templates and directives
  • Components and props
  • Computed and watchers
  • Lifecycle
  • Pinia
  • Routing

Do

Use scratch paper or a notepad to work things out. Skip a question and come back to it later.

Don't

Look up answers during the check. Open the check in more than one tab or window.

Easy · 15 questions · 11 min

By starting, you agree to the Terms and Privacy Policy.

Start practice

Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.

Checking your levels…

Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.

Sample Vue questions with answers

These are never used in a check, so seeing their answers here won't give anything away.

  1. Question 1 · Easy · Reactivity

    In Vue 3, how does a developer access or update the primitive value wrapped inside a ref within a JavaScript script block?
    1. A.By reading or writing to its .value property
    2. B.By accessing the $data property on the component instance
    3. C.By using the unwrap() helper function directly on the reference
    4. D.By calling it as a function: myRef()
    Show answer

    A. By reading or writing to its .value property

    A ref wraps an inner value in an object exposing a reactive .value property. In script blocks, you read and write to .value, whereas templates automatically unwrap top-level refs.
  2. Question 2 · Easy · Templates and directives

    What is the difference between the v-if and v-show directives in Vue?
    1. A.v-if can only be used on native HTML tags, whereas v-show can only be used on custom Vue components
    2. B.v-show destroys the component's state upon hiding, whereas v-if preserves internal state
    3. C.v-if toggles the CSS display property, whereas v-show conditionally mounts or unmounts the element in the DOM
    4. D.v-if conditionally renders elements by adding or removing them from the DOM, whereas v-show toggles CSS display
    Show answer

    D. v-if conditionally renders elements by adding or removing them from the DOM, whereas v-show toggles CSS display

    v-if has higher toggle costs because it completely adds or tears down elements and listeners in the DOM. v-show keeps the element in the DOM and toggles display: none.
  3. Question 3 · Moderate · Composition API

    What is the primary difference between provide/inject in the Composition API and passing props down through multiple component levels?
    1. A.provide/inject causes all intermediate components to re-render whenever the injected value changes.
    2. B.provide/inject requires the descendant component to be explicitly registered in the ancestor's provides array.
    3. C.provide/inject allows an ancestor to supply dependencies to any descendant without intermediate components needing to declare them.
    4. D.provide/inject only works with synchronous primitives and cannot pass reactive objects.
    Show answer

    C. provide/inject allows an ancestor to supply dependencies to any descendant without intermediate components needing to declare them.

    provide and inject allow an ancestor component to act as a dependency provider for any descendant component in its subtree, avoiding 'prop drilling' through intermediate layers.
  4. Question 4 · Advanced · Lifecycle

    In what order do component lifecycle hooks run during the initial mount of a parent component and its child component in Vue 3?
    1. A.Parent beforeMount -> Parent mounted -> Child beforeMount -> Child mounted
    2. B.Parent beforeMount -> Child beforeMount -> Parent mounted -> Child mounted
    3. C.Child beforeMount -> Parent beforeMount -> Child mounted -> Parent mounted
    4. D.Parent beforeMount -> Child beforeMount -> Child mounted -> Parent mounted
    Show answer

    D. Parent beforeMount -> Child beforeMount -> Child mounted -> Parent mounted

    Parent mounts its template and triggers its beforeMount hook before evaluating children. The child component must complete its mounting cycle (beforeMount and mounted) before the parent can complete its mount and run its mounted hook.

How scoring and certificates work

  • Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
  • Practice is free without an account and shows whether each answer is right as you go, with an explanation.
  • The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
  • Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.

Free tools for Vue: JavaScript Formatter, JSON to TypeScript