Microsoft TS: Web Applications Development with Microsoft .NET Framework 4 Sample Questions:
1. You are developing an ASP.Net MVC 2 view and controller.
The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server
database.
You need to cache the data that the action method returns.
What should you do?
A) Add the following <outputCacheSettings> section to the web.config file. <system.web> <caching> <outputCacheSettings> <outputCacheProfiles> <add name="ProductView" duration="60" varyByParam="*"/> </outputCacheProfiles> </outputCacheSettings> </caching> </system.web>
B) Add the following attribute to the action method [OutputCache(Duration=60)];
C) Add the following line of code to the controller. Cache.insert("key", "ProductView", null, DateTime.Now.AddMinutes(60),TimeSpan.Zero);
D) Add the following directive to the top of the view <%@ OutPutCache Duration="60" VaryByParam="*" %>
2. Which event of the GridView class occurs when the Edit button of a row is clicked, but before the GridView control enters edit mode?
A) RowEntered
B) RowEntering
C) RowEditing
D) RowEdited
3. You are developing an ASP.NET web page named WebPage.aspx.
The page includes a user control named UserInfoControl.ascx.
You need to expose a control property named FirstName and read its value from the page.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A) Add the following code segment to UserInfoControl.ascx.cs: protected string FirstName { get; set; }
B) Add the following code segment to UserInfoControl.ascx.cs: public string FirstName { get; set; }
C) Add the following code segment to WebPage.aspx.cs: var firstName = UserInfoControl1.FirstName;
D) Add the following code segment to WebPage.aspx.cs: var firstName = UserInfoControl1.Attributes["FirstName"];
4. Which control allows you to bind to data items that are returned from a data source and display them?
A) DetailsView Web Server Control
B) ListView Web Server Control
C) Data Web Server Control
D) DataList Web Server Control
5. You create a Web page that contains the following code.
<script type="text/javascript">
var lastId = 0; </script> <div class="File">
Choose a file to upload:
<input id="File0" name="File0" type="file" /> </div> <input id="AddFile" type="button" value="Add a File" /> <input id="Submit" type="submit" value="Upload" />
You need to provide the following implementation.
Each time the AddFile button is clicked, a new div element is created.
The new div element is appended after the other file upload div elements and before the AddFile span.
Each new element has a unique identifier.
Which code segment should you use?
A) $("#AddFile").click(function () { var id = "File" + ++lastId; var item = $(".File:first").clone(true); $("input:file", item).attr({ id: id, name: id }); item.insertBefore("#AddFile");
});
B) $("#AddFile").click(function () { var id = "File" + ++lastId; $(".File:first").clone(true).attr({ id: id, name: id }).insertBefore
("#AddFile");
});
C) $("#AddFile").click(function () { var id = "File" + ++lastId; var item = $(".File:first").clone(true); $("input:file", item).attr({ id: id, name: id }); item.insertAfter("input[type=file]");
});
D) $("#AddFile").click(function () {
var id = "File" + ++lastId;
});
Solutions:
| Question # 1 Answer: B | Question # 2 Answer: C | Question # 3 Answer: B,C | Question # 4 Answer: B | Question # 5 Answer: A |

We're so confident of our products that we provide no hassle product exchange.


By Elvira


