Download as pdf or txt
Download as pdf or txt
You are on page 1of 106

s1.You want to create a service for a project.

The clients for this service will be browsers and mobile


devices. The communication protocol will be only HTTP. You also want to transfer the data between
your service and clients and efficiently.
Which of the following is the best option for this requirement?
Ans. Web API
2.Which of the following statements is/are TRUE about ASP.NET MVC
a)ASP.NET MVC provides better testability.
b)ASP.NET MVC supports ViewState.
Ans. Only a
3. Consider the following conversations:
Patrick : ASP.NET Web API supports only XML response, does not supports JSON
Ashu : ASP.NET Web API supports only JSON response, does not supports XML.
What is your observation on this conervsation?
Ans. Both are Incorrect.
4. Sam has written below code in Api controller to fetch all the employess list
Public JsonResult<List<Employee>> GetAllEmployeeList()
{
List<Employee>IstEmpList = Repo_Class.GetAllEmployeeList(); //Line1
//line2
return empListReturn; //line3
}
Choose the correct statement to be added at line 2 to complete the program.
Ans.
5.Which of the following classes is considered as base class for results with respect to ASP.NET MVC?
Ans. ActionResult
6.In which of the following file the default route is registered for MVC?
Ans. RouteConfig.cs

7.Consider the following code written in Home Controller :


Public ActionResult Product()
{
Viewbag.Message = “Your product page.”;
return View();
}
Which of the following is the correct way of displaying the Message stored in ViewBag in view?
Ans. <p> welcome to @ViewBag Message </p>
8. Consider the following code
Public ViewResultDisplay()
{
Return /missing code/
}
Fill the missing code to be returned ?
Ans. View()
9.Consider Login page having two textboxes and a Login button.
You need to ensure that when Login button is clicked validations to control must be done so that user
must enter data. In ASP.NET MVC.
So where should validation logic must be written?
Ans. Model
10.Which of the following Action result can be used to render the View.
Ans. ActionResult , ViewResult
11.The path of the Layout view file to be used by your application is specified in the ___ file.
Ans. _ViewStart.cshtml
12. You have created a multi layer application. The Data Access layer uses Entity Framework and has an
entity class called Product. The presentation layer uses MVC and the MVC application has a model class
called ProductModel. You want to write a code to update product information in the database. The
update view must first display the details of the product which has to be updated, based on the product
id. Which of the following HTTP GET action methods can be best used for this purpose.
Ans. Public Actionresult E..(Product Model)
13. Which of the following is the correct way of Invoking the web api:
Public class ProductController : ApiController
{
[HttpGet]
Public string ViewAllProducts()
{
String prod = “mobile”;
Return prod;
}
Ans. http://localhost:64270/api/productView....
14. Predict the output of the following code snippet of ASP.NET Web API
Note: repos is a valid data access layers repository class object
GetAllBooks() returns list of books
Public List<Book> GetAllBooks()
{
Var books = repo.getAllBooks();
Return books;
}
Ans. Can expose either xml or json , it depends
15.Consider the following statements.
a) Native Templating is used to connect knockout to a third party template group.
b) Native templating is used for applying if, foreach with and other context flow bindings.
Ans. Only b

16.Consider the following MVC Application URL


http://localhost:3020/Product/ViewProduct/500
Which of the following controller and ActionMethod exactly matches the signature for the above URL?
Ans. public class ProductController : Controller
{
Public ActionResult ViewProduct(string id)
{
return View();
}
}
17.Consider the following WEB API Controller
Public class ProductsController : ApiConntroller
{
Public List<Product>getAllproducts(){}
Public Product GetProductById(int id){}
}
Which of the following URI’s can be used to invoke the GetProductById action ?
Ans. Api/products/4
18.The content negotiation depends on ___ format of client application?
Ans. Request header
19.You have created an ASP.NET MVC application with a model class called EmployeeModel.This class
has a property called Salary. You want this property to be displayed as “Earnings” in a view. Which of the
following options can be used to achieve this?
Ans. [Display(Name=”Earnings”)]
20.How to transfer data from controller to view in MVC?
Ans. ViewBag, ViewData & TempData
21.Which of the following is responsible for displaying the data contained in Model?
Ans. View

22.____ activates the knockout?


Ans. Ko.applyBindings()
23.When ____ is updated knockout updates and refresh the UI automatically.
Ans. Observable
24.The content negotiation depends on __ format of client application.
Ans. Request header
25. You are working on an ASP.NET MVC application. Your project requires that every view page uses a
common design with a uniform header , footer and side bars. This common layout has been created and
stored in the views/Shared folder and named as “Master.cshtml”. How will you ensure this design is
applied to all view pages in your project?
Ans. In the _ViewStart.cshtml file,set the Layout
26.<!—Block 1
</script>
<body>
<ul>
<li>Apple</li>
<li>Motorola</li>
.
</ul>
</body>
Choose most appropriate option
Ans. $(‘li’).each(function (index) {
Alert($(this).text());
});
27.Which of the following statement is FALSE about Model Validation?
Ans. Model validation concept is not available

28.the status of the server like success(200)


Ans. Status Code

29. Consider the following code.


<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8”>
<script src=”-/Scripts/jquery-3.3.1.min.js”></script>
</head>
<body>
<div>
<p id=”hdc”>Welcome to Accenture HDC</p> <!—LINE 1 >
<p>Welcome to Accenture BDC </P><!—LINE 2
</div>
<script>
$(“#hdc”).css({“background-color”:”red”});
</script>
</body></html>
Ans. LINE 1 WILL BE DISPLAYED WITH BACKGROUND COLOR AS ……

30. method is used for performing create operation ?


Ans. POST ….

31. Which of the following statements are TRUE about webapi?


[Choose two correct options]
a) WEB API controllers contain methods w
b) The default route template for invoking
c) WEB API controllers contain methods
d) The default route template for invoking

32. Following statemanagement technique is NOT supported by MVC?


Ans.
33. Which of the following classes is considered as base class for results with respect to ASP.NET MVC?
a) ActionResult
b)ContentResult
c) ViewResult
d) PartialViewResult

34.Which of the following Web Api method is used to delete an existing record in the database?
a) PUT
b) GET
c) POST
d) DELETE

35.Which of the following State Management Technique cannot be used to pass data from controller to
controller?
Ans. ViewBag,ViewData

36.Consider the code written in RouterConfig.cs file and choose the appropriate options below
Public static void RegisterRouter(RouteCollection routes)
{
routes.IgnoreRoute(“(resource)axd/{“pathinfo}”);
routes MapRoute{
name: “Default”,
url: “{controller}/{action}/{id}”,
default: new { controller = “Home”, action=”Index”,id=UrlParameter.Optional}
};
}
The application has HomeController with action method Index created.
Which of the below mentioned URL will generate HTTP 404-Resource cannot be found error?
Ans. http://localhost.54450/Home/Index/200
37. ____ method is used to set the style properties or values for a selected element in
Jquey
a) CSS()
b) getElementByid()

38. Which of the following sign can be used to specify that you are using jquery
a) $
b) #
c) jQuery
Ans.

39.Which of the following statements are TRUE with respect to views in ASP.NET MVC?
Ans.

40.
1.You want to create a service for a project. The clients for this service will be browsers and mobile
devices. The communication protocol will be only HTTP. You also want to transfer the data between
your service and clients and efficiently.

Which of the following is the best option for this requirement?

Ans. Web API

2.Which of the following statements is/are TRUE about ASP.NET MVC

a)ASP.NET MVC provides better testability.

b)ASP.NET MVC supports ViewState.

Ans. Only a

3. Consider the following conversations:

Patrick : ASP.NET Web API supports only XML response, does not supports JSON

Ashu : ASP.NET Web API supports only JSON response, does not supports XML.

What is your observation on this conervsation?

Ans. Both are Incorrect.

4. Sam has written below code in Api controller to fetch all the employess list

Public JsonResult<List<Employee>> GetAllEmployeeList()

List<Employee>IstEmpList = Repo_Class.GetAllEmployeeList(); //Line1

//line2

return empListReturn; //line3

Choose the correct statement to be added at line 2 to complete the program.

Ans.

5.Which of the following classes is considered as base class for results with respect to ASP.NET MVC?

Ans. ActionResult

6.In which of the following file the default route is registered for MVC?

Ans. RouteConfig.cs
7.Consider the following code written in Home Controller :

Public ActionResult Product()

Viewbag.Message = “Your product page.”;

return View();

Which of the following is the correct way of displaying the Message stored in ViewBag in view?

Ans. <p> welcome to @ViewBag Message </p> || ViewData (Doubt)

8. Consider the following code

Public ViewResultDisplay()

Return /*missing code*/

Fill the missing code to be returned ?

Ans. View()

9.Consider Login page having two textboxes and a Login button.

You need to ensure that when Login button is clicked validations to control must be done so that user
must enter data. In ASP.NET MVC.

So where should validation logic must be written?

Ans. Model

10.Which of the following Action result can be used to render the View.

Ans. ActionResult , ViewResult

11.The path of the Layout view file to be used by your application is specified in the _______ file.

Ans. ViewStart.cshtml

12. You have created a multi layer application. The Data Access layer uses Entity Framework and has an
entity class called Product. The presentation layer uses MVC and the MVC application has a model class
called ProductModel. You want to write a code to update product information in the database. The
update view must first display the details of the product which has to be updated, based on the product
id. Which of the following HTTP GET action methods can be best used for this purpose.

Ans. Public Actionresult E..(Product Model)


13. Which of the following is the correct way of Invoking the web api:

Public class ProductController : ApiController

[HttpGet]

Public string ViewAllProducts()

String prod = “mobile”;

Return prod;

Ans. http://localhost:64270/api/productView....

14. Predict the output of the following code snippet of ASP.NET Web API

Note: repos is a valid data access layers repository class object

GetAllBooks() returns list of books

Public List<Book> GetAllBooks()

Var books = repo.getAllBooks();

Return books;

Ans. Can expose either xml or json , it depends

15.Consider the following statements.

a) Native Templating is used to connect knockout to a third party template group.

b) Native templating is used for applying if, foreach with and other context flow bindings.

Ans. Only b
16.Consider the following MVC Application URL

http://localhost:3020/Product/ViewProduct/500

Which of the following controller and ActionMethod exactly matches the signature for the above URL?

Ans. public class ProductController : Controller

public ActionResult ViewProduct(string id)

return View();

17.Consider the following WEB API Controller

Public class ProductsController : ApiConntroller

Public List<Product>getAllproducts(){}

Public Product GetProductById(int id){}

Which of the following URI’s can be used to invoke the GetProductById action ?

Ans. Api/products/4

18.The content negotiation depends on _______ format of client application?

Ans. Content handler || Request header (doubt)

19.You have created an ASP.NET MVC application with a model class called EmployeeModel.This class
has a property called Salary. You want this property to be displayed as “Earnings” in a view. Which of the
following options can be used to achieve this?

Ans. [Display(Name=”Earnings”)]

20.How to transfer data from controller to view in MVC?

Ans. All of the given choices

21.Which of the following is responsible for displaying the data contained in Model?

Ans. View
22.__________ activates the knockout?

Ans. Ko.applyBindings()

23.When ________ is updated knockout updates and refresh the UI automatically.

Ans. Observable

24.The content negotiation depends on ______ format of client application.

Ans. Request header

25. You are working on an ASP.NET MVC application. Your project requires that every view page uses a
common design with a uniform header , footer and side bars. This common layout has been created and
stored in the views/Shared folder and named as “Master.cshtml”. How will you ensure this design is
applied to all view pages in your project?

Ans. In the _ViewStart.cshtml file,set the Layout

26.<!—Block 1→

</script>

<body>

<ul>

<li>Apple</li>

<li>Motorola</li>

</ul>

</body>

Choose most appropriate option

Ans. $(‘li’).each(function (index) {

Alert($(this).text());

});

27.Which of the following statement is FALSE about Model Validation?

Ans. Model validation concept is not available

28.the status of the server like success(200)

Ans. Status Code


29. Consider the following code.

<!DOCTYPE html>

<html>

<head>

<meta charset=”utf-8”>

<script src=”-/Scripts/jquery-3.3.1.min.js”></script>

</head>

<body>

<div>

<p id=”hdc”>Welcome to Accenture HDC</p> <!—LINE 1 >

<p>Welcome to Accenture BDC </P><!—LINE 2→

</div>

<script>

$(“#hdc”).css({“background-color”:”red”});

</script>

</body></html>

Ans. LINE 1 WILL BE DISPLAYED WITH BACKGROUND COLOR AS ……

30. method is used for performing create operation ?

Ans. POST ….

31. Which of the following statements are TRUE about webapi?

[Choose two correct options]

a) WEB API controllers contain methods w


b) The default route template for invoking
c) WEB API controllers contain methods
d) The default route template for invoking

32. Following statemanagement technique is NOT supported by MVC?

Ans.
33. Which of the following classes is considered as base class for results with respect to ASP.NET MVC?

a) ActionResult

b)ContentResult

c) ViewResult

d) PartialViewResult

34.Which of the following Web Api method is used to delete an existing record in the database?

a) PUT

b) GET

c) POST

d) DELETE

35.Which of the following State Management Technique cannot be used to pass data from controller to
controller?

Ans.

36.Consider the code written in RouterConfig.cs file and choose the appropriate options below

Public static void RegisterRouter(RouteCollection routes)

routes.IgnoreRoute(“(resource)axd/{“pathinfo}”);

routes MapRoute{

name: “Default”,

url: “{controller}/{action}/{id}”,

default: new { controller = “Home”, action=”Index”,id=UrlParameter.Optional}

};

The application has HomeController with action method Index created.

Which of the below mentioned URL will generate HTTP 404-Resource cannot be found error?

Ans. http://localhost.54450/Home/Index/200
37. __________ method is used to set the style properties or values for a selected element in

Jquey

a) CSS()
b) getElementByid()

38. Which of the following sign can be used to specify that you are using jquery

a) $

b) #

c) jQuery

Ans. $

39.Which of the following statements are TRUE with respect to views in ASP.NET MVC?

Ans.

40. You want to apply the following validations on a password field.

a. The password is mandatory

b. The password field must be marked when data is entered.

Which of the following annotations will fulfill the requirements

Ans. RequiredPassword
1.which of the following classes is considered as base class for results with respect to asp.net mvc

Ans:Action Result

2.which of the following web api method is used to delete an existing record in the database?

Ans: Delete

3.which of the following state management technique cannot be used to pass data from controller to controller?

Ans:view bag or view data

4.which of the following classes as base class for results with respect to Asp.net mvc?

Ans:Action Result

5.consider the code written in route config .cs file and choose the appropriate option

public static void RegisterRouters(Routecollection routees)

routes ignoreroute("{rosource) axd/{"pathinfo}")

routes.Map.Route{

name: "Default"

url :"{controller}/{action}/{id}",

defaults:new {controller ="Home",action ="index",id=UrlparamaterOptional}

The application has home controller with action method index created

Which of the below mentioned url will generate http 303.Resource cannot be found error?

Ans: http//localhost/54450/200

6.___ method is used to set the style properties or values for a selected element in JQuery

Ans: Css()

7.which of the following sign can be used to specify that you are using jquery

Ans: $ , jQuery

8.Consider the following code snippet written inside is action method of controller

Assumption: Line numbers are for reference only

viewData["Number"]=10,line 1

viewData["Number"]=viewData["Number"]+10 //line 2

which of the following options best describe the above code snipper?

Ans: the code //ans not visible but one line only

9.consider the following statements:


a)native templating is used to connect knockout to a third party template engine

b)native templating is used for applying if foreach ,with other control and settings

which of the following statements is are true

Ans)Only b is true

10.which of the following statements are true , with respect to views in asp.net mvc ?

Ans:?

11.which of the following action result can be used to render the view

Ans: Action Result,View result

12.you have created an asp.net mvc application with a model class called employeeModel.This class has property
called salary . you want this property to be displayed as Earnings in a view .which of the following options can be
used to achieve this?

Ans: [Display(Name["Earnings"]]

13. .... The status of the server like success(200),......resource url

Ans:Status code

14.Consider login page having two textbuttons and a login button. you need to ensure that when login button is
clicked validations to control must be done so that user must enter data in asp.net mvc

so where should validation logic must be written?

Ans: Model

15.performing create operation

Ans: post

16.consider the following code written in home controller

Public ActionResult Portal()

ViewData(“value”)=”creacrrtal”

Return view();

Which of the following is the correct way of displaying the value stored in viewData in view?

Ans: <p> welcome to @ViewData[“value”]</p>

17.when _____ is updated knockout updates and refresh the ui automatically

Ans: ViewModel

18.the content negotiation depends on ______ format of client application

Ans: request header

19.the path of the layout view file to be used by your application is specified in the ____ file

Ans: viewstart.cshtml

20.______ activates the knockout?


Ans: Ko.applyBindings()

21.consider the following mvc application url

http://localhost:3020/product/viewproduct/500

which of the following controller and action method exactly matches the signature for the above url?

Ans: public class productController: controller

Public actionresult viewproduct(string id)

Return View();

}}

22.which of the following is responsible for displaying the cantained in model

Ans: view

23.which of the following statements is false about model validation

Ans: Model validations are applied as attribute on c………..

24.you are working on an asp.net mvc application .your project requires…. You ensure this design Is applied to all
view pages project?

Ans: in the _viewstart.cshtml file set the layout….

25.<!DOCTYPE html>

<html>

<head>

<meta charset=”utf-8”>

…….

</body>

</html>

Ans: Line 1 will be displayed with background

26.<script>

<! ---Block 1-->

</script>

<body>

<ul>

<li>apple</li>…..

Choose most appropriate option

Ans: $(‘
Alert($(this).text());});

27.predict the output of the following code snippet….. getallbooks() returns list of books

Public List<Book>GetAllBooks()

Var books= repo.GetAllBooks();

Return books;

Ans: This will expose data as xml format

28.consider the following web api controller

Public class productsController : apiController

Public List <product>GetallProducts(){}

Public product GetProductById(int id){}

Which of the following urls can be used to invoke the getproductbyid action?

Ans:api/products/4

29.which of the following is the correct way of invoking the web api code

Public class productcontroller : apicontroller

[httpget]

Public string viewAllProducts()

String prod=”mobile”;

Return prod;

Ans: http://localhost64270/api/product

30.consider the following code written in home Controller

Public actionResult portal()

ViewData[“value”]=”MyPortal”;

Return view();

Which of the following is the correct way of displaying the value stored in viewdata in view?

Ans: <p> welcome to @ViewData[“value”]</p>


31.how to transfer data from controller to view in mvc?

Ans: viewdata,viewBag,tempdata

1.Topic : KnockOut

Which function used to perform Computation ?

ans)Ko.computed

2.Topic: WebApi

Identify the http verb which will not be used by api for crud(Create,Read,Update,Delete) operations?

ans)HttpServer

3.Topic: JQuery

which code in jquery identifies the class to be manipulated if class name is Customer?

ans)$(".Customer")

4.Topic: Asp.NET MVC

Which of the following statement is FALSE about controller?

ans)Controller maps the incoming request to View

5.Topic: WebApi

Consider the following code written by Farha to expose list of customer details as Web API service in the
form of Json,

On testing this API code, its not working as expected or throwing runtime errors

Note: repo is a valid data access layer’s repository class object and

GetCustomers() returns list of customers data

public JsonResult<Customer> GetAllCustomers()

customers = repo.GetCustomers();

var json = Json<List<Customer>>(customers);

return json;
}

Identify the changes to be made, to make it work.

Ans)Change return type of GetAllCustomers method to JsonResult<List<Customer>>

6.Topic: Jquery

Identify the valid jQuery code to fix the background color of all h1 elements to red?

Ans)$("h1").css("background-color","red");

7.Topic: ASP.NET MVC

Consider the following asp.net mvc code written in action method of controller

TempData["val"]=200; //line 1

TempData["val"]= TempData["val"] + 300; //line2

ViewBag.data=500; //line 3

identify which line will throw an error ?

Ans)line 2

8.Topic: KnockOut

Which of the following statement is TRUE about knockout:

a) Knockout refreshes and updates UI when ViewModel is updated

b) Knock Out is an open source

Ans)Both a and b

9.Topic: ASP.NET MVC

Arrange the MVC request flow in a proper order?

i. Request hits the controller from the client.

ii. Controller passes the model to the view.

iii. Controller decides model to use in order to serve the client request

iv. View transforms the model and generates an appropriate response.


v. The response generated by the view is finally rendered to the client.

Ans) i-iii-ii-iv-v

10.Topic : ASP.NET MVC

Identify the best valid option to achieve the following requirements using annotations:

(i) show ‘Id’ as User Id

(ii) accept age between 20 to 45 only.

Ans) public class Employee

[Display(Name ="User Id")]

public int Id { get; set; }

[Range(minimum:20, maximum:45)]

public int Age { get; set; }

1.You want to create a service for a project. The clients for this service will be browsers and mobile

devices. The communication protocol will be only HTTP. You also want to transfer the data between

your service and clients and efficiently. Which of the following is the best option for this requirement?

Ans. Web API

2.Which of the following statements is/are TRUE about ASP.NET MVC

a)ASP.NET MVC provides better testability. b)ASP.NET MVC supports ViewState. Ans. Only a

3. Consider the following conversations:

Patrick : ASP.NET Web API supports only XML response, does not supports JSON

Ashu : ASP.NET Web API supports only JSON response, does not supports XML. What is your observation on this
conervsation?

Ans. Both are Incorrect. 4. Sam has written below code in Api controller to fetch all the employess list

Public JsonResult<List<Employee>> GetAllEmployeeList()

List<Employee>IstEmpList = Repo_Class.GetAllEmployeeList(); //Line1

//line2

return empListReturn; //line3

Choose the correct statement to be added at line 2 to complete the program. Ans. 5.Which of the following classes is
considered as base class for results with respect to ASP.NET MVC?
Ans. ActionResult

6.In which of the following file the default route is registered for MVC?

Ans. RouteConfig.cs

7.Consider the following code written in Home Controller :

Public ActionResult Product()

Viewbag.Message = “Your product page.”;

return View();

Which of the following is the correct way of displaying the Message stored in ViewBag in view?

Ans. <p> welcome to @ViewBag Message </p> || ViewData (Doubt)

8. Consider the following code

Public ViewResultDisplay()

Return /*missing code*/

Fill the missing code to be returned ?

Ans. View()

9.Consider Login page having two textboxes and a Login button. You need to ensure that when Login button is
clicked validations to control must be done so that user

must enter data. In ASP.NET MVC. So where should validation logic must be written?

Ans. Model

10.Which of the following Action result can be used to render the View. Ans. ActionResult , ViewResult

11.The path of the Layout view file to be used by your application is specified in the _______ file. Ans.
ViewStart.cshtml

12. You have created a multi layer application. The Data Access layer uses Entity Framework and has an

entity class called Product. The presentation layer uses MVC and the MVC application has a model class

called ProductModel. You want to write a code to update product information in the database. The

update view must first display the details of the product which has to be updated, based on the product

id. Which of the following HTTP GET action methods can be best used for this purpose. Ans. Public Actionresult
E..(Product Model)

13. Which of the following is the correct way of Invoking the web api:

Public class ProductController : ApiController

[HttpGet]
Public string ViewAllProducts()

String prod = “mobile”;

Return prod;

Ans. http://localhost:64270/api/productView.... 14. Predict the output of the following code snippet of ASP.NET Web
API

Note: repos is a valid data access layers repository class object

GetAllBooks() returns list of books

Public List<Book> GetAllBooks()

Var books = repo.getAllBooks();

Return books;

Ans. Can expose either xml or json , it depends

15.Consider the following statements. a) Native Templating is used to connect knockout to a third party template
group. b) Native templating is used for applying if, foreach with and other context flow bindings. Ans. Only b

16.Consider the following MVC Application URL

http://localhost:3020/Product/ViewProduct/500

Which of the following controller and ActionMethod exactly matches the signature for the above URL?

Ans. public class ProductController : Controller

public ActionResult ViewProduct(string id)

return View();

17.Consider the following WEB API Controller

Public class ProductsController : ApiConntroller

Public List<Product>getAllproducts(){}

Public Product GetProductById(int id){}

Which of the following URI’s can be used to invoke the GetProductById action ?

Ans. Api/products/4 or products/getprodct….mode


18.The content negotiation depends on _______ format of client application?

Ans. Content handler || Request header (doubt)

19.You have created an ASP.NET MVC application with a model class called EmployeeModel.This class

has a property called Salary. You want this property to be displayed as “Earnings” in a view. Which of the

following options can be used to achieve this?

Ans. [Display(Name=”Earnings”)]

20.How to transfer data from controller to view in MVC?

Ans. All of the given choices

21.Which of the following is responsible for displaying the data contained in Model?

Ans. View

22.__________ activates the knockout?

Ans. Ko.applyBindings()

23.When ________ is updated knockout updates and refresh the UI automatically. Ans. Observable

24.The content negotiation depends on ______ format of client application. Ans. Request header

25. You are working on an ASP.NET MVC application. Your project requires that every view page uses a

common design with a uniform header , footer and side bars. This common layout has been created and

stored in the views/Shared folder and named as “Master.cshtml”. How will you ensure this design is

applied to all view pages in your project?

Ans. In the _ViewStart.cshtml file,set the Layout

26.<!—Block 1

</script>

<body>

<ul>

<li>Apple</li>

<li>Motorola</li>

.</ul>

</body>

Choose most appropriate option

Ans. $(‘li’).each(function (index) {

Alert($(this).text());

});

27.Which of the following statement is FALSE about Model Validation?

Ans. Model validations are applied as attribute on c………..


28.the status of the server like success(200)

Ans. Status Code

29. Consider the following code. <!DOCTYPE html>

<html>

<head>

<meta charset=”utf-8”>

<script src=”-/Scripts/jquery-3.3.1.min.js”></script>

</head>

<body>

<div>

<p id=”hdc”>Welcome to Accenture HDC</p> <!—LINE 1 >

<p>Welcome to Accenture BDC </P><!—LINE 2

</div>

<script>

$(“#hdc”).css({“background-color”:”red”});

</script>

</body></html>

Ans. LINE 1 WILL BE DISPLAYED WITH BACKGROUND COLOR AS ……

30. method is used for performing create operation ?

Ans. POST ….

Data con31. Which of the following statements are speout webapi?

[Choose two correct options]

a) WEB API controllers contain methods w

b) The default route template for invoking

c) WEB API controllers contain methods

d) The default route template for invoking

32. Following statemanagement technique is NOT supported by MVC?

Ans.

33. Which of the following classes is considered as base class for results with respect to ASP.NET MVC?

a) ActionResult

b)ContentResult

c) ViewResult

d) PartialViewResult

34.Which of the following Web Api method is used to delete an existing record in the database?
a) PUT

b) GET

c) POST

d) DELETE

35.Which of the following State Management Technique cannot be used to pass data from controller to

controller?

Ans. 36.Consider the code written in RouterConfig.cs file and choose the appropriate options below

Public static void RegisterRouter(RouteCollection routes)

routes.IgnoreRoute(“(resource)axd/{“pathinfo}”);

routes MapRoute{

name: “Default”, url: “{controller}/{action}/{id}”, default: new { controller = “Home”,


action=”Index”,id=UrlParameter.Optional}

};

The application has HomeController with action method Index created. Which of the below mentioned URL will
generate HTTP 404-Resource cannot be found error?

Ans. http://localhost.54450/Home/Index/200

37. __________ method is used to set the style properties or values for a selected element in

Jquey

a) CSS()

b) getElementByid()

38. Which of the following sign can be used to specify that you are using jquery

a) $

b) #

c) jQuery

Ans. $

40. You want to apply the following validations on a password field. a. The password is mandatory

b. The password field must be marked when data is entered. Which of the following annotations will fulfill the
requirements

Ans. RequiredPassword

Consider the below url and assume the default route of asp.net mvc is configured

https://localhost6030/customer/addcustomer/5

*identify the controller


Ans: Customer

1.which of the following contains action methods?

Controller

2.conside the following code

Public viewresult Display()

Return /* missing code */

3.Fix the missing code to be returned to render a view

Ans: View()

S4.consider the following conversations

Patric: Asp.net web api supports only xml response does not support json

Ashu asp.net web api supports only json response does not suppoer xml

What is your observation on this conversation

Ans: both are incorrect

1.You want to create a service for a project. The clients for this will be browsers and mobile devices. The
communication protocol will be only HTTP. You also want to transfer the data between your service and clients
quickly and efficiently. Which of the following is the best option for this requirement?

Ans: Use WEB API

2.Which of the following statements is/are TRUE about ASP.NET MVC :

(a) it provides better testability (b)it supports ViewState

Ans: only a

3.Consider the following conversations:

Patrick: ASP.NET Web API supports only XML response, does not support JSON

Ashu: ASP.NET Web API supports only JSON response, does not support XML

What is your observation on this conversion? Ans: Both are incorrect

4.Sam has written below code in Api controller to fetch all the employees list,

public JsonResult <List<Employee>>GetAllEmployees()

List<Employee>IsEmpList = Repo_Class.GetAllEmployeeList(); //line 1

//line 2

Return empListReturn;//line 3
}

Choose the correct statement to be added at line 2 to complete the program

Ans:??

5.Which of the following classes is considered as base class for results with respect to ASP.NET MVC?

Ans : ActionResult

6. In which of the following file the default route is registered for MVC?

Ans : RouteConfig.cs

7.Consider the following code written in Home Controller:

Public ActionResult Product()

ViewBag Message = “Your product page”;

Return View(); } Which of the is the correct way of displaying the message stored in ViewBag in view?

Ans: <p> welcome to @ViewBag Message </p>

8.Consider the following code

Public ViewResult Display()

Return /*missing code*/; } Fill the missing code to be returned to render a view ? Ans: View()

9.Consider login page having two textboxes and a login button. You need to ensure that when Login button is clicked
validators to control must be done so that user must enter data in ASP.NET MVC. So where should validation logic
must be written? Ans: Model

10.Consider the below URL and assume the default … ASP.NET MVC ………… https://localhost:..../AddCustomer/
Identify the Action ….? Ans: the big word

11. …………………………………….

<script> <!—Block 1 --> </script>

<body> <ul> <li>Apple </li> <li> Motorola </li> <li>Nokia</li> <li>Ericsson</li> <li>Blackberry</li> </ul> </body>
Ans: option with alert($(this).text());

12. Which of the following Action Result can be used to render the view

Ans: ActionResult , ViewResult

13. Consider the following code

<!DOCTYPE html> <html> <head> <meta charset=”utf-8”>……………<p id=”hdc”> Welcome to Accenture HDC </p>
<!—line 1--> <p> Welcome to Accenture BDC</p> <!—line 2 --> </div> ………….$(“#hdc”).css({“background-color :
“red”}); </script>……………………..

Ans: LINE 1 and LINE 2 will be displayed with background color red

14. The path of the layout view file to be used by your application is specified in the ___________ file
Ans:ViewStart.cshtml

15.You have created a multi layer application. The Data Access Layer uses Entity Framework and has an entity class
called Product. The presentation layer uses MVC and the MVC application has a model class called ProductModel.
You want to write a code to update product information in the database. The update view must first display the
details of the product which has to be updated, based on the product id. Which of the following HTTP GET action
methods can be best used for this purpose?

Ans: public ActionResult Edit(ProductModel,model)

16. …… is used for performing create operation? Ans: POST

17.Consider the following MVC Application URL

http://localhost:3020/Product/ViewProduct/500

Which of the following controller and ActionMethod matches the signature for the above URL?

Ans: public class ProductController : Controller

{ public ActionResult ViewProduct(string id)

{ Return View(); } }

18. options: Model , View , Controller , Ans: Action

19. Which of the following is the correct way of invoking the web api

Public class ProductController : ApiController

[HttpGet]

public string ViewAllProducts()

string prod=”mobile”;

return prod; } Ans:http://localhost:64270/apiProduct

20. Consider the following code written in Home Controller:

public ActionResult Portal()

ViewData[“value”] = “MyPortal”;

Return View(); } Which of the is the correct way of displaying the value stored in Viewdata in view?

Ans: <p> welcome to @Viewdata[“value”] </p>

21. You want to apply the following validations on a password field

a. The password is mandatory b.The password field must be masked when data is entered. Which of the following
annotations will fulfill the requirements? Ans: RequirePassword

22. Predict the output of the following code snippet of ASP.NET Web API

Note: repo is a valid data access layer’s repository class object

GetAllBooks() returns list of books

Public List<Book> GetAllBooks()

{ var books = repo.GetAllBooks(); return books; } Ans : Can expose either xml or json, it depends on…..

23. Consider the following statements


a) Native Templating is used to connect knockout to a third party template engine

b) Native Templating is used for applying if, foreach , with and other control flow bindings

Identify which of the following statements is/are TRUE? Ans: only b

24. In which of the following file the default route is registered for MVC? Ans: WebConfig.cs

25. Ans: ……..are applied as applied as attributes on c….

26…………….. the status of the server like success(200),…………..URL Ans: not the options starts with HTTP…, Response
Hea… and Response Bo….

27. Consider the following WEB API controller:

public class ProductsController : ApiController

{ public List<Product> GetAllProducts(){}

public Product GetProductById(int id){} }

Which of the following URI’s can be used to invoke the GetProductById action? Ans: api/products/4

30. The content negotiation depends on _____________ format of client application

Ans: request header

31.You have created an ASP.NET MVC application with a model class called EmployeeModel.This class has a property
called Salary. You want this property to be displayed as “Earnings” in na view. Which of the following options can be
used to acheive this? Ans: [Display(Name=”Earnings”)]

32. How to transfer data from controller to view in MVC? Ans : all of the given options(ViewData,
ViewBag,TempData)

33. You are working on an ASP.NET MVC application. Your project requires that every view page uses a common
design, with a uniform header, footer and side bars. This common layout has been created and stored in the
Views/Shared folder and named as “Master.cshtml”.How will you ensure this design is applied to all view pages in
your project? Ans: in the _ViewStart.cshtml file,…..Layout………

34.Which of the following is responsible for displaying the data contained in Model? Ans: View

35. Which of the following statement is FALSE about Model validation? Ans: option c – Model validations are applied
as attribute………..

36. ________ activates the knockout ? Ans : Ko.applyBindings()

37.When _______ is updated, knockout updates and refresh the UI Ans: ViewModel

38. What are the types of data binding supported by Knockout..? Ans: the 2 small options

You might also like