Standalone & Modules Questions with Answers

6 practice questions on Standalone & Modules (Angular) with answers and step-by-step solutions. Try 6 samples below, then practise all 6 free in the AptiNest app.

Sample questions

Question 1Easy

In an NgModule, which property lists components, directives and pipes that belong to it?

  1. providers, which lists services for the module injector
  2. exports
  3. declarations
  4. bootstrap, which names the root component

Answer: C. declarations

Explanation

declarations registers module-owned view classes.

Step-by-step solution

  1. Name the property.

Why the other options are wrong

  • A. providers registers services, not the components of the module.
  • B. Visible to other modules.
  • D. bootstrap names the root component; it lists no declared items.

Question 2Easy

What does standalone: true on a component mean?

  1. It cannot have a template
  2. It declares its own imports and needs no NgModule
  3. It must be lazy loaded
  4. 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

  1. 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?

  1. platformBrowser.run
  2. bootstrapApplication
  3. startApp
  4. ngBootstrap

Answer: B. bootstrapApplication

Explanation

main.ts calls bootstrapApplication(AppComponent, config).

Step-by-step solution

  1. 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 4Medium

Which NgModule property makes declared items usable by modules importing this one?

  1. exports
  2. declarations
  3. entry
  4. imports

Answer: A. exports

Explanation

Only exported items are visible outside the module.

Step-by-step solution

  1. Visible outside.

Why the other options are wrong

  • B. declarations keep items inside the module; exports shares them.
  • C. entry is not the property that makes items importable elsewhere.
  • D. imports brings in other modules; it does not expose this module's items.

Question 5Medium

Which provider function registers HttpClient in a standalone app config?

  1. provideHttpClient()
  2. importHttp() as a helper
  3. useHttp() as a helper
  4. registerHttp() as a helper

Answer: A. provideHttpClient()

Explanation

Add it to providers in app config.

Step-by-step solution

  1. provide* helpers.

Why the other options are wrong

  • B. importHttp is not an Angular function; provideHttpClient registers it.
  • C. useHttp is not an Angular function for registering HttpClient.
  • D. registerHttp is not an Angular provider function.

Question 6Hard

A standalone component uses <app-card> but its imports array omits CardComponent. What happens?

  1. It works automatically because Angular scans the template for components
  2. The element is ignored silently
  3. The compiler reports an unknown element error for app-card
  4. 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

  1. 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.

Practise all 6 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Angular topics · All topics