CPT-231 Final/Test 3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

When you code a controller that works with ASP.NET Core Identity, you can inject the UserManager<T>, SignInManager<T>, and RoleManager<T> objects into the controller by

coding them as parameters of the controller's constructor

In an ASP.NET Core MVC app, you can organize the folders and files of the app by creating areas where each area has its own

controllers, models, and views

To allow session state to work, the server uses

cookies

Authorization refers to the process of

granting a user access to an app

The third segment of the default route specifies an argument for the

id parameter of the specified action method

To add the Identity tables to the DB context class, you can code an entity class named User that inherits the IdentityUser class and a DB context class that

inherits the IdentityDbContext<User> class

When you use attribute routing, the route specified by the attribute

overrides any routes that are specified in the Startup.cs file

You can pass a model to a view by

passing a model object as an argument to the View() method inside an action method and returning the resulting object

From inside an action method, you can transfer a model to a view by

passing it to the View() method and returning the result

Which of the following is NOT a common web programming technique for maintaining state?

remote procedure call

Which of the following is a technique that is used in ASP.NET Core MVC for maintaining state but is not commonly available outside of this framework?

routes

A _______________ cookie only lasts as long as the browsing session, and a _____________ cookie can last through multiple browser sessions.

session - persistent

To nest one layout inside another, the containing layout should

set its Layout property to the nested layout

To get route information for the current view, a layout can use

the ViewContext.RouteData.Values array

To encapsulate the functionality of another class, it is common to write a

wrapper class

Which pattern specifies the default route for an ASP.NET Core MVC app?

{controller=Home}/{action=Index}/{id?}

If your app uses routes with the following patterns, which route do you need to code first in the Startup.cs file?

{controller}/{action}/{category}/page{page}/sort-by-{sortby}

Given a User class that inherits the IdentityUser class, which of the following directives can you use to inject a SignInManager<User> object into a layout?

@using Microsoft.AspNetCore.Identity @inject SignInManager<User> signInManager

What does the following code represent? @{ string myName = "John"; ViewBag.Name = myName; }

A Razor code block

One good way to display a model object list in a table is to use

A Razor foreach loop

Which method can you use to add the Identity service to the HTTP request and response pipeline?

AddIdentity()

What is the following URL an example of?https://www.murach.com/shop-books/all

An absolute URL

A view can access data stored in session state by using the property named

Context

When you create an area to organize folders and files, you do NOT typically need to perform one of the following tasks. Which one is it?

Create a Route folder to store the routing patterns for the area.

Which method of the UserManager<T> class can you use to create a user in the AspNetUsers table?

CreateAsync()

To enable session state, the Startup.cs file must call all of the following methods except

EnableCookies()

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

Expires

Which of the following is NOT a property of the IdentityUser class?

FirstName

From within a controller, you can work with session state items by using methods of an interface named

ISession

Given a RoleManager<IdentityRole> object named roleManager and a variable named id that stores an id for an existing role, which of the following statements deletes the role?

IdentityRole role = await roleManager.FindByIdAsync(id); await roleManager.DeleteAsync(role);

If you perform an HTTP redirect, MVC automatically calls the

Keep() method

Within the TempData dictionary, you can mark a value for a key as unread by calling the

Keep() method

Which of the following is NOT a subclass of ActionResult?

PDFResult

Which of the following design patterns prevents resubmission of form data?

PRG

The TempData dictionary is often used with the

PRG pattern

With the TempData dictionary, you can read a value for a key without having it be marked as read by calling the

Peek() method

Which of the following methods redirects from one action to another?

RedirectToAction()

Which of the following is NOT a property that you can use to configure password options?

RequireStrong

The _________________ method can convert a .NET object to JSON format.

SerializeObject()

If you need to store data that persists across multiple requests, you should use the

TempData property

If you're using the default route, which action does the following URL call?https:/localhost:5001/

The Index action of the Home controller

If you're using the default route, which action does the following URL call?https:/localhost:5001/customer/list

The List action of the Customer controller

Which of the following is a benefit of well-designed URLs?

They can improve the usability of your app for both developers and end users.

Which of the following is NOT a best practice for creating URLs?

Use query string parameters whenever possible.

If you are storing data from a controller and need to create a key that contains spaces, you should use the

ViewData property

Given a controller named FoodController with an action method Burgers(), the corresponding view would be mapped by default to

Views/Food/Burgers.cs

Which tag helpers can generate the following URL?/Foods/Veg/Samosa

asp-controller="Foods", asp-action="Veg", asp-route-id="Samosa"

The tag helper that can be used to perform binding between properties of a model and HTML elements is

asp-for

The tag helper that can be used to perform binding of items to a <select> element is

asp-items

Given a SignInManager<User> object named signInManager and a User object named user, which of the following attempts to log in the user?

await signInManager.SignInAsync(user, isPersistent: false);


संबंधित स्टडी सेट्स

Developmental Psychology TEST 2 Chapters 5,6,8, &9

View Set

Chap 12 Mastering Biology Assignment

View Set

The World Tang Soo Do Association History

View Set

Le premier Travail de Damien Ch 1-2

View Set