1.
ASP.NET MVC Display layer is represented by:
Correct Answer
B. View
Explanation
The correct answer is View. In the ASP.NET MVC architecture, the Display layer is represented by the View. The View is responsible for rendering the user interface and displaying data to the user. It receives input from the user and sends it to the Controller for processing. The View is separate from the Model and Controller, ensuring a clear separation of concerns and promoting code reusability.
2.
Assembly that defines ASP.NET MVC framework:
Correct Answer
C. System.Web.mvc
Explanation
The correct answer is System.Web.mvc because this assembly specifically defines the ASP.NET MVC framework.
3.
In order to plug ASP.NET MVC into ASP.NET Web Form application, which assemblies we need to add [Choose three]:
Correct Answer(s)
A. System.Web.Routing
C. System.Web.Abstraction
D. System.Web.Mvc
Explanation
To plug ASP.NET MVC into an ASP.NET Web Form application, we need to add three assemblies: System.Web.Routing, System.Web.Abstraction, and System.Web.Mvc. These assemblies are necessary for routing, abstraction, and MVC functionality respectively.
4.
ViewBag is an object of type:
Correct Answer
B. Dynamic Property
Explanation
ViewBag is an object of type Dynamic Property. In ASP.NET MVC, ViewBag is a dynamic property that is used to pass data from the controller to the view. It allows developers to dynamically add properties to the ViewBag object and access them in the view. This dynamic nature of ViewBag allows for flexibility in passing data between the controller and the view without the need for strongly typed models.
5.
In an MVC application, request received from client hits first:
Correct Answer
C. Controller
Explanation
In an MVC (Model-View-Controller) application, the request received from the client hits the controller first. The controller is responsible for handling the incoming request, processing any necessary data, and determining the appropriate response. It acts as an intermediary between the model (which represents the data and business logic) and the view (which displays the user interface). Once the controller has processed the request, it may interact with the model to retrieve or update data and then pass the necessary information to the view for rendering. Therefore, the controller is the first component to be triggered in the request-response cycle.
6.
Routing in ASP.NET MVC is basically [Choose One]?
Correct Answer
B. It maps a URL to a resource.
Explanation
Routing in ASP.NET MVC is the process of mapping a URL to a specific resource, such as a controller action or a view. It allows for the creation of clean and user-friendly URLs that can be easily understood by both users and search engines. By mapping a URL to a resource, the routing mechanism determines which controller and action should handle the request and generates the appropriate response. This helps in achieving a clear separation of concerns and enables developers to build flexible and maintainable web applications.
7.
Role of Model in MVC is to hold ?
Correct Answer
B. Application business logic.
Explanation
In the Model-View-Controller (MVC) architecture, the role of the Model is to hold the application business logic. This means that the Model is responsible for managing and manipulating the data and implementing the rules and operations that govern the behavior of the application. The Model is separate from the UI logic, which is handled by the View, and it does not hold any UI-related logic. Instead, the Model focuses on the core functionality and operations of the application, making it a crucial component in the MVC pattern.
8.
Action filters are used to ?
Correct Answer
C. Apply specific logic before or after action methods.
Explanation
Action filters are used to apply specific logic before or after action methods. These filters allow developers to add additional functionality to an action method without modifying the method itself. They can be used to perform tasks such as authentication, authorization, logging, exception handling, and data manipulation before or after the execution of an action method. By applying action filters, developers can easily implement cross-cutting concerns and improve code reusability and maintainability.
9.
Which of the following statements are true for ASP.NET MVC [Choose two]?
Correct Answer(s)
A. ASP.NET MVC uses Front Controller approach.
C. Automated testing is simple.
Explanation
ASP.NET MVC uses the Front Controller approach, which means that it centralizes the handling of requests and routes them to the appropriate controllers. This allows for better control and organization of the application's logic.
Automated testing is simple in ASP.NET MVC because it follows the principle of separation of concerns, which makes it easier to write unit tests for individual components of the application. This promotes testability and helps ensure the reliability of the codebase.
10.
What are the advantages of ASP.NET MVC Partial View [Choose two]?
Correct Answer(s)
A. Imporves reusability.
C. Easy to maintain.
Explanation
ASP.NET MVC Partial View provides the advantages of reusability and easy maintenance. By using partial views, developers can create reusable components that can be used across multiple views, reducing code duplication and improving efficiency. Additionally, partial views are easier to maintain as any changes made to a partial view will automatically reflect in all the views that use it. This makes it easier to update and modify the application without impacting other parts of the code.