ASP.NET Core Test 1 — Questions and Answers
Question 1: Which of the following platforms does ASP.NET Core support?
- Linux
- Mac
- Windows
- All of the above (Correct answer)
Correct answer: All of the above
Explanation: <br> ASP.NET Core offers another amazing advantage because it is open-source: cross-platform and container interoperability. This means that it can run on Windows, Linux, and MacOS, making it a more distinctive and robust platform.
Question 2: Which of the following can be targeted by ASP.NET Core applications?
- .NET Framework 4x
- .NET Standard
- .NET Core
- All of the above (Correct answer)
Correct answer: All of the above
Explanation: <br> Frameworks that target ASP.NET Core. Only.NET Core can be targeted by ASP.NET Core 3.x and later. ASP.NET Core is primarily made up of.NET Standard libraries. Any.NET platform that implements.NET Standard 2.0 can run libraries written with.NET Standard 2.0.
Question 3: In MVC, what is the best way to assign a session?
- Current.Session["LoginID"] =7; (Correct answer)
- Session["LoginID"] =7;
- System.Web.HttpContext..Current.Session["LoginID"] =7;
- None of the above
Correct answer: Current.Session["LoginID"] =7;
Explanation: <br> The best approach to assigning in MVC is current. Session ["LoginID"] =7;
Question 4: Which of the following is the ASP.NET Core application's entry point?
- Application_start method of Global.asax
- Main method of the Program class (Correct answer)
- Configure method of Startup class
- ConfigureService method of Startup class
Correct answer: Main method of the Program class
Explanation: <br> The application's main() method is used to start it up. When we run an ASP.NET Core Web application, the first thing it does is seek for the Main() function, which is where the execution begins. ASP.NET Core is then configured and started using the Main() function. The app is now an ASP.NET Core web app.
Question 5: The ASP.NET Core framework is a _______
- UI
- Obsolete
- Open-sourced (Correct answer)
- Licensed
Correct answer: Open-sourced
Explanation: <br> Microsoft's ASP.NET Core is a free and open-source web framework that is the successor to ASP.NET. It's a modular framework that works with both the full.NET Framework and the cross-platform.NET. However, ASP.NET Core version 3 only works with.NET Core, therefore it no longer supports.NET Framework.
Question 6: Which Status code does the RedirectToAction() method represent?
- 305
- 302 (Correct answer)
- 301
- 300
Correct answer: 302
Explanation: <br> Redirects to an action named the same as the current one (Status302Found). The names of the 'controller' and 'action' come from the current request's ambient variables.
Question 7: What exactly does ActionResult() imply?
- Both It is an abstract Class and It is a Concrete Class
- It is an abstract Class (Correct answer)
- It is a Concrete Class
- None of the above
Correct answer: It is an abstract Class
Explanation: <br> The outcome of an action method is represented by the abstract class ActionResult. The class inherits from System.Object and only adds one abstract method: ExecuteResult, which is an abstract method that will be implemented by the derived classes of ActionResult.
Question 8: What exactly does ViewResult() imply?
- Both It is an abstract Class and It is a Concrete Class
- It is an abstract Class
- It is a Concrete Class (Correct answer)
- None of the above
Correct answer: It is a Concrete Class
Explanation: <br> The ViewResult sends HTML to the client using the view engine as a response. With ASP.NET core, you can utilize a variety of view engines, although the razor view engine is the most popular. You can also build your own view engine. The ViewResult returns a view that includes or excludes data. Model binding can be used to pass data. The View is a physical file on the file system with the extension.cshtml or.vbhtml.
Question 9: Which namespaces are needed for MVC Data Annotation?
- System.ComponentModel
- Both System.ComponentModel.DataAnnotations and System.ComponentModel (Correct answer)
- System.ComponentModel.DataAnnotations
- None of the above
Correct answer: Both System.ComponentModel.DataAnnotations and System.ComponentModel
Explanation: <br> Data Annotations are properties that are assigned to a class or its members and establish validation criteria, how data is displayed, and class connections. The System is in place. ComponentModel. The classes that are used as data attributes are found in the DataAnnotations namespace.
Which of the following platforms does ASP.NET Core support?