News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

MCPD- Exam 70-515: Web Applications Development with Microsoft .NET Framework 4

public class Address
{
public int AddressType;
public string Line1;
public string Line2;
public string City;
public string ZipPostalCode;
}

The Web site interacts with an external data service that requires Address instances to be given in the following XML format.

<Address AddressType="2">
<Line1>250 Race Court</Line1>
<City>Chicago</City>
<PostalCode>60603</PostalCode>
</Address>

You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format requirements of the external data service. Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)

  1. Add the following attribute to the AddressType field.
    [XmlAttribute]

  2. Add the following attribute to the Line2 field.
    [XmlElement(IsNullable=true)]

  3. Add the following attribute to the ZipPostalCode field.
    [XmlAttribute("ZipCode")]

  4. Add the following attribute to the ZipPostalCode field.
    [XmlElement("ZipCode")]

Answer: Answer is a, d

public static void RegisterRoutes(RouteCollectionroutes) 
{  
  routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") { Action = PageAction.List,ViewName = "ListDetails",  Model = DefaultModel});

  routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") {Action = PageAction.Details,ViewName = "ListDetails",Model = DefaultModel});
}

You need to display the items in a table named Products by using a custom layout. What should you do?

  1. Add a new Web page named Products.aspx to the Dynamic Data\PageTemplates folder of the Web site.

  2. Add a new folder named Products to the Dynamic Data\CustomPages folder of the Web site. Add a new Web page named ListDetails.aspx to the Products folder.

  3. Add a new Web user control named Products.ascx to the Dynamic Data\Filters folder of the Web site.In the code-behind file for the control, change the base class from UserControl to System.Web.
    DynamicData.QueryableFilterUserControl.

  4. Add a new Web user control named Products_ListDetails.ascx to the Dynamic Data\EntityTemplates folder of the Web site. In the code-behind file for the control, chan

Answer: Answer is a

  1. Add a DynamicDataManager control to the Web page.

  2. Disable the auto-generated fields on GridView1. Add a DynamicField control for each field of the Product class.

  3. Add the following code segment to the Application_Start method in the Global.asax.cs file.

    DefaultModel.RegisterContext(typeof(System.Web.UI.WebControls.ObjectDataSource),new ContextConfiguration() {ScaffoldAllTables = true});
    
  4. Add the following code segment to the Page_Init method of the Web page

    GridView1.EnableDynamicData(typeof(Product));
    
Answer: Answer is b, d

  1. [Authorize(Users = "")]
  2. [Authorize(Roles = "")]
  3. [Authorize(Users = "*")]
  4. [Authorize(Roles = "*")]
Answer: Answer is a, b

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?

  1. At line 04 in the Global.asax.cs file, add the following line of code.

    routes.MapRoute("Default4Empty", "/", new {controller="Home", action="About"} );
    
  2. At line 04 in the Global.asax.cs file, add the following line of code.

    routes.MapRoute("Default", "", new { controller="Home", action="About"} );
    
  3. Replace line 05 in the Global.asax.cs file with the following line of code.

    routes.MapRoute(v "Default4Empty", "{controller}/{action}/{id}", new {controller="Home",  action="About", id=""} );
    
  4. Replace line 05 in the Global.asax.cs file with the following line of code.

    routes.MapRoute("Default", "{controller}/{action}", new {controller="Home", action ="About"});
    
Answer: Answer is c

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 Index()
public ActionResult Details(int id)
public ActionResult DetailsByUsername(string username)

You need to add a route to meet the following requirements. ?The details for a user must to be displayed when a user name is entered as the path by invoking the DetailsByUsername action. ? User names can contain alphanumeric characters and underscores, and can be between 3 and 20 characters long. What should you do?

  1. Replace line 05 with the following code segment

    routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "DetailsByUsername", id = "" });
    
  2. Replace line 05 with the following code segment.

    routes.MapRoute( "Default", "{controller}/{action}/{username}", new { controller = "Home", action = "DetailsByUsername", username = "" }, new { username = @"\w{3,20}" });
    
  3. At line 04, add the following code segment.

    routes.MapRoute("Details by Username", "{username}", new { controller = "Home", action = "DetailsByUsername" }, new { username = @"\w{3,20}" });
    
  4. At line 04, add the following code segment

    routes.MapRoute("Details by Username","{id}",new { controller = "Home", action = "DetailsByUsername" }, new { id = @"\w{3,20}" });
    
Answer: Answer is c

  1. Add the ValidateAntiForgeryToken attribute to the Details action method.

  2. Add the Bind attribute to the country parameter of the Details action method. Set the attribute's Prefix property to Country.

  3. Create a class that implements the IRouteConstraint interface. Configure the default route to use this class.

  4. Create a class that implements the IRouteHandler interface. Configure the default route to use this class.

Answer: Answer is c

public ActionResult Edit(int id)
{
return View(SelectUserToEdit(id));
}
public ActionResult Edit(Person person)
{
UpdateUser(person);
return RedirectToAction("Index");
}

The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details. An exception is thrown at run time stating that the request for action Edit is ambiguous. You need to correct this error and ensure that the controller functions as expected. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

  1. Add the following attribute to the first Edit action. [AcceptVerbs(HttpVerbs.Head)]

  2. Add the following attribute to the first Edit action. [HttpGet]

  3. Add the following attribute to the second Edit action. [HttpPost]

  4. Add the following attribute to the second Edit action. [HttpPut]

Answer: Answer is b, c

  1. Add the following method to the CompanyController class.

    public ActionResult INFO ()
    {
    return View();
    }
    
  2. Add the following method to the CompanyController class.

    public ActionResult Company_Info()
    {
    return View();
    }
    
  3. Right-click the Views folder, and select View from the Add submenu to create the view for the action.

  4. Right-click inside the action method in the CompanyController class, and select Add View to create a view for the action.

Answer: Answer is a, d

  1. <%= Html.RouteLink("Test", "test_default", new {area = "test"}, null) %>
    
  2. <%= Html.ActionLink("Test", "Details", "Test",new {area = "test"}, null) %>
    
  3. <a href="<%= Html.RouteLink("Test", "test_default",new {area = "test"}, null) %>">Test</a>
  4. <a href="<%= Html.ActionLink("Test", "Details", "Test",new {area = "test"}, null) %>">Test</a>
Answer: Answer is b

Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;