21.) What is the purpose of ngAfterViewInit() lifecycle hook?
A) It initializes the component
B) It runs after the component’s view has been initialized
C) It executes before the component is destroyed
D) It checks for data changes
22.) Which of the following is NOT a valid way to share data between Angular components?
A) Using local storage
B) Using @Output()
C) Using @Input()
D) Using a shared service
23.) How does Angular detect changes in a component?
A) It manually scans the entire application
B) It listens to browser events
C) It uses a change detection mechanism that checks for state updates
D) It waits for the user to refresh the page
24.) What does @ViewChild() do in Angular?
A) Allows a component to access a child component or DOM element
B) Creates a new child component dynamically
C) Passes data from a parent component to a child component
D) Manages event listeners in the DOM
25.) Which decorator is used for dependency injection in Angular?
A) @Output
B) @Component
C) @Directive
D) @Injectable
Related