Question 2Easy
What does standalone: true on a component mean?
- It cannot have a template
- It declares its own imports and needs no NgModule
- It must be lazy loaded
- It cannot use services
Answer: B. It declares its own imports and needs no NgModule
Explanation
Standalone components import dependencies directly.
Step-by-step solution
- No NgModule needed.
Why the other options are wrong
- A. Standalone components still have templates, like any component.
- C. Standalone does not require lazy loading; it is optional.
- D. Standalone components can inject services like any component.
Question 3Medium
Which function bootstraps a standalone root component?
- platformBrowser.run
- bootstrapApplication
- startApp
- ngBootstrap
Answer: B. bootstrapApplication
Explanation
main.ts calls bootstrapApplication(AppComponent, config).
Step-by-step solution
- Standalone bootstrap.
Why the other options are wrong
- A. platformBrowser.run is not an API; bootstrapApplication is the call.
- C. startApp is not an Angular bootstrap function.
- D. ngBootstrap is not a real Angular bootstrap function.
Question 6Hard
A standalone component uses <app-card> but its imports array omits CardComponent. What happens?
- It works automatically because Angular scans the template for components
- The element is ignored silently
- The compiler reports an unknown element error for app-card
- It is loaded lazily
Answer: C. The compiler reports an unknown element error for app-card
Explanation
Each standalone component imports what its template uses.
Step-by-step solution
- Imports are local.
Why the other options are wrong
- A. Angular does not scan templates to auto-import standalone components.
- B. Unknown elements are not ignored silently; Angular reports an error.
- D. Missing imports are not loaded lazily; the compiler reports an error.