Angular Architecture & Modules Quiz – 20 Questions with Answers
20 questions · 15 min · Medium
Test your knowledge of state management with NgRx in Angular, including Store, Actions, Reducers, Selectors, Effects, state updates, asynchronous operations, and Redux principles.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
A. To manage application state in a predictable way
NgRx provides state management tools that help applications maintain predictable state updates and share state across components.
B. @ngrx/store
The @ngrx/store library provides the Store, Actions, Reducers, and Selectors used for reactive state management.
A. To describe an event or intention that occurred
An NgRx Action describes an event, such as a user interaction or an API response, that may cause state to change.
B. To calculate a new state from the current state and an action
A reducer is a pure function that receives the current state and an action and returns the next state without mutating the existing state.
A. To extract or derive specific data from the Store
Selectors provide reusable ways to read and derive data from application state, and memoized selectors can avoid unnecessary recomputation.
B. @ngrx/effects
NgRx Effects handle side effects, such as HTTP requests, and can dispatch new Actions when asynchronous operations succeed or fail.
B. store.dispatch()
The dispatch() method sends an Action to the Store so registered reducers and effects can respond to it.
A. store.select()
The select() method creates an Observable of the selected state or derived data.
C. State updates produce new state values instead of mutating existing state
Immutable updates preserve existing state objects and return new state values, making state changes easier to track and reason about.
A. createAction()
The createAction() function creates an Action creator, optionally with a payload defined using props().
A. createReducer()
The createReducer() function defines state transition logic, commonly using on() to associate Actions with reducer handlers.
C. createSelector()
The createSelector() function creates selectors that can derive data and memoize their latest results when their input values have not changed.
A. switchMap()
switchMap() switches to the latest inner Observable. Other operators, such as mergeMap() or concatMap(), may be more appropriate depending on the required concurrency behavior.
A. To indicate that the asynchronous operation completed successfully and provide its result
A success Action commonly carries the API result so a reducer can update the Store with the returned data.
B. It provides centralized, predictable state management and improves traceability
NgRx makes shared application state and state transitions easier to organize, test, debug, and trace across complex applications.