Angular JS

Angular JS

Test your Angular JS knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What command creates a new Angular project using the CLI?

    • ng make
    • ng new
    • ng init
    • ng start
  2. What is the main building block of Angular?

    • Module
    • Directive
    • Component
    • Template
  3. Which file defines the root module in Angular?

    • main.ts
    • index.html
    • app.component.ts
    • app.module.ts
  4. Which symbol is used for interpolation in Angular?

    • {{ }}
    • [[ ]]
    • (( ))
    • <%= %>
  5. What directive is used to loop over a list in Angular?

    • *ngIf
    • *ngSwitch
    • *ngFor
    • ngRepeat
  6. Which lifecycle hook is called after Angular sets all input properties?

    • ngInit
    • ngOnInit
    • ngAfterContentInit
    • ngOnChanges
  7. Which lifecycle hook is typically used to initialize data in a component?

    • ngOnInit
    • ngAfterViewInit
    • ngDestroy
    • ngStart
  8. What decorator is used to access child components in a template?

    • @Input
    • @Output
    • @ViewChild
    • @HostBinding
  9. Which directive allows projection of content into a component?

    • ng-content
    • *ngFor
    • *ngIf
    • ng-template
  10. Which RxJS operator is used to switch to a new observable and cancel the previous one?

    • map
    • mergeMap
    • switchMap
    • filter
  11. What is the benefit of using forRoot() in a module?

    • Loads child routes
    • Provides lazy loading
    • Configures and provides singleton services
    • Adds animations
  12. What does lazy loading in Angular improve?

    • Styling
    • Testing
    • Performance by reducing bundle size
    • Form validation
  13. Which strategy can preload selected modules after app load?

    • Lazy loading
    • PreloadAllModules
    • NoPreloading
    • Eager loading
  14. What does switchMap do in RxJS?

    • Maps to array
    • Cancels previous observable
    • Combines observables
    • Retries observable
  15. Which RxJS subject emits the last emitted value to new subscribers?

    • Subject
    • ReplaySubject
    • BehaviorSubject
    • AsyncSubject