Angular and Vue basics – Front End interview prep
261 interview-style multiple-choice questions on Angular and Vue basics, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 50 key terms with the flashcards first, then test yourself.
Take the practice test · Flashcards · All study tools
What it covers
- 8.1 Angular components and templates
- 8.2 Angular signals and change detection
- 8.3 Angular DI, routing and forms
- 8.4 RxJS in Angular
- 8.5 Angular tooling, SSR and modern features
- 8.6 Vue reactivity and the Composition API
- 8.7 Vue templates, directives and components
- 8.8 Vue Router, Pinia, Nuxt and the ecosystem
- 8.9 Comparing and choosing front-end frameworks
Key terms
8.1 Angular components and templates
- Property binding
- [prop]="expr": sets a DOM or component property from the class
- Event binding
- (event)="handler()": runs code when an event fires
- Standalone component
- An Angular component that lists its own imports without an NgModule
- Pipe
- Template transform for display, used with the
- Interpolation
- {{ }} syntax that renders a value as text
- Control flow block
- Built-in @if, @for and @switch syntax
- Content projection
- Rendering parent-provided markup with ng-content
- Signal input
- Component input exposed as a read-only signal
8.2 Angular signals and change detection
- Zoneless
- Angular change detection without Zone.js
- effect
- Angular function running side effects when read signals change
- toSignal
- Converts an Observable into a signal
8.3 Angular DI, routing and forms
- Dependency injection
- The framework creates and supplies a class's dependencies instead of the class creating them
- Zone.js
- Library that patches async APIs so Angular knows when to check for changes
- OnPush
- Change detection strategy that checks a component only when its inputs or signals change
- Signal (Angular)
- A reactive value with fine-grained dependency tracking
- inject()
- Function that gets a dependency in an injection context
- InjectionToken
- Token for injecting non-class values
- Reactive form
- Form model defined in code with FormControl and FormGroup
- Functional interceptor
- (req, next) function that wraps HTTP requests
8.4 RxJS in Angular
- Observable
- A lazy, cancellable stream of values over time
- switchMap
- Maps to an inner observable and cancels the previous one when a new value arrives
- BehaviorSubject
- A subject with a current value that new subscribers receive immediately
- async pipe
- Angular pipe that subscribes, renders the latest value and unsubscribes
- Cold Observable
- Observable that starts work for each subscriber
- exhaustMap
- Operator ignoring new values while an inner stream runs
- shareReplay
- Shares one subscription and replays recent values
- takeUntilDestroyed
- Completes a stream when its owner is destroyed
8.5 Angular tooling, SSR and modern features
- @defer
- Template block that lazy-loads its content on a trigger
- Incremental hydration
- Hydrating deferred blocks only when triggered
- Angular CDK
- Toolkit of behavior primitives for components
- Schematic
- CLI code generator or migration
8.6 Vue reactivity and the Composition API
- Composable
- Function sharing stateful logic with the Composition API
- toRefs
- Converts reactive properties into refs
- watchEffect
- Effect that runs immediately and tracks what it reads
- shallowRef
- Ref that tracks only .value replacement
8.7 Vue templates, directives and components
- ref
- Vue reactive reference to a value, accessed through .value in script
- computed
- A cached derived value that updates when its dependencies change
- v-model
- Vue directive for two-way binding of form inputs and components
- Pinia
- The official Vue state management library
- Scoped slot
- Slot where the child passes data to the parent's template
- defineModel
- Macro for v-model on custom components
- Teleport
- Renders content elsewhere in the DOM
- Fallthrough attributes
- Non-prop attributes passed to the root element
8.8 Vue Router, Pinia, Nuxt and the ecosystem
- Nuxt
- Full-stack Vue framework with SSR
- Navigation guard
- Router hook that allows, redirects or cancels navigation
- vue-tsc
- Type checker for .vue files
8.9 Comparing and choosing front-end frameworks
- Meta-framework
- Framework adding routing, SSR and data loading on top of a UI library
- Islands architecture
- Static HTML with separately hydrated interactive parts
- Angular Elements
- Packages Angular components as custom elements
- Resumability
- Continuing an app on the client without hydration
Sample practice questions
In Angular, what does the `@Component` decorator define?
- A pipe that formats values inside templates
- A class plus metadata: its selector, template and styles
- A service that's shared across the whole application
- A route guard that protects navigation to a page
Answer: B. A class plus metadata: its selector, template and styles Components pair a TypeScript class with a template that renders its state.
What does Zone.js do in a traditional Angular app?
- Handles routing between the app's pages and lazy routes
- Compiles component templates into JavaScript at runtime
- Patches async APIs so Angular knows when to run change detection
- Stores application state across browser tabs
Answer: C. Patches async APIs so Angular knows when to run change detection Newer Angular versions can run "zoneless", relying on signals and explicit notifications instead.
How does a component get an instance of a service in Angular?
- By calling `new MyService()` in every component that needs it
- Dependency injection: the constructor or `inject(MyService)`
- By importing a global variable exported from the service file
- By reading it from a `window.services` registry
Answer: B. Dependency injection: the constructor or `inject(MyService)` The injector creates and caches instances based on where the service is provided.
What is an Observable?
- A lazy stream of values that runs only once subscribed
- A browser API built into every JavaScript engine
- A promise that resolves several times, all immediately
- A synchronous array with a few extra methods
Answer: A. A lazy stream of values that runs only once subscribed Unlike a promise, an observable can emit many values and can be cancelled by unsubscribing.
What does `@defer` do in an Angular template?
- Postpones a route guard until navigation ends
- Defers change detection until the next frame
- Lazily loads a block's components when a trigger fires
- Delays rendering until the server responds
Answer: C. Lazily loads a block's components when a trigger fires Triggers include `on viewport`, `on idle` and `on interaction`.
In Vue 3's Composition API, what does `ref(0)` return?
- A reactive reference, read and written via `.value`
- A reference to the component's first DOM element
- A read-only constant that can't be reassigned
- A plain number that Vue copies on every render
Answer: A. A reactive reference, read and written via `.value` `reactive()` makes an object deeply reactive without `.value`, but can't hold primitives.
What is `v-model` on an input?
- A helper for CSS transitions on inputs
- A directive that reads the value only once
- Two-way binding between the input and a value
- A way to render a list of input elements
Answer: C. Two-way binding between the input and a value On components, `v-model` maps to a `modelValue` prop and an `update:modelValue` event (or `defineModel()`).
What is Pinia?
- A build tool that replaces Vite for Vue
- Vue's official client-side router
- Vue's official state management library
- Vue's official component testing library
Answer: C. Vue's official state management library Pinia replaced Vuex as the recommended store.
What's a key difference between Angular and Vue?
- Angular has built-in DI, routing and forms; Vue is progressive
- Angular uses JSX for its views, while Vue uses templates
- Vue has dependency injection built in, while Angular doesn't
- Vue requires TypeScript, while Angular makes it optional
Answer: A. Angular has built-in DI, routing and forms; Vue is progressive Vue adds official libraries as needed.
What does `[value]="name"` do in an Angular template?
- Two-way binding between the input and the `name` field
- Event binding: calls `name()` whenever the value changes
- Sets a static attribute with the literal text "name"
- Property binding: sets `value` from `name`, class to view
Answer: D. Property binding: sets `value` from `name`, class to view Square brackets bind properties, parentheses bind events, and `[(ngModel)]` combines both.
More Front End
- HTML semantics & accessibility
- CSS: box model, Flexbox, Grid
- JavaScript fundamentals
- Async JavaScript & the event loop
- TypeScript
- React: components, hooks & rendering
- State management: Redux, Zustand, context
- Browser internals & rendering
- Web performance
- Build tools & bundlers
- Front-end testing
- Front-end security
- Mobile & cross-platform