Latest MCTS 70-573 Dumps Real Exam Download 71-80

Ensurepass

clip_image002

A. Rename WP1.webpart as Corporate.webpart.

B. In WP1.webpart, change the Title property to Corporate.

C. In the constructor of WP1.cs, add the following line of code:

Page.Title=”Corporate”;

D. In the Elements.xml file, change the Name property of the <File> element to Corporate.

 

Correct Answer: B

Explanation/Reference:

MNEMONIC RULE: “Title property to Corporate”

Web Parts Control Description Files http://msdn.microsoft.com/en-us/library/ms227561.aspx

 

 

QUESTION 72

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

01 SPWeb web = SPContext.Current.Web;

02 try

03 {

05 }

06 catch (Exception ex)

07 {

08

09 System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, (“Exception

Information: ” + ex.Message), EventLogEntryType.Error);

10 }

You discover that line 09 causes an error. You need to resolve the error.

What should you do?

 

A. Run the code segment at line 09 inside a RunWithElevatedPrivilegesdelegate.

B. Add the following code at line 08:

if (web.CurrentUser.IsSiteAuditor == false)

C. Add the following code at line 08:

if (web.CurrentUser.IsSiteAdmin == false)

D. Change line 09 to the following code segment:

System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, “Exception

Information”, EventLogEntryType.Error);

 

Correct Answer: A

Explanation/Reference:

MNEMONIC RULE: “RunWithElevatedPrivileges”

SPSecurity.RunWithElevatedPrivileges Method http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx

 

 

QUESTION 73

You create a Web Part that calls a function named longCall.

You discover that longCall takes a long time to execute. You need to display in the Developer Dashboard how long it takes to execute longCall.

Which code segment should you use?

 

 

A. DateTime startTime = DateTime.Now;longCall();Trace.Write(“Long Call ” + DateTime.Now.Subtract(startTime).Seconds);

B. DateTime startTime = DateTime.Now;longCall();Trace.TraceWarning(“Long Call ” + DateTime.Now.Subtract(startTime).Seconds);

C. Monitor.Enter(“Long Call”);if (true){

 longCall();

}

Monitor.Exit(“Long Call”);

D. using (SPMonitoredScope monitoredScope = new SPMonitoredScope(“Long Call”)){

 longCall();

}

 

Correct Answer: D

 

Explanation/Reference:

MNEMONIC RULE: “Developer Dashboard = SPMonitoredScope”

Monitors performance and resource use for a specified scoped block of code.

SPMonitoredScope Class http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.spmonitoredscope.aspx

 

 

clip_image004

A. Add the following line of code at line 03:

cs.Update();

B. Add the following line of code at line 03:

cs.DeveloperDashboardSettings.Update();

C. Change line 02 to the following code segment:

cs.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.Off;

D. Change line 02 to the following code segment:

cs.DeveloperDashboardSettings.DisplayLevel =

SPDeveloperDashboardLevel.OnDemand;

 

Correct Answer: B

Explanation/Reference:

MNEMONIC RULE: “loooonger Update()”

Update() method of SPDeveloperDashboardSettings class causes the object to save its state and propagate changes to all the computers in the server farm.

SPDeveloperDashboardSettings Members http://msdn.microsoft.com/en-us/library/ microsoft.sharepoint.administration.spdeveloperdashboardsettings_members.aspx

 

 

QUESTION 75

You have the following event receiver. (Line numbers are included for reference only.)

01 public override void FieldDeleting(SPListEventProperties properties)02 {

03 04  base.FieldDeleting(properties); 

05 06 07  if (properties.FieldName == “Status”){ 

08 

09  }

10 }

You need to cancel the operation and redirect the user to a custom error page if the name of the deleted field is Status.

Which code segments should you add at lines 07 and 08?

 

 

A. 04 properties.ReceiverData = “/_layouts/customErrorPage.aspx”;05 properties.Cancel = true;

B. 04 properties.RedirectUrl = “/_layouts/customErrorPage.aspx”;05 properties.Cancel = true;

C. 04 properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;05 properties.ReceiverData = “/_layouts/customErrorPage.aspx”;

D. 04 properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;05 properties.RedirectUrl = “/_layouts/customErrorPage.aspx”;

 

Correct Answer: D

 

Explanation/Reference:

MNEMONIC RULE: “CancelWithRedirectUrl, RedirectUrl”

Redirect to URL in SharePoint Foundation 2010 http://msdn.microsoft.com/en-us/library/ff408258.aspx

Event Receiver and Custom Error Page http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/02/15/event-receiver-and-custom-error-page.aspx

 

 

QUESTION 76

You are creating an event receiver. The event receiver will have a field named Title and a field named Priority.

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

01 public override void ItemUpdating(SPItemEventProperties prop)

02 {

02 base.ItemUpdating(prop);

03

04

05

06

07 }

You need to ensure that when the Title field is changed to include the word IMPORTANT, the Priority field is set to URGENT.

Which code segments should you add at lines 03, 04, 05, and 06?

 

 

A. 03 if (prop.AfterProperties[“vti_title”].ToString().Contains(“IMPORTANT”))04 {05 prop.AfterProperties[“Priority”] = “URGENT”;06 }

B. 03 if (prop.AfterProperties[“vti_title”].ToString().Contains(“IMPORTANT”))04 {05 prop.ListItem[“Priority”] = “URGENT”;06 }

C. 03 if (prop.BeforeProperties[“vti_title”].ToString().Contains(“IMPORTANT”))04 {05 prop.AfterProperties[“Priority”] = “URGENT”;06 }

D. 03 if (prop.ListItem[“Title”].ToString().Contains(“IMPORTANT”))04 {05 prop.AfterProperties[“Priority”] = “URGENT”;06 }

 

Correct Answer: A

Explanation/Reference:

MNEMONIC RULE: “AfterProperties on lines 03 and 05”

SPItemEventProperties.AfterProperties Property http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventproperties.afterproperties.aspx

 

 

QUESTION 77

You have a SharePoint list named Announcements.

You have an event receiver that contains the following code segment. (Line numbers are included for reference only.)

01 public override void ItemAdding(SPItemEventProperties properties)

02 {

03 if (properties.ListItem[“Title”].ToString().Contains(“secret”))

04 {

05

06 }

07 }

You need to prevent users from adding items that contain the word “secret” in the title to the list.

Which code segment should you add at line 05?

 

 

A. properties.Cancel = false;

B. properties.Cancel = true;

C. properties.Status = SPEventReceiverStatus.Continue;

D. return;

 

Correct Answer: B

Explanation/Reference:

MNEMONIC RULE: “prevent from adding = cancel the event”

SPItemEventProperties.Cancel indicates whether to cancel the event

SPItemEventProperties Class

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventproperties.aspx

 

 

QUESTION 78

You have a timer job that has the following constructors. (Line numbers are included for reference only.)

01 public TimerJob1 () : base() { }02 public TimerJob1(SPWebApplication wApp)

You need to ensure that the timer job runs on the first available timer server only.

Which base class constructor should you use at line 02?

 

 

A. public TimerJob1(SPWebApplication wApp) : base(null, wApp, null, SPJobLockType.ContentDatabase) { }

B. public TimerJob1(SPWebApplication wApp): base(null, wApp, null, SPJobLockType.Job){ }

C. public TimerJob1(SPWebApplication wApp):base(null, wApp, null, SPJobLockType.None) { }

D. public TimerJob1(SPWebApplication wApp):base(“TimerJob1”, wApp, null, SPJobLockType.None) { }

 

Correct Answer: B

 

Explanation/Reference:

MNEMONIC RULE: “SPJobLockType.Job”

Job member locks the timer job so that it runs only on one machine in the farm.

SPJobLockType Enumeration http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spjoblocktype.aspx

 

 

QUESTION 79

You create a client application that remotely calls the Business Connectivity Services (BCS) object model.

You need to create the context that will be used to request a cache refresh.

Which code segment should you use?

 

 

A. BdcService cCtx = SPFarm.Local.Services.GetValue<BdcService>(string.Empty);

B. ClientContext cCtx = new ClientContext(string.Empty);

C. RemoteOfflineRuntime cCtx = new RemoteOfflineRuntime();

D. RemoteSharedFileBackedMetadataCatalog cCtx = newRemoteSharedFileBackedMetadataCatalog();

 

Correct Answer: C

 

Explanation/Reference:

MNEMONIC RULE: “cache = RemoteOfflineRuntime”

Code Snippet: Programmatically Request a Cache Refresh on the Client http://msdn.microsoft.com/en-us/library/ee559351.aspx

 

 

QUESTION 80

You need to programmatically add a user named User1 to a group named Group1.

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

01 string login = “User1”;

02 string grpName = “Group1”;

03 SPUser user = SPContext.Current.Web.EnsureUser(login);

04 SPGroup group = SPContext.Current.Web.Groups[grpName];

05

06 group.Update();

Which code segment should you add at line 05?

 

 

A. group.AddUser(user);

B. group.Owner = user;

C. user.AllowBrowseUserInfo = true;

D. user.Update();

 

Correct Answer: A

Explanation/Reference:

MNEMONIC RULE: “add a user = AddUser()”

SPGroup.AddUser Method http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spgroup.adduser.aspx

 

Download Lates MCTS 70-573 Real Free Tests , help you to pass exam 100%.