Interview Patterns β‘ Recently updatedUpdated on Jun 30, 2026 β this content may still be evolving.
X vs Y Comparison Questions
25 comparison questions. Use the framework: difference β when X β when Y β what you used.
See answer-frameworks.md Framework 6.
Question: React vs Vue
Difficulty
π‘ Medium
Why Interviewers Ask This
Framework choice comparison β very common.
Answer
React: library + ecosystem, JSX, huge job market. Vue: progressive, templates optional, gentler learning curve. Both component-based with virtual DOM.
Example
React for larger ecosystem and job listings; Vue for faster onboarding on smaller teams.
Follow-up Questions
- Which for enterprise?
- State management?
- Performance difference?
Common Mistakes
Trash-talking either; no project-based reason.
Project Connection
I chose React because [job market / course / reusable components in X project].
Question: React vs Angular
Difficulty
π‘ Medium
Why Interviewers Ask This
Enterprise vs startup framing.
Answer
React is flexible library; Angular is full framework (routing, forms, DI built-in). Angular uses TypeScript by default, steeper curve, opinionated structure.
Example
Startup MVP β React. Large enterprise with Java background team β Angular sometimes.
Follow-up Questions
- Learning curve?
- When Angular wins?
- Google backing?
Common Mistakes
Saying Angular is dead; ignoring enterprise adoption.
Project Connection
Your project stack and whether youβd pick Angular for a bank intranet type app.
Question: JavaScript vs TypeScript
Difficulty
π’ Easy
Why Interviewers Ask This
Type safety tradeoff.
Answer
JS: faster start, dynamic. TS: compile-time types, better tooling, safer refactors. TS compiles to JS.
Example
Hackathon β JS. Team project 10+ files β TS pays off.
Follow-up Questions
- Gradual TS?
- Runtime validation still needed?
- any escape hatch?
Common Mistakes
TS eliminates all bugs; refusing TS on tiny script.
Project Connection
Would you migrate your project β what files first?
Question: SQL vs MongoDB
Difficulty
π‘ Medium
Why Interviewers Ask This
The classic database comparison.
Answer
SQL: tables, relations, ACID, joins. MongoDB: documents, flexible schema, embed related data, scale-out.
Example
Orders + payments β SQL. Content feed with varied metadata β Mongo.
Follow-up Questions
- Transactions in Mongo?
- Mongoose schemas?
- When hybrid?
Common Mistakes
Mongo because βJSONβ with heavy relational queries.
Project Connection
Your DB and one query that fits its model well.
Question: JWT vs Session cookies
Difficulty
π‘ Medium
Why Interviewers Ask This
Auth architecture staple.
Answer
JWT: stateless, client stores token, hard to revoke. Session: server state, easy logout/revoke, cookie-based.
Example
SPA mobile API β JWT + refresh. Server-rendered web app β session cookie httpOnly.
Follow-up Questions
- XSS implications?
- CSRF?
- Storage location?
Common Mistakes
JWT in localStorage without refresh strategy.
Project Connection
Your auth approach and one security measure.
Question: REST vs GraphQL
Difficulty
π‘ Medium
Why Interviewers Ask This
API design comparison.
Answer
REST: multiple endpoints, HTTP caching, simple. GraphQL: one endpoint, client picks fields, schema typed.
Example
CRUD blog β REST. Mobile + web different data needs β GraphQL.
Follow-up Questions
- Over-fetching?
- Versioning?
- Learning curve?
Common Mistakes
GraphQL for 4 endpoints.
Project Connection
Your REST endpoints; one that would be awkward in GraphQL.
Question: useState vs useReducer
Difficulty
π‘ Medium
Why Interviewers Ask This
React state pattern.
Answer
useState: simple independent values. useReducer: complex state transitions, multiple sub-values, predictable updates via actions.
Example
Counter β useState. Form with 10 fields + validation steps β useReducer.
Follow-up Questions
- When Redux over both?
- Initializer function?
- Performance?
Common Mistakes
useReducer for a single boolean.
Project Connection
Complex state in your app β which hook and why.
Question: useEffect vs React Query
Difficulty
π‘ Medium
Why Interviewers Ask This
Server state separation.
Answer
useEffect: side effects, manual fetch, you handle cache/loading. React Query: built for server data β cache, refetch, dedupe.
Example
Document title sync β useEffect. API list with pagination β React Query.
Follow-up Questions
- Stale time?
- Mutations?
- SSR?
Common Mistakes
useEffect fetch copy-pasted in 5 components.
Project Connection
If you fetch in useEffect, what pain React Query would remove.
Question: Props vs Context
Difficulty
π’ Easy
Why Interviewers Ask This
React data passing.
Answer
Props: parent to child explicit. Context: avoid drilling through many layers for global-ish data.
Example
Button label β props. Theme/locale β Context.
Follow-up Questions
- Performance?
- When Redux?
- Split contexts?
Common Mistakes
Context for every piece of state.
Project Connection
What you put in Context vs props in your app.
Question: CSS Flexbox vs Grid
Difficulty
π’ Easy
Why Interviewers Ask This
Layout comparison for frontend.
Answer
Flexbox: 1D layout (row OR column), alignment, nav bars. Grid: 2D rows+columns, page layouts, card grids.
Example
Navbar β Flex. Dashboard grid β Grid.
Follow-up Questions
- Can combine?
- When floats?
- Responsive patterns?
Common Mistakes
Grid for everything; Flex for full page layout without Grid areas.
Project Connection
Your layout: which tool for header vs card grid.
Question: GET vs POST
Difficulty
π’ Easy
Why Interviewers Ask This
HTTP fundamentals.
Answer
GET: retrieve, idempotent, cacheable, params in URL. POST: create/submit, body payload, not idempotent.
Example
GET /api/users?page=1. POST /api/users with JSON body.
Follow-up Questions
- PUT vs POST?
- GET with body?
- Safe methods?
Common Mistakes
POST for everything; GET that mutates data.
Project Connection
Map your projectβs methods to CRUD operations.
Question: PUT vs PATCH
Difficulty
π‘ Medium
Why Interviewers Ask This
Update semantics.
Answer
PUT: replace entire resource. PATCH: partial update.
Example
PUT /users/1 with full user object. PATCH with { name: βNewβ } only.
Follow-up Questions
- Idempotent?
- Which more common?
- Validation?
Common Mistakes
Using them interchangeably.
Project Connection
How your API updates a user profile.
Question: npm vs yarn vs pnpm
Difficulty
π’ Easy
Why Interviewers Ask This
Package manager awareness.
Answer
All install JS packages. npm default with Node. yarn: lockfile, parallel installs. pnpm: disk-efficient symlinks, strict node_modules.
Example
Team standardizes on one; lockfile committed.
Follow-up Questions
- package-lock?
- npx?
- Security audits?
Common Mistakes
Deleting lockfiles randomly.
Project Connection
Which you use; one dependency you added and why.
Question: LocalStorage vs SessionStorage vs Cookies
Difficulty
π‘ Medium
Why Interviewers Ask This
Client storage comparison.
Answer
localStorage: persistent, 5MB+, same-origin, no auto HTTP send. sessionStorage: per tab session. Cookies: sent with requests, size limit, httpOnly option for security.
Example
Theme preference β localStorage. Auth token debate β httpOnly cookie often safer than localStorage.
Follow-up Questions
- JWT where?
- GDPR?
- IndexedDB?
Common Mistakes
Storing passwords in localStorage.
Project Connection
What your app stores client-side and why.
Question: SSR vs CSR
Difficulty
π‘ Medium
Why Interviewers Ask This
Rendering strategy.
Answer
SSR: HTML on server per request, good SEO, faster first paint. CSR: browser renders, SPA feel, less server load.
Example
Marketing site β SSR/SSG. Logged-in dashboard β CSR fine.
Follow-up Questions
- Hydration?
- Next.js?
- TTFB vs TTI?
Common Mistakes
CSR for public blog needing SEO.
Project Connection
Your app: which pages could benefit from SSR.
Question: SSG vs SSR
Difficulty
π‘ Medium
Why Interviewers Ask This
Next.js specific nuance.
Answer
SSG: build-time HTML, CDN fast, stale until rebuild. SSR: per-request HTML, always fresh, more server work.
Example
Blog posts β SSG. User dashboard β SSR.
Follow-up Questions
- ISR?
- On-demand revalidation?
- Cost?
Common Mistakes
SSR for static content; SSG for personalized pages.
Project Connection
Classify one route in a Next app.
Question: Monolith vs Microservices
Difficulty
π‘ Medium
Why Interviewers Ask This
Architecture at student level.
Answer
Monolith: one deployable app. Microservices: many small services communicating over network.
Example
Student project β monolith. Scale/team pain β consider split.
Follow-up Questions
- Network failures?
- Docker?
- When to split?
Common Mistakes
Microservices day one for todo app.
Project Connection
Your app is a monolith β defend that choice.
Question: MongoDB embed vs reference
Difficulty
π‘ Medium
Why Interviewers Ask This
Schema design.
Answer
Embed: nested docs, one query, duplication risk. Reference: ObjectId pointer, normalize, need populate/join.
Example
Comments on post β embed if few. User on 1000 orders β reference.
Follow-up Questions
- Array size limit?
- Atomic updates?
- Duplication?
Common Mistakes
Embedding everything; 16MB doc limit surprise.
Project Connection
One relationship in your schema β embed or ref and why.
Question: Controlled vs uncontrolled inputs
Difficulty
π’ Easy
Why Interviewers Ask This
React forms.
Answer
Controlled: React state is source of truth. Uncontrolled: DOM holds value, ref to read.
Example
Validated form β controlled. Simple file input β often uncontrolled.
Follow-up Questions
- Performance?
- React Hook Form?
- Default values?
Common Mistakes
Mixing without knowing which owns value.
Project Connection
Your login form β controlled? Why?
Question: debounce vs throttle
Difficulty
π‘ Medium
Why Interviewers Ask This
Performance handlers.
Answer
Debounce: wait until pause (search input). Throttle: max once per interval (scroll handler).
Example
Search β debounce 300ms. Scroll position β throttle.
Follow-up Questions
- Implement how?
- Leading edge?
- use case wrong swap?
Common Mistakes
Same word for both; neither for button clicks.
Project Connection
Where youβd add debounce in your UI.
Question: async/await vs .then()
Difficulty
π’ Easy
Why Interviewers Ask This
Async style.
Answer
Same Promise underlying. async/await: synchronous-looking, try/catch errors. .then(): chaining, older style.
Example
async function load() { const d = await fetch(); }
Follow-up Questions
- Error handling?
- Parallel await?
- Callbacks vs promises?
Common Mistakes
await in loop sequentially when parallel possible.
Project Connection
Your API call β rewrite mentally with .then chain.
Question: var vs let vs const
Difficulty
π’ Easy
Why Interviewers Ask This
JS fundamentals.
Answer
var: function scoped, hoisted. let/const: block scoped. const: no reassignment (object mutable).
Example
Prefer const; let when reassign; avoid var.
Follow-up Questions
- Temporal dead zone?
- Hoisting interview snippet?
- const with objects?
Common Mistakes
const means immutable object.
Project Connection
Lint rule no-var in your project.
Question: Express vs Fastify
Difficulty
π‘ Medium
Why Interviewers Ask This
Node framework comparison.
Answer
Express: most popular, huge middleware. Fastify: faster benchmarks, schema validation built-in, growing ecosystem.
Example
Learning/portfolio β Express. Performance-sensitive API β consider Fastify.
Follow-up Questions
- Migration?
- Middleware compat?
- When raw http?
Common Mistakes
Speed claims without profiling.
Project Connection
You know Express β name one Fastify advantage to show awareness.
Question: Webpack vs Vite
Difficulty
π‘ Medium
Why Interviewers Ask This
Build tooling.
Answer
Webpack: bundles everything, flexible, slower dev cold start. Vite: ESM native dev, Rollup prod, faster HMR.
Example
Legacy app β Webpack. New Vite React template β Vite.
Follow-up Questions
- Next uses?
- Config complexity?
- Plugins?
Common Mistakes
Saying Webpack unused everywhere.
Project Connection
Your dev server startup β noticed Vite speed?
Question: OAuth vs own auth
Difficulty
π‘ Medium
Why Interviewers Ask This
Auth strategy.
Answer
OAuth: delegate to Google/GitHub, less password liability, faster signup. Own auth: full control, custom flows, more security responsibility.
Example
Side project β Google OAuth. Custom roles/billing β own auth + bcrypt.
Follow-up Questions
- Passport.js?
- JWT after OAuth?
- GDPR?
Common Mistakes
OAuth means you donβt need backend auth checks.
Project Connection
Your project: OAuth, email/password, or both.