frontend for java full stack development coursera week 3 answers

Angular Components - Practice Quiz

1. What is the purpose of Angular decorators in Angular framework?

  • To define the styles for Angular components
  • To encapsulate the logic and data of Angular components
  • To configure the behavior and metadata of Angular components
  • To create reusable UI components in Angular applications

2. Which of the following is not a lifecycle hook in Angular?

  • ngOnInit
  • ngOnChanges
  • ngOnDestroy
  • ngAfterViewUpdate

3. Which of the following is NOT a type of decorator in Angular?

  • @Component
  • @Directive
  • @Module
  • @Service

4. Which of the following is NOT a comparison operator in JavaScript?

  • ==
  • ===
  • !=
  • <> (Correct Answer)

Angular Databinding - Practice Quiz

5. What is Angular Data Binding?

  • A process of connecting Angular application with an external API.
  • A way to define data types in Angular application.
  • A technique to share data between components in an Angular application.
  • A mechanism to automatically synchronize data between the view and the model in an Angular application.

6. What is Angular Two-way Data Binding?

  • A technique to bind data from the model to the view only.
  • A technique to bind data from the view to the model only.
  • A technique to automatically synchronize data between the view and the model in both directions.
  • A technique to manually synchronize data between the view and the model in both directions.

7. What is Angular Event Binding?

  • A technique to automatically synchronize data between the view and the model.
  • A technique to bind data from the model to the view only.
  • A technique to bind data from the view to the model only.
  • A technique to handle events in the view and trigger actions in the component.

Angular Directives - Practice Quiz

8. What are Angular Directives?

  • A way to style elements in Angular.
  • Instructions to modify the DOM or behavior of HTML elements in Angular.
  • A way to define Angular components.
  • A way to define Angular modules.

9. What is Angular ngIf Directive?

  • A directive used to apply styles to elements in Angular.
  • A directive used to modify the DOM structure in Angular.
  • A structural directive used to conditionally render or remove elements from the DOM in Angular.
  • A directive used to define custom elements in Angular.

10. What is Angular ngFor Directive?

  • A directive used to apply styles to elements in Angular.
  • A directive used to repeat elements in the DOM based on an array in Angular.
  • A directive used to modify the DOM structure in Angular.
  • A directive used to define custom elements in Angular.

11. What is Angular ngStyle Directive?

  • A directive used to apply styles to elements in Angular.
  • A directive used to modify the DOM structure in Angular.
  • A directive used to repeat elements in the DOM based on an array in Angular.
  • A directive used to define custom elements in Angular.

Angular - Graded Quiz

12. What is an Angular pipe?

  • A type of plumbing used to transport data between Angular components.
  • A feature of Angular used to transform data before displaying it in the template.
  • A tool used to debug Angular applications.
  • A mechanism for passing data from a parent component to a child component.

13. Which of the following is NOT a valid Angular form control state?

  • untouched
  • dirty
  • valid
  • selected

14. What is an Angular template-driven form?

  • A form that is generated automatically based on a data model.
  • A form that is defined in the component template using Angular directives and binding.
  • A form that is defined in the component class using TypeScript code.
  • A form that is submitted using the Angular HttpClient module.

15. What is the purpose of the "ngModel" directive in Angular forms?

  • To define the structure of the form data model.
  • To define the validation rules for a form control.
  • To bind a form control to a property on the component class.
  • To submit the form data to the server using the Angular HttpClient module.

16. Which of the following is NOT a valid built-in validator for Angular forms?

  • required
  • email
  • pattern
  • alphanumeric

17. What is the difference between template-driven forms and reactive forms in Angular?

  • Template-driven forms are built using a template syntax, while reactive forms are built using reactive programming techniques.
  • Template-driven forms are used for simple forms with few fields, while reactive forms are used for more complex forms with many fields.
  • Template-driven forms are mainly driven by the component’s template, while reactive forms are mainly driven by the component’s TypeScript code.
  • Template-driven forms do not support form validation, while reactive forms provide robust form validation features.

18. What is a pipe in Angular?

  • A data structure used to hold values that can be accessed from anywhere in the application.
  • A component that is used to render a specific portion of the user interface.
  • A way to transform data in the template before rendering it.
  • A built-in Angular module used for adding custom CSS styles to the application.

19. Which of the following is NOT a built-in Angular validator for forms?

  • required
  • email
  • pattern
  • unique

20. Which of the following is NOT a valid Angular form control status?

  • pristine
  • dirty
  • touched
  • inactive

21. Which of the following is NOT a built-in Angular pipe?

  • uppercase
  • date
  • currency
  • capitalize

22. What is the purpose of the "ngSubmit" directive in Angular forms?

  • To disable the form submission.
  • To specify the HTTP method to be used for the form submission.
  • To define the form fields and their validation rules.
  • To bind a method to the form submission event.

Leave a Reply