What is the purpose of the pages/ directory in a Nuxt project?
The pages/ directory holds Vue components that automatically become routes in the app. Each file corresponds to a URL path, making navigation simple without manual route setup.
Click to reveal answer
beginner
What role does the components/ folder play in a Nuxt project?
The components/ folder stores reusable Vue components like buttons or headers. These components can be used inside pages or other components to keep code organized and avoid repetition.
Click to reveal answer
intermediate
What is the nuxt.config.ts file used for?
This file configures the Nuxt app settings like plugins, modules, global CSS, and build options. It controls how the app behaves and what features are enabled.
Click to reveal answer
intermediate
Explain the purpose of the store/ directory in Nuxt.
The store/ directory contains Vuex store files for managing app-wide state. It helps keep data consistent across pages and components.
Click to reveal answer
intermediate
What is the difference between layouts/ and pages/ directories?
layouts/ holds Vue components that define the common structure (like header, footer) shared by multiple pages. pages/ contains components that represent individual pages or routes.
Click to reveal answer
Which folder in a Nuxt project automatically creates routes based on its files?
Apages/
Bcomponents/
Clayouts/
Dstore/
✗ Incorrect
The pages/ folder files become routes automatically in Nuxt.
Where would you place a reusable button component in a Nuxt project?
Astore/
Bpages/
Clayouts/
Dcomponents/
✗ Incorrect
Reusable UI parts go inside the components/ folder.
What file controls global settings like plugins and CSS in Nuxt?
Aindex.vue
Bnuxt.config.ts
Cmain.js
Dpackage.json
✗ Incorrect
nuxt.config.ts is the main configuration file for Nuxt.
Which directory manages shared app state in Nuxt?
Astore/
Bpages/
Clayouts/
Dcomponents/
✗ Incorrect
The store/ directory contains Vuex files for state management.
What is the main difference between layouts/ and pages/ folders?
Alayouts/ holds routes, pages/ holds components
Blayouts/ holds reusable UI parts, pages/ holds state files
Clayouts/ defines common page structure, pages/ defines individual pages
4. You created a file pages/contact.vue but visiting /contact shows a 404 error. What is the most likely cause?
medium
A. The plugins/ folder is empty
B. The layouts/default.vue file is missing
C. The contact.vue file is inside components/ folder instead of pages/
D. You forgot to import contact.vue in pages/index.vue
Solution
Step 1: Check file location for routing
Nuxt auto-generates routes only from files inside the pages/ folder.
Step 2: Identify common mistakes
If contact.vue is inside components/, it won't create a route, causing 404 on /contact.
Final Answer:
The contact.vue file is inside components/ folder instead of pages/ -> Option C
Quick Check:
Pages folder files create routes [OK]
Hint: Pages must be inside pages folder for routing [OK]
Common Mistakes:
Placing pages in components folder
Thinking layouts cause 404
Assuming imports needed for pages
5. You want to create a Nuxt app with two different page layouts: one for public pages and one for admin pages. How should you organize your project structure to achieve this?
hard
A. Create layouts/public.vue and layouts/admin.vue, then specify layout in each page's definePageMeta
B. Put all pages in pages/ and import layouts manually inside each page component
C. Create two separate pages/ folders named public and admin without layouts
D. Use plugins/ to switch layouts dynamically based on route
Solution
Step 1: Understand layout usage in Nuxt
You can create multiple layouts inside layouts/ folder, each as a Vue component.
Step 2: Assign layouts per page
Use definePageMeta in each page to specify which layout to use, e.g., layout: 'admin' or layout: 'public'.
Step 3: Evaluate other options
Importing layouts manually or using plugins for layout switching is not the recommended Nuxt pattern.
Final Answer:
Create layouts/public.vue and layouts/admin.vue, then specify layout in each page's definePageMeta -> Option A
Quick Check:
Multiple layouts + definePageMeta = correct [OK]
Hint: Use multiple layouts and definePageMeta per page [OK]
Common Mistakes:
Trying to import layouts manually in pages
Not using definePageMeta for layout selection
Misusing plugins for layout switching
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.