Internet Programming by Murach ( asp.net Core MVC) QUIZ

lambertminko
InternetProgrammingquiz.docx

1-MVC inspects the constructors of the objects it is preparing to inject and, if necessary, injects any objects needed by those objects in a process known as

core attribution

dependency chaining

coupling

dependency attribution

2-A controller that uses dependency injection to get a class that inherits the DbContext class is _____________ to EF.

idempotent

chained

loosely coupled

tightly coupled

3-To configure dependency injection, which method of the Startup.cs file should contain the code that maps the dependencies?

ConfigureServices()

the constructor

DependencyInject()

SingletonInject()

4-Which of the following is NOT a dependency life cycle

injectable

transient

singleton

scoped

5-Which HTML elements does the following tag helper class apply to?

[HtmlTargetElement("input", ParentTag = "form")]

public class MyInputTagHelper : TagHelper {...}

<my-input> elements coded within a form

<input> or <form> elements

<my-input> or <form> elements

<input> elements coded within a form

6-Which of the following is a tag helper element?

environment

asp-area

asp-controller

asp-action

7-Which of the following class declarations is for a custom tag helper for a standard HTML element?

public class ButtonTagHelper : StandardHtmlElement

public class ButtonTagHelper : TagHelper

public class StandardButtonTagHelper : HtmlElement

public class StandardButtonTagHelper : TagHelper

8-What does the following directive do?

@addTagHelper *, GuitarShop

It registers all tag helpers in the GuitarShop namespace.

It registers all tag helpers available from ASP.NET Core MVC.

It registers a tag helper named GuitarShop.

It registers a tag helper named *.

9-Which of the following is a good way to pass data to a view component?

By adding parameters to its Invoke() method

By using URL routing

By using its TempData property

By using a Razor code block

10-Given a Book object named book, which of the following passes the Book object as the model for the partial view named _BookLinkPartial?

<partial name="BookLinkPartial.cshtml" model="@book" />

<partial name="_BookLinkPartial" model="@book" />

<partial name="BookLinkPartial.cshtml" viewData="@book" />

<partial name="_BookLinkPartial" viewData="@book" />

11-A partial view typically contains _________________ that’s used by multiple views.

HTML and Razor code

view components

CSS

entity classes

12-Which of the following statements is true?

A view component sends data to a partial view.

A partial view acts as a controller for a view component.

A view component stores all of its code in a .cshtml file.

A partial view sends data to a view component.