Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have a view component named ProductsByCategoryViewComponent that is placed in the Components folder. Which folder should you put in the partial view that it

You have a view component named ProductsByCategoryViewComponent that is placed in the Components folder. Which folder should you put in the partial view that it creates?

Question 1 options:

Views/Shared/Components/ProductsByCategory

Views/ProductsByCategory

Views/Components

Components

Question 2 (1 point)

Listen

You are working with the database using EF Code-First approach. Which of the following is the correct process to add Password to the Customer table.

Question 2 options:

Add Password property to the entity class Customer and do nothing - the table Customer in the database will be updated automatically

Add Password property to the entity class Customer and possibly "seed" some data in the context class. Then, run two commands in the Package manager console: add-migration and update-database

Add Password column to the Customer table in the database, and run Scaffold-DbContext command in Package Manager Console

Add Password column to the Customer table in the database, and do nothing - the entity class Customer in the application will be updated automatically

Question 3 (1 point)

Listen

The InvokeAsync method of a view component returns a value of type Task.

Question 3 options:

True
False

Question 4 (1 point)

Listen

Writing entity and database context classes to generate a new database is called EF Database-First approach.

Question 4 options:

True
False

Question 5 (1 point)

Listen

Session id is typically passed between a web server and client's browser as a cookie.

Question 5 options:

True
False

Question 6 (1 point)

Listen

You are using cookies authentication. Which class do SignInAsync and SignOutAsync methods belong to?

Question 6 options:

HttpContext

HttpRequest

HttpResponse

HttpSession

Question 7 (1 point)

Listen

Partial view can be used to define a section that can be included in multiple views.

Question 7 options:

True
False

Question 8 (1 point)

Listen

Only one of the following statements is true. Which one?

Question 8 options:

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

A partial view sends data to a view component.

A view component sends data to a partial view.

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

Question 9 (1 point)

Listen

One of the consequences of placing the database connection string in appsettings.json file is that controllers need to have an object of a class that inherits from DbContext injected into the constructor.

Question 9 options:

True
False

Question 10 (1 point)

Listen

Who can access the pages displayed by the Product controller below? Assume there are no additional authorize attributes on its methods.

[Authorize] public class ProductController : Controller

Question 10 options:

All users

Anonymous users

Only users who are logged in

Only users who are logged in and members of the Authorize role

Question 11 (1 point)

Listen

When a property in the entity class that is marked with [Key] data attribute, it generates a foreign key column when update-database is executed.

Question 11 options:

True
False

Question 12 (1 point)

Listen

When a view posts data, an action method can use the ______________ property of the controller class to check whether all values in the model are valid.

Question 12 options:

ViewBag

ViewData

Model

ModelState

Question 13 (1 point)

Listen

A view redirects to another action method of the same controller. To pass a message to be included in the view that belongs to the action to which you redirect, you can use _______.

Question 13 options:

TempData

ViewData

ViewBag

a model object

Question 14 (1 point)

Listen

Which of the following properties of class Book will make a primary key identity column in the database table generated from this class, without having to add a [Key] attribute?

Question 14 options:

public string ISBN{ get; set;}

public int ISBN{ get; set;}

public int BookID{ get; set;}

public string BookID{ get; set;}

Question 15 (1 point)

Listen

To bind data to an action method parameter, MVC begins by looking in the body of the POST request. Next, it looks in the

Question 15 options:

ViewData

route values in the URL

query string paramters in the URL

ViewBag

Question 16 (1 point)

Listen

Data added to ViewBag can be accessed only during processing of a single HTTP request.

Question 16 options:

True
False

Question 17 (1 point)

Listen

Pre-defined Compare data attribute can be used to check if value of one property of an entity is equal to the value of another property of the same entity.

Question 17 options:

True
False

Question 18 (1 point)

Listen

Which of the following is a tag helper that displays a validation message for a property of the model?

Question 18 options:

asp-for

asp-action

asp -validation-for

asp-validation-summary

Question 19 (1 point)

Listen

To create a persistent cookie, you must set the ______________ property of the CookieOptions class before adding the cookie to the Response.Cookies collection.

Question 19 options:

Request

Response

Expires

Secure

Question 20 (1 point)

Listen

Which of the following is NOT a common web programming technique for maintaining state beyond one request cycle?

Question 20 options:

cookie

session state

query string

class-level variable in the controller class

Question 21 (1 point)

Listen

When data item is added to TempData it can be accessed multiple times during the entire session with no restriction.

Question 21 options:

True
False

Question 22 (1 point)

Listen

If you mark the controller class with [Authorize] attribute, you cannot mark any of its action methods with [AllowAnonymous].

Question 22 options:

True
False

Question 23 (1 point)

Listen

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

Question 23 options:

Adding parameters to its InvokeAsync method

Using ViewBag

Using Razor code block

Using TempData

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

Describe the concept of corporate social responsibility.

Answered: 1 week ago

Question

Explore the concept of business ethics.

Answered: 1 week ago

Question

Discuss human resource management issues for small businesses.

Answered: 1 week ago