Sample questions
Question 1Easy
What is a .vue file called?
- A Single File Component (SFC)
- A Vue module bundle that contains every compiled component of the whole application
- A style sheet
- A package manifest
Answer: A. A Single File Component (SFC)
Explanation
An SFC can contain <template>, <script> and <style> blocks.
Step-by-step solution
- Open a .vue file.
- See three blocks.
Why the other options are wrong
- B. An SFC is one component file, not a bundle of every compiled component.
- C. It also has template and script.
- D. package.json is the manifest.
Question 2Easy
Which API creates the app in Vue 3?
- new Vue({ render: h => h(App) }).$mount('#app'), the form used by Vue 2
- Vue.createInstance()
- createApp(App).mount('#app')
- mountApp(App)
Answer: C. createApp(App).mount('#app')
Explanation
Vue 3 uses the createApp factory; multiple isolated apps are possible.
Step-by-step solution
- Call createApp.
- Mount to a selector.
Why the other options are wrong
- A. That is Vue 2 style.
- B.
Vue.createInstance() is not a Vue API for this; the correct choice is createApp(App).mount('#app'). - D.
mountApp(App) is not a Vue API for this; the correct choice is createApp(App).mount('#app').
Question 3Easy
What replaced Vuex as the officially recommended state library?
- Redux
- Pinia
- MobX
- Zustand
Answer: B. Pinia
Explanation
Pinia has a simpler API with no mutations and better TypeScript support.
Step-by-step solution
- Install Pinia.
- Use defineStore.
Why the other options are wrong
- A. React ecosystem.
- C. Different ecosystem.
- D. React ecosystem.
Question 4Easy
Which tool is the commonly recommended build tool/dev server for new Vue 3 projects?
- Grunt
- Gulp
- Bower
- Vite
Answer: D. Vite
Explanation
Vite offers native-ESM dev serving and fast builds; npm create vue@latest scaffolds with it.
Step-by-step solution
- Scaffold with create-vue.
- Run the dev server.
Why the other options are wrong
- A. Older task runner.
- B. Older task runner.
- C. Package manager that is obsolete.
Question 5Medium
What is .env prefix needed to expose a variable to client code in Vite?
- VUE_
- PUBLIC_
- VITE_
- APP_
Answer: C. VITE_
Explanation
Only variables starting with VITE_ are exposed via import.meta.env.
Step-by-step solution
- Name VITE_API_URL.
- Read import.meta.env.VITE_API_URL.
Why the other options are wrong
- A. That was Vue CLI.
- B. Other frameworks use it.
- D. Vite exposes only variables prefixed with VITE_, not APP_.
Tip: Never put secrets in client-exposed variables.
Question 6Medium
Which is a Vue 3 change from Vue 2 for templates?
- Templates must have exactly one root
- Templates are removed
- Only JSX is allowed
- Components may have multiple root nodes (fragments)
Answer: D. Components may have multiple root nodes (fragments)
Explanation
Fragments allow multiple root elements, though attribute fallthrough then needs explicit $attrs.
Step-by-step solution
- Vue 2 needed a single root.
- Vue 3 allows fragments.
Why the other options are wrong
- A. That was Vue 2.
- B. Templates remain.
- C. JSX is optional in Vue 3; templates remain the default.
Question 7Medium
What is tree shaking in the context of Vue 3?
- Removing unused CSS only, since scripts are always included in full by the bundler
- Unused APIs are removed from the bundle because Vue exposes modular imports
- Removing comments
- Deleting unused files from disk
Answer: B. Unused APIs are removed from the bundle because Vue exposes modular imports
Explanation
Global APIs became named exports, so bundlers can drop what you do not import.
Step-by-step solution
- Import named APIs.
- Bundler prunes the rest.
Why the other options are wrong
- A. It is about JS exports.
- C. Not about comments.
- D. Not file deletion.
Question 8Hard
How does Vue 3 reactivity differ from Vue 2 for newly added object properties?
- Proxies detect added properties; Vue 2's Object.defineProperty could not
- Both need Vue.set, because neither version can notice a property added later
- Neither detects them
- Vue 3 uses polling
Answer: A. Proxies detect added properties; Vue 2's Object.defineProperty could not
Explanation
Proxy traps catch property addition and deletion, array index assignment and length changes.
Step-by-step solution
- Vue 2 used getters/setters.
- Vue 3 uses Proxy.
Why the other options are wrong
- B. Vue 3 does not need it.
- C. Proxy tracks adds.
- D. No polling.
Practise all 8 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 →