Loading

Quipoin Menu

Learn • Practice • Grow

angular / Performance Optimization
mcq
Direction: Choose the correct option

Q1.

What is change detection in Angular?
A. A way to detect changes
B. The mechanism that updates the view when component data changes
C. A debugging tool
D. A performance tool
Direction: Choose the correct option

Q2.

What is the `OnPush` change detection strategy?
A. Disables change detection
B. Faster than default
C. Checks constantly
D. Only checks the component when its @Input changes or events occur
Direction: Choose the correct option

Q3.

How do you enable `OnPush` strategy?
A. `onPush: true`
B. `strategy: OnPush`
C. `changeDetection: ChangeDetectionStrategy.OnPush` in @Component
D. `detection: 'OnPush'`
Direction: Choose the correct option

Q4.

What is lazy loading's role in performance?
A. Reduces initial bundle size by loading modules on demand
B. Loads all modules at once
C. Optimizes images
D. Speeds up compilation
Direction: Choose the correct option

Q5.

What is `trackBy` used for in `*ngFor`?
A. To track events
B. To track errors
C. To track performance
D. To optimize rendering of lists by tracking item identity
Direction: Choose the correct option

Q6.

What is the role of `pure` pipes in performance?
A. Pure pipes are faster
B. No impact
C. Pure pipes are only executed when input values change, reducing computation
D. Impure pipes are better
Direction: Choose the correct option

Q7.

How does `ChangeDetectorRef` help with performance?
A. Detects changes
B. Allows manual control over change detection
C. Controls changes
D. Refreshes changes
Direction: Choose the correct option

Q8.

What is the purpose of `runOutsideAngular` in `NgZone`?
A. To run code outside Angular's change detection
B. To run code outside zone
C. All of the above
D. To optimize performance
Direction: Choose the correct option

Q9.

What is the impact of too many DOM elements in a template?
A. Faster rendering
B. Slows down rendering and change detection
C. Better performance
D. No impact
Direction: Choose the correct option

Q10.

What is the purpose of `defer` in Angular (coming in future versions)?
A. To defer loading of non-critical resources
B. To defer change detection
C. To defer rendering
D. To defer execution