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

  1. 8.1 Angular components and templates
  2. 8.2 Angular signals and change detection
  3. 8.3 Angular DI, routing and forms
  4. 8.4 RxJS in Angular
  5. 8.5 Angular tooling, SSR and modern features
  6. 8.6 Vue reactivity and the Composition API
  7. 8.7 Vue templates, directives and components
  8. 8.8 Vue Router, Pinia, Nuxt and the ecosystem
  9. 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

  1. In Angular, what does the `@Component` decorator define?

    1. A pipe that formats values inside templates
    2. A class plus metadata: its selector, template and styles
    3. A service that's shared across the whole application
    4. 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.

  2. What does Zone.js do in a traditional Angular app?

    1. Handles routing between the app's pages and lazy routes
    2. Compiles component templates into JavaScript at runtime
    3. Patches async APIs so Angular knows when to run change detection
    4. 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.

  3. How does a component get an instance of a service in Angular?

    1. By calling `new MyService()` in every component that needs it
    2. Dependency injection: the constructor or `inject(MyService)`
    3. By importing a global variable exported from the service file
    4. 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.

  4. What is an Observable?

    1. A lazy stream of values that runs only once subscribed
    2. A browser API built into every JavaScript engine
    3. A promise that resolves several times, all immediately
    4. 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.

  5. What does `@defer` do in an Angular template?

    1. Postpones a route guard until navigation ends
    2. Defers change detection until the next frame
    3. Lazily loads a block's components when a trigger fires
    4. 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`.

  6. In Vue 3's Composition API, what does `ref(0)` return?

    1. A reactive reference, read and written via `.value`
    2. A reference to the component's first DOM element
    3. A read-only constant that can't be reassigned
    4. 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.

  7. What is `v-model` on an input?

    1. A helper for CSS transitions on inputs
    2. A directive that reads the value only once
    3. Two-way binding between the input and a value
    4. 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()`).

  8. What is Pinia?

    1. A build tool that replaces Vite for Vue
    2. Vue's official client-side router
    3. Vue's official state management library
    4. Vue's official component testing library

    Answer: C. Vue's official state management library Pinia replaced Vuex as the recommended store.

  9. What's a key difference between Angular and Vue?

    1. Angular has built-in DI, routing and forms; Vue is progressive
    2. Angular uses JSX for its views, while Vue uses templates
    3. Vue has dependency injection built in, while Angular doesn't
    4. 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.

  10. What does `[value]="name"` do in an Angular template?

    1. Two-way binding between the input and the `name` field
    2. Event binding: calls `name()` whenever the value changes
    3. Sets a static attribute with the literal text "name"
    4. 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.

Practice all 261 questions

More Front End