State management is crucial in large Angular applications, ensuring data consistency and improving performance. RxJS and NgRx are widely used for handling state efficiently. These MCQs will help you prepare for interviews by covering key concepts like observables, stores, actions, reducers, effects, and selectors in Angular.
1.) What is the primary purpose of RxJS in Angular?
A) To create CSS animations
B) To handle asynchronous data streams
C) To replace JavaScript completely
D) To write SQL queries
2.) What is an observable in RxJS?
A) A function that synchronously executes code
B) A design pattern for object-oriented programming
C) A stream of values emitted over time
D) A storage mechanism for data persistence
3.) What does the subscribe() method do in RxJS?
A) Triggers an observable to execute
B) Cancels an observable
C) Converts an observable into a promise
D) Stores an observable in local storage
4.) What is NgRx used for in Angular?
A) To create dynamic forms
B) To manage application state using Redux principles
C) To store static assets
D) To improve routing performance
5.) Which core concept of NgRx holds the entire application state?
A) Actions
B) Reducers
C) Store
D) Effects
6.) What are NgRx actions?
A) A way to trigger state changes
B) A replacement for services
C) UI components for animations
D) A function that filters observables
7.) What is the role of reducers in NgRx?
A) They reduce API call latency
B) They modify the application state based on actions
C) They filter unnecessary UI components
D) They increase application security
8.) What is an effect in NgRx?
A) A method to modify the UI
B) A component lifecycle hook
C) A state variable
D) A service that handles side effects like API calls
9.) How do you select data from the NgRx store?
A) Using store.dispatch()
B) Using store.select()
C) Using store.getState()
D) Using store.reduce()
10.) Which operator is commonly used with NgRx effects for handling API calls?
A) debounceTime()
B) map()
C) take(1)
D) switchMap()
Related