WEB-180 Midterm Answers

Ace your homework & exams now with Quizwiz!

If you want the Bootstrap table classes to work properly with an HTML table, the table must include

both thead and tbody elements

Which of the following class attributes formats the element as a button with a solid background and light text?

class="btn btn-primary"

Which of the following class attributes would increase the margin on the right side of the element by .5 rem?

class="mr-2"

Given a DB context object named context that has a DbSet<Customer> property named Customers and a Customer object named c which of the following adds the Customer object to the database?

context.Customers.Add(c); context.SaveChanges();

Given a DB context object named context that has a DbSet<Customer> property named Customers, which of the following returns a Customer object for the specified id parameter?

context.Customers.Find(id)

Given a DB context object named context that has a DbSet<Customer> property named Customers, which of the following returns a list of Customer objects sorted by last name?

context.Customers.OrderBy(c => c.LastName).ToList()

When you run an app with debugging and it encounters a breakpoint, the app

enters break mode

When you use the CSS classes of the Bootstrap grid system, you can specify the number of columns that an element spans

for each screen size

Within a <form> element, which of the following classes would you use to format an <input> element?

form-control

In a controller, which of the following statements checks whether the data in the model is valid?

if (ModelState.IsValid) {...}

Which of the following classes would you use to cause an image to be sized based on the size of its containing element?

img-fluid

Unlike a static web page, a dynamic web page

is generated by a web app that's running on an application server

When you run an app with debugging and it encounters a tracepoint, the app typically

logs a message to the Output window

A CSS Style sheet

provides a way to store CSS formatting for multiple pages in a single file

Given a Customer entity class with a CustomerId property for its primary key, which of the following defines a foreign key property if it's coded in another entity class named Invoice?

public int CustomerId { get; set; }

To create a tracepoint that logs a message to the Output window, you can right-click the statement,

select Breakpoint>Insert Tracepoint, and use the Breakpoint Settings window to specify the message

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

the ViewContext.RouteData.Values array

You can create a strongly-typed view by using the @model directive to specify a model type and by using the asp-for tag helper to bind HTML elements to

the properties of the model object

In the Package Manager Console window, which of the following commands can you use to create the database for the app, if necessary, and update it to the most recent migration file?

update-database

The primary use of the Locals window is to

view data in the variables and properties that are being used

The Exception Helper dialog is displayed if you run an app

with debugging and an exception occurs

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}

Which of the following statements is true?

.NET Framework only runs on Windows.

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

A Razor code block

What is the following code called? @{ Layout = null; }

A Razor code block

What is a jumbotron?

A large grey box with rounded corners and a large font

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

An absolute URL

In the Startup.cs file, which method contains the code that configures the HTTP request and response pipeline?

Configure()

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.

Compared to Web Forms, which of the following is NOT a benefit of the MVC pattern?

It makes it easier to set up the app and get started quickly.

In a DB context class, what does the following code do? public DbSet<Customer> Customers { get; set; }

It maps the Customer entity class to a database table named Customers.

If the following is coded above a property in a model class, what does it do? [Range(1, 10, ErrorMessage = "Please enter a number between 1 and 10.")]

It specifies a user-friendly error message if the property isn't within the specified range.

If you perform an HTTP redirect, MVC automatically calls the

Keep() method

With Visual Studio, what tool can you use to add the packages needed to work with EF Core?

NuGet Package Manager

Which of the following is NOT a subclass of ActionResult?

PDFResult

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

PRG

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 Step command executes one statement at a time except for called methods?

Step Over

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 statements about ASP.NET Core middleware components is false?

They must be configured the same for all web apps.

Which one of the following is a property of the HomeController class? public class HomeController : Controller { public IActionResult Index() { ViewBag.Description = "Gibson Les Paul"; ViewBag.Price = 699.99; return View(); } }

ViewBag

You typically create a custom layout in the ______________ folder and apply the layout inside a view in a ___________________.

Views/Shared - Razor code block

What's the name of the file that typically stores the connection string for a database?

appsettings.json

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

In a view, which of the following tag helpers displays a summary of all validation errors that are stored in the model?

asp-validation-summary="All"


Related study sets

Health and assessment chapter 11: Assessing culture.

View Set

Events leading to the Civil War, Civil War & Reconstruction

View Set

Ed Psy Ch. 4 Learning Disabilites

View Set