PrepAway - Latest Free Exam Questions & Answers

Category: 70-573

Exam 70-573: TS: Microsoft SharePoint 2010, Application Development

Which control should you include in Form1?

You created a custom ASPX page that updates a list. The page is deployed to the _layouts folder.

The page contains the following code segment. (Line numbers are included for reference only.)

01 <form id=”Form1″ runat=”Server”>
02 <asp:Button id=”btnUpdate” runat=”server” Text=”Update”></asp:Button>
03 </form>

A user attempts to update the list by using the page and receives the following error message: “The security validation for this page is invalid”.

You need to prevent the error from occurring.

Which control should you include in Form1?

Which code segment should you add at line 04?

You need to disable the CriticalExceptionCount measure for all user solutions.

You write the following code segment. (Line numbers are included for reference only.)

01 SPUserCodeService userCode = SPUserCodeService.Local;
02 SPResourceMeasureCollection measures = userCode.ResourceMeasures;
03 SPResourceMeasure measure = measures[“CriticalExceptionCount”];
04
05 measure.Update();

Which code segment should you add at line 04?

What should you do?

You have a SharePoint site collection. The root Web of the site collection has the URL http://intranet.

You plan to create a user solution that will contain a Web Part. The Web Part will display the title of the root Web.

You write the following code segment for the Web Part. (Line numbers are included for reference only.)

01 SPSite currentSite = new SPSite(“http://intranet”);
02
03 Label currentTitle = new Label();
04 currentTitle.Text = currentSite.RootWeb.Title;

You add the Web Part to a page in the root Web and receive the following error message: “Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper’s Execute method in the partial trust app domain: An unexpected error has occurred.”

You need to prevent the error from occurring.

What should you do?

Which line of code should you identify?

You are creating a Web Part for SharePoint Server 2010.

The Web Part contains the following code segment. (Line numbers are included for reference only.)

01 protected override void CreateChildControls()
02 {
03 base.CreateChildControls();
04 SPSecurity.RunWithElevatedPrivileges(
05 delegate()
06 {
07 Label ListCount = new Label();
08 ListCount.Text = String.Format(“There are {0} Lists”, SPContext.Current.Web.Lists.Count);
09 Controls.Add(ListCount);
10 });
11 }

You need to identify which line of code prevents the Web Part from being deployed as a sandboxed solution.

Which line of code should you identify?

What should you do?

You create a console application to manage Personal Sites.
The application contains the following code segment. (Line numbers are included for reference only.)

01 SPSite siteCollection = new SPSite(“http://moss”);
02 UserProfileManager profileManager = new UserProfileManager(ServerContext.GetContext(siteCollection));
03 UserProfile profile = profileManager.GetUserProfile(“domain\\username”);
04 SPSite personalSite = profile.PersonalSite;
05
06 siteCollection.Dispose();

You deploy the application to a SharePoint site.

After deploying the application, users report that the site loads slowly. You need to modify the application to prevent the site from loading slowly.

What should you do?

Which object should you dispose of?

You create an event receiver.

The ItemAdded method for the event receiver contains the following code segment. (Line numbers are included for reference only.)

01 SPWeb recWeb = properties.Web;
02 using (SPSite siteCollection = new SPSite(“http://site1/hr”))
03 {
04 using (SPWeb web = siteCollection.OpenWeb())
05 {
06 PublishingWeb oWeb = PublishingWeb.GetPublishingWeb(web);
07 PublishingWebCollection pubWebs = oWeb.GetPublishingWebs();
08 foreach (PublishingWeb iWeb in pubWebs)
09 {
10 try
11 {
12 SPFile page = web.GetFile(“/Pages/default.aspx”);
13 SPLimitedWebPartManager wpManager = page.GetLimitedWebPartManager(PersonalizationScope.Shared);
14 }
15 finally
16 {
17 if (iWeb != null)
18 {
19 iWeb.Close();
20 }
21 }
22 }
23 }
24 }

You need to prevent the event receiver from causing memory leaks.

Which object should you dispose of?

What should you do?

You have a Web Part that contains the following code segment. (Line numbers are included for reference only.)

01 protected void Page_Load(object sender, EventArgs e)
02 {
03 SPSite site = new SPSite(“http://www.contoso.com/default.aspx”);
04 {
05 SPWeb web = site.OpenWeb();
06
07 }
08 }

You deploy the Web Part to a SharePoint site.

After you deploy the Web Part, users report that the site loads slowly. You need to modify the Web Part to prevent the site from loading slowly.

What should you do?

What should you do?

You deploy a custom Web Part named WebPart1 to a SharePoint site.

WebPart1 contains the following code segment. (Line numbers are included for reference only.)

01 protected void Page_Load(object sender, EventArgs e)
02 {
03 SPSite site = null;
04 try
05 {
06 SPSite site = new SPSite(“http://www.contoso.com/default.aspx”);
07 SPWeb web = site.OpenWeb();
08
09 …
10 }
11 catch
12 {
13
14 }
15 finally
16 {
17
18 }
19 }

After you deploy WebPart1, users report that the pages on the site load slowly.

You retract WebPart1 from the site.

Users report that the pages on the site load without delay. You need to modify the code in WebPart1 to prevent the pages from loading slowly.

What should you do?


Page 18 of 18« First...10...1415161718