Sample questions
Question 1Easy
Which built-in caches component instances when toggling between them?
- <Cache>
- <KeepAlive>
- <Suspense>
- <Hold>
Answer: B. <KeepAlive>
Explanation
KeepAlive preserves state of inactive components instead of destroying them.
Step-by-step solution
- Wrap dynamic component.
- State survives toggling.
Why the other options are wrong
- A.
<Cache> is not a built-in Vue component; the correct choice is <KeepAlive>. - C. Suspense handles async dependencies.
- D.
<Hold> is not a built-in Vue component; the correct choice is <KeepAlive>.
Question 2Easy
Which component helps animate an element when it enters or leaves via v-if?
- <Animate>
- <Motion>
- <Tween>
- <Transition>
Answer: D. <Transition>
Explanation
Transition applies CSS classes such as v-enter-from and v-leave-active.
Step-by-step solution
- Wrap one element.
- Define CSS classes.
Why the other options are wrong
- A.
<Animate> is not a built-in Vue component; the correct choice is <Transition>. - B.
<Motion> is not a built-in Vue component; the correct choice is <Transition>. - C.
<Tween> is not a built-in Vue component; the correct choice is <Transition>.
Question 3Easy
Which shorthand is used for v-slot:header?
- @header
- #header
- &header
- $header
Answer: B. #header
Explanation
# is the shorthand for v-slot:.
Step-by-step solution
- Use <template #header>.
- Content fills the named slot.
Why the other options are wrong
- A. @ is v-on.
- C. & is not a shorthand for v-slot; # is.
- D. $ is not a shorthand for v-slot; # is.
Question 4Easy
Which component animates a list rendered with v-for?
- <TransitionGroup>
- <Transition> only
- <ListAnim>
- <KeepAlive>
Answer: A. <TransitionGroup>
Explanation
TransitionGroup animates additions, removals and moves of items, and needs unique keys.
Step-by-step solution
- Wrap the v-for.
- Give keys.
Why the other options are wrong
- B. Transition handles a single element.
- C.
<ListAnim> is not a built-in Vue component; the correct choice is <TransitionGroup>. - D. KeepAlive caches.
Question 5Easy
What does <Teleport to="body"> do?
- Renders its content under a different DOM node while keeping it logically in the component
- Sends data to the server in the background while the component stays on the page
- Copies the component
- Hides it from the DOM
Answer: A. Renders its content under a different DOM node while keeping it logically in the component
Explanation
Teleport is useful for modals and tooltips that must escape overflow or z-index contexts.
Step-by-step solution
- Wrap content in Teleport.
- Set the target.
Why the other options are wrong
- B. Not a network feature.
- C. It moves, not copies.
- D. It is displayed.
Question 6Medium
How do you define an async component with lazy loading?
- lazy(Big.vue), a helper that wraps the component file name for deferred loading
- asyncImport('./Big.vue')
- defineAsyncComponent(() => import('./Big.vue'))
- new Component('./Big.vue')
Answer: C. defineAsyncComponent(() => import('./Big.vue'))
Explanation
The loader returns a Promise; the code is split into a separate chunk.
Step-by-step solution
- Wrap dynamic import.
- Chunk loads on demand.
Why the other options are wrong
- A. React API.
- B.
asyncImport('./Big.vue') is not a Vue API for this; the correct choice is defineAsyncComponent(() => import('./Big.vue')). - D.
new Component('./Big.vue') is not a Vue API for this; the correct choice is defineAsyncComponent(() => import('./Big.vue')).
Question 7Medium
What renders if the parent supplies no content for <slot>Default</slot>?
- Nothing
- An error
- undefined
- Default
Answer: D. Default
Explanation
Content inside <slot> is fallback content.
Step-by-step solution
- No content passed.
- Fallback is used.
Why the other options are wrong
- A. Fallback content appears.
- B. No error.
- C. Not printed.
Question 8Medium
What does a child do to pass data to a scoped slot?
- Emit an event named slot from the child and have the parent listen with @slot
- Use provide only
- Bind attributes on <slot>, e.g. <slot :item="item" />
- Call this.$slots.data()
Answer: C. Bind attributes on <slot>, e.g. <slot :item="item" />
Explanation
Attributes on <slot> become slot props the parent receives via v-slot="{ item }".
Step-by-step solution
- Child binds props on slot.
- Parent destructures them.
Why the other options are wrong
- A. Emit is for parent callbacks.
- B. Not required.
- D. Not how scoped slots work.
Question 9Hard
Which is true of <component :is="Comp">?
- It imports the component file automatically from the name given in the string
- It renders a dynamic component chosen at runtime
- It forces the component to be async
- It can only take strings
Answer: B. It renders a dynamic component chosen at runtime
Explanation
:is accepts a registered name or the component object.
Step-by-step solution
- Bind :is.
- Vue renders that component.
Why the other options are wrong
- A. You must import or register it.
- C. <component :is> chooses which component to render; it does not make it async.
- D. It can take component objects too.
Question 10Hard
What is <Suspense> used for?
- Delaying all rendering by one tick so that state changes are batched together
- Server-only rendering
- Showing fallback content while async dependencies (like async setup) resolve
- Lazy CSS loading
Answer: C. Showing fallback content while async dependencies (like async setup) resolve
Explanation
It has #default and #fallback slots and handles async components and top-level await.
Step-by-step solution
- Wrap async component.
- Provide fallback slot.
Why the other options are wrong
- A. Not a timer.
- B. Works on client too.
- D. It is about components.
Tip: Suspense was experimental for a long time; know the idea rather than the flags.
Practise all 10 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 →