Sample questions
Angular Change DetectionDifficulty 1
What is Zone.js's core job in a classic (non-zoneless) Angular application?
- aIt monkey-patches async APIs (
setTimeout, DOM events, Promise, XHR) so Angular knows when to run change detection✓ - bIt replaces Angular's renderer entirely, writing straight to DOM nodes and skipping the framework's own view layer for speed
- cIt's a build-time compiler pass that turns templates and decorators into plain JavaScript before the app ships
- dIt's an HTTP interceptor that caches responses across services and components to cut down on network calls
Explanation:Zone.js patches common async browser APIs. Whenever one of them fires (a timer, an event, a resolved promise), Zone.js notifies Angular so it can trigger a change detection pass — without this, Angular would have no automatic signal that application state might have changed.
Angular Change DetectionDifficulty 1
If every component in an Angular tree explicitly uses ChangeDetectionStrategy.Eager (called Default before Angular 22), which components does a change detection cycle check?
- aOnly the components whose
@Input bindings happened to change since the last cycle - bEvery component in the tree, from the root downward✓
- cOnly the components currently scrolled into the visible viewport
- dOnly the root component itself, ignoring its children entirely
Explanation:In an all-Eager tree, Angular walks the component tree top-to-bottom on every CD cycle and re-checks each view's template bindings. Default is the deprecated legacy alias for Eager; since Angular 22, an unspecified component strategy is OnPush, so the question explicitly opts every component into Eager.
Angular Change DetectionDifficulty 1
In one sentence, what does ChangeDetectionStrategy.OnPush do?
- aIt removes the component from change detection entirely, so its view is frozen at whatever it rendered the first time
- bIt only re-runs the component's check whenever one of its stylesheet rules or CSS classes changes
- cIt limits checks to specific triggers, such as a changed input value, an event in its subtree, a template-read signal update,
AsyncPipe, or a manual notification✓ - dIt disables Zone.js for the whole application, so no component gets automatic async notifications anymore
Explanation:OnPush doesn't opt a component out of change detection — it narrows down WHEN it gets checked. A changed primitive input or a new object reference can trigger it, as can an event in its subtree, a signal consumed by its template, AsyncPipe, and explicit APIs such as markForCheck() or detectChanges().
Angular Change DetectionDifficulty 1
What is an Angular Signal (Angular 16+), at a basic level?
- aJust a newer name Angular introduced for an existing RxJS
Observable, with the exact same subscribe-based API - bA template-only piece of syntax that has no corresponding runtime object or value at all
- cA specialized API introduced only for configuring
HttpClient request caching and retries - dA reactive, synchronous wrapper around a value that tracks who reads it, so dependents can be notified when it changes✓
Explanation:A signal is a lightweight, synchronous primitive holding a value. When code reads a signal (e.g. inside a computed or template), Angular records that dependency, so it knows exactly what to update when the signal's value changes.
Angular Change DetectionDifficulty 1
How do you read the current value of a signal created with signal(0)?
- aCall it as a function:
mySignal()✓ - bAccess its
.value property, like a ref - cCall
.get() on it - dRead it directly like a plain variable, no call needed
Explanation:Signals are callable — invoking mySignal() returns its current value and, if called inside a reactive context (template, computed, effect), registers a dependency on it.
Angular Change DetectionDifficulty 1
What does calling ChangeDetectorRef.markForCheck() do?
- aIt synchronously renders the component and its whole subtree immediately, right when you call it
- bIt marks the component (even if
OnPush) as needing to be checked on the next change detection cycle✓ - cIt removes the component from the CD tree, the same effect as calling
detach() - dIt forces Zone.js to schedule and run one extra global change detection cycle across the entire app
Explanation:markForCheck() doesn't run change detection itself — it marks the view and the necessary ancestor path so a later change-detection traversal can reach and check it. In zoneless mode this call is also one of Angular's scheduler notification sources; detectChanges() is the API that performs an immediate local check.