CISS 411 Final
3.3 An MVC View page can contain ____. a. C# code only b. HTML elements only c. both C# code and/or HTML elements d. neither C# code nor HTML elements
both C# code and/or HTML elements
2.3 A controller in MVC is a C# ___ that accepts user requests and generates necessary response to the user. a. method b. class c. server d. namespace
class
4.2 A model in ASP.NET Core MVC is just a C# ___. a. model b. controller c. view d. class
class
2.7 An ASP.NET Core MVC controller is a C# ____ that inherits from the _____ class. a. object, object b. method, object c. class, Controller d. class, Controllers
class, Controller
1.1 The World Wide Web uses which architecture? a. peer-to-peer b. software c. client/server d. one-to-one
client/server
1.14 In ASP.NET Core MVC, the ____ component is responsible for interactions between components. a. model b. view c. controller d. MVC
controller
1.12 In ASP.NET Core MVC, the model component includes files that represent ______ and is often used in the controllers and views. a. model b. URL c. data d. HTTP request
data
4.15 C# List class has a method called ____ that can be used to find the first element in the List with the given condition. a. FindFirst b. FindFirstOrDefault c. FirstOrDefault d. SearchFirst
FirstOrDefault
1.19 Under ASP.NET Core MVC convention, if there is a controller called StudentController.cs and a method called About(), there must be a folder called _____ inside the Views folder and an MVC View page called ____ inside this folder. a. Student, About b. About, Student c. StudentController, Student d. StudentController, About
Student, About
3.11 Suppose the following code is in an MVC Razor View: <p><a asp-controller="Student" asp-action="AddCourse">Add a new course</a></p> You will need a controller called ___ and an action method called ___ inside that controller. a. Controllers, Actions b. Student.cs, AddCourse c. StudentController.cs, AddCourse d. StudentController, AddCourseAction
StudentController.cs, AddCourse
1.17 Which of the following statements about MVC View pages is correct? a. An MVC View page can include any mix of C# and HTML tags. b. An MVC View page can include any mix of C# and HTML tags with C# code inside @ { } block. c. An MVC C# page will include all C# code while an MVC HTML page will have all HTML tags. d. An MVC View page can include any mix of C# and HTML tags with HTML tags inside @ { } block.
An MVC View page can include any mix of C# and HTML tags with C# code inside @ { } block.
2.5 If the URL of the browser is localhost/Student/CheckGrade, the ____ method of __ controller will be called to generate the return message. a. Student, CheckGrade b. CheckGrade, Student c. localhost, Student d. localhost, CheckGrade
CheckGrade, Student
1.11 ______ is a software architectural pattern that uses three components (Model-View-Controller) for a web application. a. ASP.NET b. ASP.NET Core c. Controller d. MVC
MVC
2.19 ___ is a software component that works like a connector between an application and other applications or platforms. a. MVC b. ASP.NET Core MVC c. Namespace d. Middleware
Middleware
4.3 In an ASP.NET Razor View, the keyword ____ represents the model used in the view. a. static b. Model c. View d. Controller
Model
4.1 ___ define the structure of data passed between controllers and views. a. Controllers b. Views c. Models d. ViewData
Models
1.26 Which type of architectural structure provides a static view of the software? a. Module b. Class c. Component-and-connector d. Allocation
Module
1.30 Encapsulation, inheritance, and polymorphism describe _______. a. Conditional b. Structured c. OOP (Object-Oriented Programming) d. Functional
OOP (Object-Oriented Programming)
5.1 Entity Framework (EF) is a(n) _____ framework that allows you to work from the programming side to set up the database. a. Relational database b. Object-Oriented database c. Big data d. Object Relational Mapping
Object Relational Mapping
3.13 Suppose the following code is in an MVC View page: <p><a asp-controller="Student" asp-action="AddCourse">Add a new course</a></p> You will need a controller called ___ and a method called ___ inside that controller to handle the data submitted from the form. a. Controllers, Actions b. Student.cs, AddCourse c. StudentController.cs, AddCourse d. StudentController, AddCourseAction
StudentController.cs, AddCourse
3.22 ___ is an agile software development principle that discourages adding any unnecessary functionality to applications based on currently known requirements. a. DRY b. KISS c. YAGNI d. WET
YAGNI
3.12 Can you have two action methods with the same name in the same controller? a. Yes, as long as their signatures are different. b. Yes, as long as they have different action verbs. c. Yes, as long as they have different content. d. No.
Yes, as long as they have different action verbs.
2.12 In the Chapter2Example1 project of the book, if the following MapControllerRoute is used, pattern: "{controller=Student}/{action=CheckGrade}/{id?}"); what is on your browser? a. blank page. b. page can't be found. c. Your grade is A. d. default home page.
Your grade is A.
3.14 Common code on all Razor View files can be removed and put in one _____ file. a. _ViewStart.cshtml b. _ViewImports.cshtml c. _Layout.cshtml d. Program.cs
_Layout.cshtml
3.9 To make the tag helpers work, you must add a Razor View called ____ inside the Views folder of the project. a. _ViewImports.cshtml b. _Layout.cshtml c. _ViewStart.cshtml d. Program.cs
_ViewImports.cshtml
3.16 Which file is called before any file in the Views folder is called? a. _ViewStart.cshtml b. _ViewImports.cshtml c. _Layout.cshtml d. _FirstView.cshtml
_ViewStart.cshtml
4.5 If the following line appears on an ASP.NET Razor View file, @model IEnumerable<Chapter4Example1.Models.Student> The page can receive or return __. a. a Student class b. an instance of Student c. a list of student objects d. a list of Student classes
a list of student objects
2.18 An action method that can handle data from a browser must have __. a. a return type that is not void b. a name that matches the HTML form name c. a name that matches the HTML file name d. a parameter list
a parameter list
4.20 A responsibility in SRP is defined as ___. a. a reason for change b. duty of a team member c. accountability of a manager d. having control over an application
a reason for change
1.2 In client/server architecture, the client usually ______. a. works alone b. sends requests to the server c. receives requests from the server d. works in collaboration with the server
receives requests from the server
3.8 ASP.NET MVC tag helpers run on __. a. server side b. client side c. both server side and client side d. neither server side nor client side
server side
4.18 The "S" in the SOLID principle stands for ___. a. separation of concerns b. single responsibility principle c. StudentController d. step by step principle
single responsibility principle
4.19 ____ suggests that each class should have only one responsibility and this responsibility should be entirely encapsulated by the class. a. separation of concerns b. single responsibility principle c. StudentController d. step by step principle
single responsibility principle
1.23 Structure of software components, relationships among these components, and properties and behaviors of these components and relationships define ____. a. software b. software architecture c. business d. enterprise
software architecture
2.16 In order to allow browsers to access a file stored at the wwwroot folder of the server, ____ should be added to the Program.cs file. a. HTML form b. form engine c. static file middleware d. dynamic file middleware
static file middleware
2.21 Which extension method adds routing middleware components to configure the routing engine so that a request can be forwarded to the appropriate controller and action method? a. AddControllersWithViews() b. UseStaticFile() c. UseAuthentication() d. UseDeveloperExceptionPage()
AddControllersWithViews()
4.17 The SelectList type can be used for the ___ element of an HTML form. a. <select> b. <selectlist> c. <list> d. <dropdown>
<select>
2.14 To make the following URL work, what do you need in the StudentController? localhost/Student/CheckRealGrade?name=Lynn&score=75 a. A method called CheckRealGrade. b. A method called CheckRealGrade with two parameters: name and score. c. A method called CheckRealGrade with two parameters: Lynn and 75. d. Such URL is not allowed.
A method called CheckRealGrade with two parameters: name and score.
1.27 Which type of architectural structure focuses on how the software related to its environment, such as CPU usage and network bandwidth requirements? a. Module b. Class c. Component-and-connector d. Allocation
Allocation
1.21 _____ architecture includes vision/mission, strategy, and business capabilities. a. Application b. Business c. Software d. Data
Business
1.5 In the World Wide Web, browsers usually cannot understand instructions written in ______. a. HTML b. CSS c. JavaScript d. C#
C#
4.10 In addition to adding a student to the allStudents List, what does the following action method do? [HttpPost] public IActionResult AddStudent(Student student) { allStudents.Add(student); return RedirectToAction("AllStudent"); } a. Call the AllStudent action method in the same controller. b. Return the list of allStudents from the Razor view for browser display. c. Find a Razor view called AllStudents and return it to the browser for display. d. Find a Razor view called AllStudent, pass the list of allStudents, and return the Razor view.
Call the AllStudent action method in the same controller.
1.25 Which type of architectural structure emphasizes run-time behaviors of the software? a. Module b. Class c. Component-and-connector d. Allocation
Component-and-connector
2.6 If you start an ASP.NET Core Empty project, you must add a folder called __. a. Project b. Projects c. Controller d. Controllers
Controllers
3.10 Suppose there is an action method like this: public IActionResult Course() { ViewData["Courses"] = allCourses; return View(); } You will need a Razor View called ____. a. IActionResult.cshtml b. Course.cshtml c. ViewData.cshtml d. View.cshtml
Course.cshtml
2.17 You can use just one action method to handle data passed from either a browser ___ or a browser ___. a. URL, HTML title b. URL, HTML form c. default setting, HTML title d. default setting, HTML form
URL, HTML form
4.11 When there are more than one models needed on a Razor View, ____ is often used. a. MultipleModel b. DoubleModel c. ControllerModel d. ViewModel
ViewModel
3.17 When coding, if you need to copy and paste a block of code, you may violate the ___ principle. a. DRY b. KISS c. YAGNI d. WET
DRY
3.24 We discuss three software design and development principles. Which two are more likely related? a. DRY and KISS b. KISS and YAGNI c. DRY and WET d. DRY and YAGNI
DRY and YAGNI
4.8 What does the following action method do? public IActionResult AddStudent() { return View(); } a. Add a student to the Razor view for browser display. b. Add a student to the list and return the Razor view for browser display. c. Find a Razor view called AddStudent and return it to the browser for display. d. Find a Razor view called AddStudent, add a student to the list, and return the Razor view.
Find a Razor view called AddStudent and return it to the browser for display.
4.9 What does the following action method do? Assuming allStudents is a C# List of Student. public IActionResult AllStudent() { return View(allStudents); } a. Return the list of students to the browser for display. b. Return the list of allStudents from the Razor view for browser display. c. Find a Razor view called AllStudents and return it to the browser for display. d. Find a Razor view called AllStudent, pass the list of allStudents, and return the Razor view.
Find a Razor view called AllStudent, pass the list of allStudents, and return the Razor view.
4.12 Suppose a viewmodel is called MyViewModel which has two classes: Student and Major as its properties. The Student class has a property called StudentId. How do you access the StudentId property in the Razor View that has MyViewModel as the model? a. StudentId b. Student.StudentId c. Major.Student.StudentId d. Student.Major.StudentId
Student.StudentId
1.31 Different from OOP, in which application state is often shared with several methods in the same object, ______ programming avoids state sharing. a. Conditional b. Structured c. OOP (Object-Oriented Programming) d. Functional
Functional
1.8 When a client sends an HTTP ______ message to the server, the data is shown in the URL. a. GET b. POST c. secure d. unsafe
GET
2.13 The HTTP ___ method allows the browser to send data to the server through the URL. a. GET b. SEND c. EXPRESS d. DELIVERY
GET
1.7 ______ is a standard that governs the communications between clients and servers in the World Wide Web. a. Client/Server b. IP c. TCP d. HTTP
HTTP
3.2 If the URL is localhost/Student/Home, by convention there must be an MVC View Page called a. Student.cshtml b. Home.cshtml c. Student.Home d. Home.Student
Home.cshtml
4.13 You often use two action methods with the same name for one HTML form. One is ___ and the other is ___. a. HTTP, FTP b. HttpGet, HttpPost c. an error, correct d. Send, Receive
HttpGet, HttpPost
1.4 In the World Wide Web, an example of a server is ______. a. browser b. IIS c. cellphone d. Personal Computer (PC)
IIS
3.15 Which method in _Layout.cshtml file is used to insert an individual view file? a. RenderBody() b. InsertBody() c. AddBody() d. PartialView()
RenderBody()
3.7 What is the major benefit of using tag helpers in ASP.NET MVC? a. Intelligent b. IntelliSense c. Intellectual d. shorter code
IntelliSense
2.20 Which of the following is NOT a benefit of using middleware? a. It allows the hiding of details in the underlying environments. b. It provides a common architecture for adding services and functionalities without having to change the application. c. It allows beginners to build complex applications. d. It makes data easily passed between the "pipes."
It allows beginners to build complex applications.
3.20 According to the _____ principle, a simple system works the best while a complex system induces errors. a. DRY b. KISS c. YAGNI d. WET
KISS
3.21 The architects who focus too much on reusability and generality in software development may violate the ___ principle. a. DRY b. KISS c. YAGNI d. WET
KISS
1.28 Which of the following is NOT a programming paradigm? a. Loop b. Structured c. OOP (Object-Oriented Programming) d. Functional
Loop
1.29 ______ programming uses logical structures such as if-else statements to make the program more efficient and easier to understand and maintain. a. Conditional b. Structured c. OOP (Object-Oriented Programming) d. Functional
Structured
1.9 When a large-sized web form content is sent from a client to the server, it often uses the HTTP method ______. a. GET b. POST c. secure d. unsafe
POST
2.15 The HTTP ___ method allows the browser to send data to the server through an HTML form. a. Form b. SEND c. POST d. DELIVERY
POST
1.24 Which of the following is NOT a type of structure in software architecture? a. Module b. Procedural c. Component-and-connector d. Allocation
Procedural
4.7 When adding a new Razor view to a project, you may want to search the term "View" in the "add new item" window. Which of the following view types will NOT show? a. Razor Layout b. Razor View Layout c. Razor View Start d. Razor View Imports
Razor View Layout
4.14 Usually, an action method will call a corresponding Razor View with the same name. Sometimes, an action method can call another action method by using ___. a. RedirectToAction("NameOfAnotherActionMethod") b. NameOfAnotherActionMethod c. GoTo("NameOfAnotherActionMethod") d. This is impossible in ASP.NET Core MVC
RedirectToAction("NameOfAnotherActionMethod")
3.1 If the URL is localhost/Student/Home, by convention there must be a folder called ____ inside the Views folder. a. Student b. Home c. Default d. Index
Student
1.18 Under ASP.NET Core MVC convention, if there is a controller called StudentController.cs, there must be a folder called _____. a. Student b. StudentController c. Student inside the Views folder d. StudentController inside the Views folder
Student inside the Views folder
4.16 The using Microsoft.AspNetCore.Mvc.Rendering; directive is needed for ___ type. a. Microsoft b. AspNetCore c. MajorList d. SelectList
SelectList
2.1 In ASP.NET MVC, the routing engine of the server decides which method of which controller to call based on the browser ___. a. user b. URL c. brand name d. connection speed
URL
1.6 A message sent from a client to a server using HTTP can be either GET or POST. (True/False)
True
3.6 ___ is a C# dictionary that can pass values from a controller to corresponding views. a. Student<TKey, TValue> b. ViewData c. ViewBag d. ViewModel
ViewData
3.4 For most of the book, a(n) ___ will return an instance of IActionResult (or Task<IActionResult> for async methods). a. class b. object c. action method d. controller
action method
2.4 An MVC controller includes one or more ___ which are methods in a class. a. actions b. URLs c. web addresses d. sub controllers
actions
4.4 If the following line appears on an ASP.NET Razor View file, @model Chapter4Example1.Models.Student The page can receive or return __. a. a Student class b. an instance of Student c. a list of student objects d. a list of Student classes
an instance of Student
1.22 Software architecture includes _____ architecture and ______ architecture. a. application, data b. business, application c. enterprise, business d. business, system
application, data
1.3 In the World Wide Web, an example of a client is ______. a. browser b. IIS c. Apache d. PC
browser
2.2 The naming of ___ and ___ in an MVC app determines what URL you can have for a page. a. routing engine, controller b. routing engine, method c. controller, method d. controller, project name
controller, method
1.16 When a method calls a view file, it will automatically go to a folder with the same name as the controller name (where the method is located) and find a file with the same name as the method name. This is an example of ______. a. separation of concerns b. easy unit testing c. convention over configuration d. use of very few files
convention over configuration
3.5 An action of a controller sends ___ to a view for formatting. The latter puts the ___ into a webpage. a. data, data b. webpage, data c. URL, URL d. URL, data
data, data
2.23 Instead of instantiating a concrete implementation inside a class, you can create an instance outside the class. Then passing the object into the class describes ___. a. dependency b. dependency injection c. outside-in d. inside-out
dependency injection
2.22 The statement, "high-level modules should not depend on low-level modules," describes ___ design principle. a. "Is-a" b. "Has-a" c. dependency d. dependency inversion
dependency inversion
3.23 Developing features that are not in the software requirements is NOT related to __. a. lower team morale b. code ownership c. Learn extra income d. lower customer satisfaction
earn extra income
1.20 Business architecture and System Architecture are parts of _______ architecture. a. application b. data c. software d. enterprise
enterprise
3.19 When something goes wrong, you just need to examine the code in the module instead of the whole application describes ____. a. fault localization b. global code c. code is easier to understand d. enhanced code ownership among the developers
fault localization
3.18 Which of the following is NOT a benefit of modularization? a. fault localization b. global code c. code is easier to understand d. enhanced code ownership among the developers
global code
4.6 The following code in a form of a Razor View file: <input asp-for="StudentId" /> Will become an <input> element with ____ when the file is sent to the browser. a. id attribute value of "StudentId" b. asp-for attribute value of "StudentId" c. type attribute value of "StudentId" d. student attribute value of "StudentId"
id attribute value of "StudentId"
2.10 If the following MapControllerRoute is used, pattern: "{controller=Home}/{action=Index}/{id?}" ); Which of the following URLs is different from the other three? a. localhost b. localhost/Home c. localhost/Home/Index d. localhost/Index/Home
localhost/Index/Home
5.2 Which of the following packages is(are) needed to make Entity Framework work? a. Microsoft.EntityFrameworkCore.SqlServer b. Microsoft.EntityFrameworkCore.Tools c. Microsoft.AspNetCore.All d. only a and b above
only a and b above
2.11 In the Chapter2Example1 project of the book, when you complete the project and start without debugging, what is on your browser? a. blank page. b. page can't be found. c. Your grade is A. d. default home page.
page can't be found.
1.10 As an analogy, when a browser sends an HTTP GET request to the server, it is like using ______ in the postal service. a. package b. envelope c. postcard d. express mail
postcard
2.8 If you start an ASP.NET MVC project using an empty template, you must add the following line of code to ____ file: builder.Services.AddControllersWithViews(); a. project.cs b. service.cs c. program.cs d. main.cs
program.cs
2.9 If you start an ASP.NET Core MVC project using an empty template, you should add the following statement inside the ____ file. app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); a. project.cs b. service.cs c. program.cs d. main.cs
program.cs
1.15 Which of the following is NOT a benefit of MVC? a. separation of concerns b. easy unit testing c. convention over configuration d. use of very few files
use of very few files
1.13 In ASP.NET Core MVC, the ____ component is responsible for the presentation of the application. a. model b. view c. controller d. MVC
view
