Bird
0
0

Given this Angular module code, what will be the value of AppModule.bootstrap.length?

medium📝 component behavior Q13 of 15
Angular - Modules
Given this Angular module code, what will be the value of AppModule.bootstrap.length?
@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  bootstrap: [AppComponent]
})
export class AppModule {}
AError at runtime
B1
Cundefined
D0
Step-by-Step Solution
Solution:
  1. Step 1: Examine class properties after decorator

    The @NgModule decorator processes metadata internally but does not add a 'bootstrap' static property to the AppModule class.
  2. Step 2: Evaluate AppModule.bootstrap.length

    AppModule.bootstrap is undefined. Attempting .length on undefined throws a TypeError at runtime.
  3. Final Answer:

    Error at runtime -> Option A
  4. Quick Check:

    undefined.length = runtime error [OK]
Quick Trick: Decorators don't add class properties directly [OK]
Common Mistakes:
  • Thinking bootstrap becomes a class property
  • Confusing metadata access with class props
  • Assuming length 1 from config

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes