Quiz
Q21-Q40
This quiz has a time limit, so it opens in the usual player.
Questions in this quiz (9)
1Q21. What are the HostListener decorators and the HostBinding decorator doing in this directive?

- AThey are setting the CalloutDirective.fontWeight field based on whether or not the mouse is over the DOM element. The HostListener then sets the font-weight CSS property to the fontWeight value.
- BThey are setting up the directive to check the DOM element that it is on. If it has event bindings added for mouse enter and leave it will use this code. Otherwise nothing will happen.
- CThis is an incorrect use of HostListener and HostBinding. The HostListener and HostBinding decorators do not do anything on directives; they work only when used on components.
- DIf the DOM element that this directive is placed on has the CSS property font-weight set on it, the mouseenter and mouseleave events will get raised.
2Q22. What Angular template syntax can you use on this template-driven form field to access the field value and check for validation within the template markup?
<input type="text" ngModel name="firstName" required minlength="4" />
<span *ngIf="">Invalid field data</span>- AYou can make use of a template reference variable and the exportAs feature that the ngModel directive has.
- BYou can use the ngModel directive in combination with the input field name.
- CYou can use a template reference variable for the HTML input element and then check the valid property off of that.
- DIt is not possible to get access to the field value with template-driven forms. You must use reactive forms for that.
3Q23. What is the value type that will be stored in the headerText template reference variable in this markup?
<h1 #headerText>User List</h1>- Aan Angular ElementRef, a wrapper around a native element
- Bthe inner text of the <h1> element
- Ca header component class
- Dthe native DOM element type of HTMLHeadingElement
4Q24. What is the difference, if any, of the resulting code logic based on these two provider configurations?
[{ provide: FormattedLogger, useClass: Logger }][{ provide: FormattedLogger, useExisting: Logger }];- AThey are the same. Both will result in a new instance of Logger that is bound to the FormattedLogger token.
- BThe useClass syntax tells the injector to make a new instance of Logger and bind that instance to the FormattedLogger token. The useExisting syntax refers to an already existing object instance declared as Logger.
- CBoth of them are wrong. A strong type connot be used for useClass or useExisting.
- DThey are the same. Both will result in the FormattedLogger token being an alias for the instance of Logger.
5Q25. What is the purpose of the data property (seen in the example below) in a route configuration?

- Aa key/value mapping for setting @Input values on the routed component instance
- Ba way to include static, read-only data associated with the route that can be retrieved from the ActivatedRoute
- Ca property on the route that can be used to load dynamic data for the route
- Dan object that will get auto-injected into the routed component's constructor.
6Q26. How does the built-in ngIf structural directive change the rendered DOM based on this template syntax?

- AThe <div> acts as a placeholder. If the product class field is "truthy," the <div> will get replaced by just the product.name value; if not, then nothing will get rendered.
- BThe <div> will always be rendered, and if the product field is "truthy," the <div> element will contain the product.name value; otherwise it will render the <div> element with no value in it.
- CIt produces an error, since ngIf is not a built-in structural directive.
- DIf the product class field is "truthy," then the rendered DOM will include the <div> with the value of the product.name field. If it is not "truthy,' the rendered DOM will not contain the <div> element.
7Q27. What does this code accomplish?

- AIt executes a unit test for an NgModule.
- BIt provides a way to code the document structure of an Angular application. The @NgModule is a form of inline code commenting that gets ignored by the TypeScript compiler but will show up with special formatting in code editor applications.
- CIt declares an Angular module named AppModule and makes it available for lazy loading throughout the application.
- DIt declares an Angular module named AppModule that contains a bootstrapped component named AppComponent. Then it registers that module with Angular, so the app can start up.
8Q28. Which choice best describes what the resolve property does in this route configuration?

- APrior to loading the UserComponent, the router will subscribe to the Observable returned by a resolve method in the UserResolverService. This technique can be used to get preloaded data for a route.
- BAfter the route is done resolving, and the component is loaded and rendered, the UserResolverService will have a method named user run that will clean up any open data connections.
- CThere is an error. The correct property name is onResolve.
- DThe UserComponent will have a parameter in its constructor for user, and the router will handle injecting in a value for that from a call to a user method in the UserResolverService.
9Q29. What is the purpose of the ContentChildren decorator in this component class?

- AIf any TabsComponent elements are added to the TabsListComponent template, they will get put into the element at runtime.
- BIt creates TabComponent components in the TabsListComponent template when a TabsListComponent is instantiated.
- CIt provides access from within the component class to any TabComponent components that were content projected into the for this component.
- DIt restricts the allowed elements that can be put into a TabsListComponent element to allow only TabComponent elements.
Information
- Description
- Angular Linkedin Assessments Test Quiz on Q21-Q40, created by Nouri Atef on 17/07/2022.
- Author
- Nouri Atef
- Language
- English
- Views
- 0
- Tags
- Rating
- No ratings yet Rate this quiz