
Q121
Q121 Which library is commonly used for AJAX in ASP.NET MVC?
jQuery
Angular
React
Knockout
Q122
Q122 What is a Partial View in ASP.NET MVC?
A fully rendered view
A reusable view component
A controller action
A database entity
Q123
Q123 How is a Partial View rendered using HTML Helpers?
@Html.RenderPartial("ViewName")
@Html.Render("ViewName")
@Html.Partial("ViewName")
@Html.View("ViewName")
Q124
Q124 What is the role of JsonResult in AJAX requests?
Return HTML
Return JSON data
Handle routing
Define models
Q125
Q125 How do you make an AJAX GET request using jQuery?
$.ajax({type: "GET"})
$.get("url")
$.ajaxGet("url")
$.fetch("url")
Q126
Q126 How do you update a DOM element with data from an AJAX call?
Use append()
Use load()
Use update()
Use replace()
Q127
Q127 How do you send data in an AJAX POST request using jQuery?
$.ajax({type: "POST", data: data})
$.post("url")
$.ajaxPost("url")
$.fetchPost("url")
Q128
Q128 An AJAX request returns a 404 error. What could be the issue?
Invalid URL
Missing controller
Incorrect data format
View not found
Q129
Q129 A Partial View does not render correctly. What could be wrong?
View is missing
Invalid route
Incorrect model passed
All of the above
Q130
Q130 What is the purpose of the [Authorize] attribute in ASP.NET MVC?
Restrict access to routes
Enable authentication
Handle model validation
Secure Razor views
Q131
Q131 What is Cross-Site Request Forgery (CSRF)?
A database attack
A form of XSS attack
An attack where unauthorized commands are performed on behalf of a user
A form validation error
Q132
Q132 How do Anti-Forgery tokens protect against CSRF attacks in ASP.NET MVC?
They encrypt sensitive data
They validate user identity
They ensure that a form request is from the authenticated user
They block unauthorized access
Q133
Q133 What is the purpose of HTTPS in ASP.NET MVC applications?
To optimize routing
To secure data in transit
To restrict controller access
To simplify model binding
Q134
Q134 How do you enable Anti-Forgery tokens in a Razor view?
@Html.EnableAntiForgeryToken()
@Html.AntiForgeryToken()
@Html.AddCSRF()
@Html.EnableCSRF()
Q135
Q135 How do you implement custom role-based authorization in ASP.NET MVC?
Create a custom AuthorizeAttribute
Add roles in Web.config
Use HttpContext.SetRole()
Modify RouteConfig
Q136
Q136 How do you enforce HTTPS for a controller in ASP.NET MVC?
Use the [HttpsRequired] attribute
Use the [RequireHttps] attribute
Define HTTPS in RouteConfig
Set HTTPS in Web.config
Q137
Q137 A [RequireHttps] attribute throws an error on localhost. What is the issue?
HTTPS is not enabled
Route is missing
Anti-Forgery token is missing
Certificate is invalid
Q138
Q138 An Anti-Forgery token validation fails. What could be the issue?
Token mismatch
Route conflict
Controller is missing
Invalid Razor syntax
Q139
Q139 What is bundling in ASP.NET MVC?
Combining multiple scripts or stylesheets into a single bundle
Caching views
Minimizing routing
Combining models
Q140
Q140 How does caching improve performance in ASP.NET MVC?
By storing frequently used data
By validating model bindings
By optimizing Razor syntax
By managing routes dynamically
Q141
Q141 What is output caching in ASP.NET MVC?
Storing HTML responses for reuse
Caching database queries
Caching controller actions
Storing Razor syntax
Q142
Q142 How do you enable output caching for an action in ASP.NET MVC?
Use the [Cache] attribute
Use the [OutputCache] attribute
Define caching in Web.config
Set caching in RouteConfig
Q143
Q143 How do you implement bundling in ASP.NET MVC?
Add bundles in the BundleConfig.cs file
Define bundles in RouteConfig
Use the @Html.Bundle() method
Add bundles in the controller
Q144
Q144 Bundling is not working in production. What could be the issue?
Minification is disabled
Debug mode is enabled
BundleConfig is missing
All of the above
Q145
Q145 Cached data is not being updated after changes. What could be the issue?
Cache duration is too long
Controller action is missing
OutputCache is invalid
BundleConfig is incorrect
Q146
Q146 What is the purpose of unit testing in ASP.NET MVC?
Test database performance
Test individual components
Test Razor syntax
Test server configurations
Q147
Q147 How does Dependency Injection improve testability in ASP.NET MVC?
By enabling the use of mocks
By reducing database calls
By optimizing routes
By simplifying view rendering
Q148
Q148 What is the role of a mocking framework in unit testing?
It handles routing
It creates fake dependencies
It validates Razor syntax
It simplifies model binding
Q149
Q149 How do you test a controller action using NUnit?
Create a mock HttpContext
Call the action directly and assert the result
Use RouteConfig to define the test
Create a Razor view for testing
Q150
Q150 How do you mock a DbContext for unit testing?
Use InMemoryDatabase
Use a mocking library
Manually create stubs
Both A and B

