Microsoft TS: Web Applications Development with Microsoft .NET Framework 4 - 70-515 Exam Practice Test
You create a new ASP.NET MVC 2 Web application.
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference
only.)
01 public static void RegisterRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
05 routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller
= "Home", action = "Index", id = ""});
06 }
You implement a controller named HomeController that includes methods with the following signatures.
public ActionResult About() public ActionResult Index() public ActionResult Details(int id)
You need to ensure that the About action is invoked when the root URL of the site is accessed. What should you do?
The following default routes are created in the Global.asax.cs file. (Line numbers are included for reference
only.)
01 public static void RegisterRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
05 routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller
= "Home", action = "Index", id = ""});
06 }
You implement a controller named HomeController that includes methods with the following signatures.
public ActionResult About() public ActionResult Index() public ActionResult Details(int id)
You need to ensure that the About action is invoked when the root URL of the site is accessed. What should you do?
Correct Answer: B
You are implementing an ASP.NET AJAX page.
You add two UpdatePanel controls named pnlA and pnlB. pnlA contains an UpdatePanel control named
pnlAInner in its content template.
You have the following requirements.
Update panels pnlA and pnlB must refresh their content only when controls that they contain cause a postback.
Update panel pnlAInner must refresh its content when controls in either pnlA or pnlB or pnlAInner cause
a postback.
You need to configure the panels to meet the requirements. What should you do?
You add two UpdatePanel controls named pnlA and pnlB. pnlA contains an UpdatePanel control named
pnlAInner in its content template.
You have the following requirements.
Update panels pnlA and pnlB must refresh their content only when controls that they contain cause a postback.
Update panel pnlAInner must refresh its content when controls in either pnlA or pnlB or pnlAInner cause
a postback.
You need to configure the panels to meet the requirements. What should you do?
Correct Answer: C
You are implementing an ASP.NET MVC 2 Web application that contains the following class.
public class DepartmentController : Controller { static List<Department> departments = new List<Department>();
public ActionResult Index()
{
return View(departments);
}
public ActionResult Details(int id)
{
return View(departments.Find(x => x.ID==id));
}
public ActionResult ListEmployees(Department d)
{
List<Employee> employees = GetEmployees(d);
return View(employees);
} }
You create a strongly typed view that displays details for a Department instance.
You want the view to also include a listing of department employees.
You need to write a code segment that will call the ListEmployees action method and output the results in
place.
Which code segment should you use?
public class DepartmentController : Controller { static List<Department> departments = new List<Department>();
public ActionResult Index()
{
return View(departments);
}
public ActionResult Details(int id)
{
return View(departments.Find(x => x.ID==id));
}
public ActionResult ListEmployees(Department d)
{
List<Employee> employees = GetEmployees(d);
return View(employees);
} }
You create a strongly typed view that displays details for a Department instance.
You want the view to also include a listing of department employees.
You need to write a code segment that will call the ListEmployees action method and output the results in
place.
Which code segment should you use?
Correct Answer: C
Which directive defines master page-precise attributes that are used by the ASP.NET page parser and compiler?
Correct Answer: D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You are creating an ASP.NET web page that contains several FileUpload controls.
The page will be posted to the server after one or more image files are selected for upload.
You need to ensure that all uploaded files are saved to the server within one call to a single event handler.
What should you do?
The page will be posted to the server after one or more image files are selected for upload.
You need to ensure that all uploaded files are saved to the server within one call to a single event handler.
What should you do?
Correct Answer: A
ASP.net MVC dotn display a column Using LINQ to SQL class
[MetadataType(typeof(ProductMetadata))] public pertial class Product {
... }
public class ProductMetadata { ... }
[MetadataType(typeof(ProductMetadata))] public pertial class Product {
... }
public class ProductMetadata { ... }
Correct Answer: B
A library called contosobuisness.dll has been created and u need to accept it in a page.. all options had the <%assembly tag but the att differed
Correct Answer: D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You are implementing an ASP.NET MVC 2 application.
In the Areas folder, you add a subfolder named Product to create a single project area. You add files named ProductController.cs and Index.aspx to the appropriate subfolders. You then add a file named Route.cs to the Product folder that contains the following code. (Line numbers are included for reference only.)
01 public class Routes : AreaRegistration
02 {
03 public override string AreaName
04 {
05 get { return "product"; }
06 }
07
08 public override void RegisterArea(AreaRegistrationContext context)
09 {
10 context.MapRoute("product_default", "product/{controller}/{action}/
{id}", new { controller = "Product", action = "Index", id = "" });
11 }
12 }
When you load the URL http://<applicationname>/product, you discover that the correct page is not
returned.
You need to ensure that the correct page is returned.
What should you do?
In the Areas folder, you add a subfolder named Product to create a single project area. You add files named ProductController.cs and Index.aspx to the appropriate subfolders. You then add a file named Route.cs to the Product folder that contains the following code. (Line numbers are included for reference only.)
01 public class Routes : AreaRegistration
02 {
03 public override string AreaName
04 {
05 get { return "product"; }
06 }
07
08 public override void RegisterArea(AreaRegistrationContext context)
09 {
10 context.MapRoute("product_default", "product/{controller}/{action}/
{id}", new { controller = "Product", action = "Index", id = "" });
11 }
12 }
When you load the URL http://<applicationname>/product, you discover that the correct page is not
returned.
You need to ensure that the correct page is returned.
What should you do?
Correct Answer: B
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
You are developing an ASP.NET Web service.
The following code segment implements the service. (Line numbers are included for reference only.)
01 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
02 public class ProductService : System.Web.Services.WebService
03 {
04 [WebMethod]
05 public Product GetProduct(string name)
06 {
07
08 }
09
10 [WebMethod]
11 public Product GetProduct(int id)
12 {
13
14 }
15 }
You need to ensure that both GetProduct methods can be called from a Web client.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
The following code segment implements the service. (Line numbers are included for reference only.)
01 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
02 public class ProductService : System.Web.Services.WebService
03 {
04 [WebMethod]
05 public Product GetProduct(string name)
06 {
07
08 }
09
10 [WebMethod]
11 public Product GetProduct(int id)
12 {
13
14 }
15 }
You need to ensure that both GetProduct methods can be called from a Web client.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: B,C
You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The Web application comprises a class named Employee with properties named as First Name, Last
Name, and Age.
You add a Web page in which you get a list of Employee objects and display those objects in a GridView
control.
You are required to add code so that the GridView row is highlighted in red color if the age of the employee
is less than 21 years.
What will you do to accomplish this?
The company uses Visual Studio .NET 2010 as its application development platform.
You are creating an ASP.NET Web application using .NET Framework 4.0.
The Web application comprises a class named Employee with properties named as First Name, Last
Name, and Age.
You add a Web page in which you get a list of Employee objects and display those objects in a GridView
control.
You are required to add code so that the GridView row is highlighted in red color if the age of the employee
is less than 21 years.
What will you do to accomplish this?
Correct Answer: A
You are implementing an ASP.NET Web page
The page includes several controls, but only a GridView requires view state. You set the GridView...
You need to ensure that the page will omit unneeded view state.
Wich @ Page directive should you use?
The page includes several controls, but only a GridView requires view state. You set the GridView...
You need to ensure that the page will omit unneeded view state.
Wich @ Page directive should you use?
Correct Answer: C
A Web service returns a list of system users in the following format.
<xml version="1.0" > <users>
<user id="first">
<name>Name of first user</name>
<email>[email protected]</email>
</user>
<user id="second">
<name>Name of second user</name>
<email>[email protected]</email>
</user>
</users>
You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the
order provided by the service.
Which code segment should you use?
<xml version="1.0" > <users>
<user id="first">
<name>Name of first user</name>
<email>[email protected]</email>
</user>
<user id="second">
<name>Name of second user</name>
<email>[email protected]</email>
</user>
</users>
You need to populate a drop-down menu with the IDs and names of the users from the Web service, in the
order provided by the service.
Which code segment should you use?
Correct Answer: A
Which class is used to specify a set of features to support on the XmlReader object created by the Create method?
Correct Answer: B
You are developing an ASP.NET Web application.
The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that
compares strings without case sensitivity
You add the following method.(Line numbers are included for reference only.)
01 public IEnumerable<string>SortWords(string[] words)
02 {
03
04 }
You need to sort the array by word length and then by alphabetic order, ignoring case.
Which code segment should you add at line 03?
The application includes a Icomparer<string> implementation named CaseInsensitiveComparer that
compares strings without case sensitivity
You add the following method.(Line numbers are included for reference only.)
01 public IEnumerable<string>SortWords(string[] words)
02 {
03
04 }
You need to sort the array by word length and then by alphabetic order, ignoring case.
Which code segment should you add at line 03?
Correct Answer: A
You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
The Web application connects to a SQL Server database.
You use the ADO.NET Entity Framework to handle persistence-ignorant entities.
You create an ObjectContext object named ObjContext.
Subsequently, you change properties on numerous entities.
You are required to save the changed entity values in the SQL Server database.
Which of the following code segments will you use?
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
The Web application connects to a SQL Server database.
You use the ADO.NET Entity Framework to handle persistence-ignorant entities.
You create an ObjectContext object named ObjContext.
Subsequently, you change properties on numerous entities.
You are required to save the changed entity values in the SQL Server database.
Which of the following code segments will you use?
Correct Answer: D