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

01 public class Routes : AreaRegistration
02 {
03 public override string AreaName
04 {
05 get { return "product"; }
06 }
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:///product, you discover that the correct page is not returned. You need to ensure that the correct page is returned. What should you do?

  1. Replace line 10 with the following code segment

    context.MapRoute("product_default","{area}/{controller}/{action}/{id}",new {area="product", controller = "Product", action = "Index", id = "" });
    
  2. Replace line 10 with the following code segment

    context.MapRoute("product_default","area}",new {controller = "Product", action = "Index", id = "" });
    
  3. Add the following code segmnet at line 11

    Area Rgistration.RegisterAllAreas();
    
  4. Add the following Code segmnet to the Register Routes in globel asax.cs file

    Area Rgistration.RegisterAllAreas();
    
Answer: Answer is d

  1. In the site's master page, create a div element with an ID of Navigation. Add the following code segment inside this div element.

    <% Html.RenderPartial("~/Views/Shared/MenuBar.ascx"); %>
    
  2. In the site's master page, create a div element with an ID of Navigation. Add the following code segment inside this div element.

    <%= Url.Content("~/Views/Shared/MenuBar.ascx") %>
    
  3. In each of the controller's action methods, add an entry to the ViewData collection with a key of Navigation and a value of ~/Views/Shared/MenuBar.ascx

  4. In the site's Global.asax.cs file, register a route named Navigation that points to the ~/Views/Shared/ MenuBar.ascx file.

Answer: Answer is a

public class Player
{
public String Name { get; set; }
public int LastScore { get; set; }
public int HighScore { get; set; }
}

You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper. DisplayForModel method is called for any view in the application that has a model of type Player. What should you do?

  1. Rename Score.ascx to LastScore.ascx.

  2. Move Score.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/DisplayTemplates folder.

  3. Add the following attribute to the LastScore property.
    [UIHint("Score")]

  4. Add the following attribute to the LastScore property

    [Display(Name="LastScore", ShortName="Score")]

Answer: Answer is c

public class ProductController : Controller
{
static List products = new List();
public ActionResult Index()
{
return View();
}
}

In the Views folder of your application, you add a view page named Index.aspx that includes the following @Page directive.

<%@ Page Inherits="System.Web.Mvc.ViewPage" %>

You test the application with a browser. You receive the following error message when the Index method is invoked: "The view 'Index' or its master was not found." You need to resolve the error so that the new view is displayed when the Index method is invoked. What should you do?

  1. Change the name of the Index.aspx file to Product.aspx

  2. Create a folder named Product inside the Views folder. Move Index.aspx to the Product folder

  3. Replace the @ Page directive in Index.aspx with the following value

    <%@ Page Inherits="System.Web.Mvc.ViewPage" %>
    
  4. Modify the Index method by changing its signature to the following:

    public ActionResult Index(Product p)
    
Answer: Answer is b

public class DepartmentController : Controller
{
static List departments =
new List();
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 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?

  1. <%= Html.Action("ListEmployees", Model) %>
    
  2. <%= Html.ActionLink("ListEmployees", "Department", "DepartmentController") %>
    
  3. <% Html.RenderPartial("ListEmployees", Model); %>
    
  4. <%= Html.DisplayForModel("ListEmployees") %>
    
Answer: Answer is a

  1.  <asp:Label ID="lblCompany" runat="server" meta:resourcekey="lblCompany" />
  2. <asp:Label ID="lblCompany" runat="server" Text="meta:lblCompany.Text" />
  3. <asp:Label ID="lblCompany" runat="server" Text="<%$ Resources:lblCompanyText %>" />
  4. <asp:Label ID="lblCompany" runat="server" Text="<%$ Resources:WebResources, lblCompanyText %>" />
Answer: Answer is d

  1. btnAddToCart_Click

  2. Page_Load

  3. Page_PreRender

  4. Page_PreInit

Answer: Answer is c

 <asp:Button ID="btnRefresh" runat="server" Text="Button" /> <asp:GridView ID="gvCustomers" runat="server"
EnableViewState="False" OnDataBinding="gvCustomers_DataBinding">
</asp:GridView>

You disable view state to improve performance. You need to ensure that the page is updated to display the latest data when the user clicks the refresh button. Which code segment should you use?

  1. protected void Page_PreInit(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    gvCustomers.DataSource = GetCustomers();
    gvCustomers.DataBind();
    }
    }
    
  2. protected void Page_Load(object sender, EventArgs e)
    {
    gvCustomers.DataSource = GetCustomers();
    gvCustomers.DataBind();
    }
    
  3. protected void gvCustomers_DataBinding(object sender, EventArgs e) {
    gvCustomers.DataSource = GetCustomers();
    gvCustomers.DataBind();
    }
    
  4. protected void Page_PreRender(object sender, EventArgs e) {
    if (!IsPostBack)
    {
    gvCustomers.DataSource = GetCustomers();
    gvCustomers.DataBind();
    }
    }
    
Answer: Answer is b

  1. Init

  2. Load

  3. PreInit

  4. PreLoad

Answer: Answer is b

  1. Modify the hosting page's caching directive as follows

    <%@ OutputCache Duration="10" VaryByParam="None" %>
    
  2. Add the following meta tag to the Head section of the hosting page.

    <meta http-equiv="refresh" content="10">
  3. Add the following caching directive to the hosted control.

    <%@ OutputCache Duration="10" VaryByParam="None" %>
  4. Add the following caching directive to the hosted control.

    <%@ OutputCache Duration="10" VaryByControl="None" %>
Answer: Answer is a, c

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.

;