Forms & Events Questions with Answers

7 practice questions on Forms & Events (Vue.js) with answers and step-by-step solutions. Try 7 samples below, then practise all 7 free in the AptiNest app.

Sample questions

Question 1Easy

How do you bind a checkbox to a boolean ok?

  1. <input type="checkbox" :ok>
  2. <input v-checked="ok">
  3. <input @check="ok">
  4. <input type="checkbox" v-model="ok">

Answer: D. <input type="checkbox" v-model="ok">

Explanation

v-model on a checkbox binds checked state to a boolean.

Step-by-step solution

  1. Use v-model.
  2. ok toggles.

Why the other options are wrong

  • A. :ok would bind an attribute named ok and not the checked state; v-model is needed.
  • B. <input v-checked="ok"> is not a Vue directive; the correct choice is <input type="checkbox" v-model="ok">.
  • C. No such event.

Question 2Medium

What does @click="inc(5)" pass, compared with @click="inc"?

  1. The event and 5
  2. 5 instead of the MouseEvent
  3. Nothing
  4. The element

Answer: B. 5 instead of the MouseEvent

Explanation

An inline call replaces the implicit event argument unless you write inc(5, $event).

Step-by-step solution

  1. Inline call uses given args.
  2. Add $event to get the event.

Why the other options are wrong

  • A. Use $event to pass both.
  • C. 5 is passed.
  • D. Not the element.

Question 3Medium

In a <select v-model="c">, what is c when <option value="in">India</option> is picked?

  1. "in"
  2. "India"
  3. 0
  4. true

Answer: A. "in"

Explanation

The option's value is used when present; otherwise its text.

Step-by-step solution

  1. Option has value.
  2. c gets 'in'.

Why the other options are wrong

  • B. Text only if no value attribute.
  • C. c holds the option's value attribute, not an index.
  • D. c holds the option's value attribute, not a boolean.

Question 4Medium

Several checkboxes share v-model="picked" where picked is an array. What is stored?

  1. Values of the checked boxes
  2. Only the last one, because each checkbox overwrites the value of the previous one
  3. Booleans for each
  4. The count

Answer: A. Values of the checked boxes

Explanation

Vue pushes or removes each box's value from the array.

Step-by-step solution

  1. Initialize array.
  2. Checked boxes add values.

Why the other options are wrong

  • B. Array collects all.
  • C. Values, not booleans.
  • D. The array holds the values of the checked boxes, not a count.

Question 5Medium

What does @keyup.enter="send" do?

  1. Calls send on every key
  2. Calls send only when Enter is released
  3. Calls send on page load
  4. Blocks Enter

Answer: B. Calls send only when Enter is released

Explanation

Key modifiers filter keyboard events by key.

Step-by-step solution

  1. Listen for keyup.
  2. Run only for Enter.

Why the other options are wrong

  • A. Key modifier filters.
  • C. Not on load.
  • D. It listens.

Question 6Medium

What does @submit.prevent="save" accomplish?

  1. Disables the form element and its inputs until the handler has finished running
  2. Validates input
  3. Runs save without a full page reload
  4. Submits twice

Answer: C. Runs save without a full page reload

Explanation

.prevent calls preventDefault on the submit event.

Step-by-step solution

  1. Form submit event.
  2. Default reload is blocked.

Why the other options are wrong

  • A. Does not disable.
  • B. No validation is built in.
  • D. Single call.

Question 7Hard

What is the Vue 3 equivalent of Vue 2's .sync modifier?

  1. :prop.async
  2. @sync
  3. v-bind.once
  4. v-model:propName

Answer: D. v-model:propName

Explanation

Argument form v-model:title replaces .sync.

Step-by-step solution

  1. Child emits update:title.
  2. Parent uses v-model:title.

Why the other options are wrong

  • A. :prop.async is not Vue 3 syntax; v-model with an argument replaced .sync.
  • B. @sync listens for an event named sync and does not replace the .sync modifier.
  • C. v-bind has no .once modifier, and it is one-way anyway.

Practise all 7 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Vue.js topics · All topics