Latest MCTS 70-573 Dumps Real Exam Download 81-90

Ensurepass

QUESTION 81

You need to create a Web Part that creates a copy of the out-of-the-box Contribute permission level.

Which code segment should you implement in the Web Part?

 

A. SPRoleDefinition myRole = new SPRoleDefinition();myRole.Name = “Contribute”;SPContext.Current.Web.RoleDefinitions.Add(myRole);

B. SPRoleDefinition myRole = new SPRoleDefinition

(SPContext.Current.Web.RoleDefinitions[“Contribute”]);

myRole.Name = “MyContribute”;

SPContext.Current.Web.RoleDefinitions.Add(myRole);

C. SPRoleDefinition myRole = new SPRoleDefinition(SPContext.Current.Web.RoleDefinitions[“MyContribute”]);myRole.Description = “Contribute”;SPContext.Current.Web.RoleDefinitions.Add(myRole);

D. SPRoleDefinition myRole = new SPRoleDefinition(SPContext.Current.Web.RoleDefinitions[“MyContribute”]);myRole.Name = “Contribute”;SPContext.Current.Web.RoleDefinitions.Add(myRole);

 

Correct Answer: B

 

Explanation/Reference:

MNEMONIC RULE: “RoleDefinitions(“Contribute”)”

 

 

clip_image002

 

A. SPContext.Current.Web.Groups[“Group1”].ContainsCurrentUser;

B. SPContext.Current.Web.SiteUsers[SPContext.Current.Web.CurrentUser.ID].Groups[“Group1”] != null;

C. SPContext.Current.Web.SiteUsers[SPContext.Current.Web.CurrentUser.ID].Groups[“Group1”] == null;

D. SPContext.Current.Web.Users[“Group1”].IsDomainGroup;

 

Correct Answer: A

 

Explanation/Reference:

MNEMONIC RULE: ContainsCurrentUser

Gets a Boolean value that indicates whether the group contains the current user, included either through direct or indirect membership.

SPGroup.ContainsCurrentUser Property http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spgroup.containscurrentuser.aspx

 

 

QUESTION 83

You have a SharePoint list named Assets that contains 1,000,000 items. The list contains a column named Urgent. Approximately 100 items have a value of True in their Urgent column.

You use the following line of code to retrieve the Assets list.

SPList assetsList = currentWeb.Lists[“assets”];

You need to retrieve all of the items in the list that have a value of True in their Urgent column. You must retrieve the items in the minimum amount of time.

What should you do?

 

A. Iterate through the assetsList.Items collection.

B. Iterate through the assetsList.Fields collection.

C. Call assetsLists.GetItems and specify the SPQuery parameter.

D. Call assetsList.Items.GetDataTable() and retrieve DataRowCollection.

 

Correct Answer: C

Explanation/Reference:

MNEMONIC RULE: “SPQuery for minimum time”

SPQuery Class

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

Spquery in Sharepoint 2010 – Tutorial http://www.learningsharepoint.com/2010/07/18/spquery-in-sharepoint-2010-tutorial/

 

 

QUESTION 84

You create a Web Part.

The Web Part contains a grid view named GridView1 and the following code segment. (Line numbers are included for reference only.)

01 IntranetDataContext dc = new IntranetDataContext(“http://intranet”);

02 MyGridView.DataSource = from announce In dc.Announcements _ ;

03

04 Select announce IntranetDataContext is a LINQ context.

You need to ensure that GridView1 only displays items from Announcements that have an expiry date that is greater than or equal to the current date.

What should you do?

 

A. Change line 04 to the following code segment:

Select Not announce.Expires.HasValue

B. Change line 04 to the following code segment:

Select announce.Expires.Value.CompareTo(DateTime.Now) >= 0

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

Where announce.Expires.Value.CompareTo(DateTime.Now) >= 0 _

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

Order By announce.Expires.Value.CompareTo(DateTime.Now) >= 0 _

 

Correct Answer: C

Explanation/Reference:

MNEMONIC RULE: “only WHERE is missing”

Just remember the order of LINQ query: FROM – WHERE – SELECT

Using LINQ to SharePoint

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

 

 

QUESTION 85

You create a Microsoft .NET Framework console application that uses a Representational State Transfer (REST) API to query a custom list named Products.

The application contains the following code segment.

AdventureWorksDataContext codc = new AdventureWorksDataContext(new Uri

(“http://contoso/_vti_bin/listdata.svc”));

codc.Credentials = CredentialCache.DefaultCredentials;

You need to read all items in Products into an object.

Which method should you use?

 

A. codc.Products.All;

B. codc.Products.AsQueryable;

C. codc.Products.ElementAt;

D. codc.Products.ToList;

 

Correct Answer: D

Explanation/Reference:

MNEMONIC RULE: “read all items ToList”

Interacting with SharePoint 2010 lists using REST, ASP.NET and ADO.NET Data Services

http://extendtheenterprise.com/2010/11/03/using-sharepoint-2010-rest-apis-in-asp-net/

Enumerable.ToList<TSource> Method http://msdn.microsoft.com/en-us/library/bb342261.aspx

 

 

QUESTION 86

You have a SharePoint Web application that has the URL http://intranet.

You are creating a Microsoft .NET Framework application that will display the title of the SharePoint Web application and will execute outside of the SharePoint server.

You create a textbox named textBoxTitle.

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

01 ClientContext context = new ClientContext(“http://intranet”);

02

03 Web site = context.Web;

04 context.Load(site);

05

06 textBoxTitle.Text = site.Title;

You discover that line 04 generates an error.

You need to ensure that the .NET application displays the title of the SharePoint Web application in textBoxTitle.

What should you do?

clip_image004

 

Correct Answer: C

Explanation/Reference:

MNEMONIC RULE: “ExecuteQuery() after Load()”

Client Context as Central Object http://msdn.microsoft.com/en-us/library/ee536158.aspx

 

 

QUESTION 87

You have a SharePoint site collection that has the URL http://contoso/sites/finance.

You are creating a Microsoft .NET Framework console application that will use the SharePoint client object model to create a site in the site collection.

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

01 ClientContext cCtx = new ClientContext(“http://contoso/sites/finance”);

02 Web root = cCtx.Site.RootWeb;

03 cCtx.Load(root);

04 WebCreationInformation webInfo = new WebCreationInformation();

05 webInfo.Title = “site1”;

06 webInfo.Url = “site1”;

07 webInfo.WebTemplate = “MPS#2”;

08 root.Webs.Add(webInfo);

09

10 cCtx.Dispose();

You need to ensure that the application creates the site.

Which code segment should you add at line 09?

 

A. cCtx.ExecuteQuery();

B. cCtx.Site.RootWeb.Update();

C. root.Context.Dispose();

D. root.Update();

 

Correct Answer: A

 

Explanation/Reference:

MNEMONIC RULE: “Execute your Query”

Executes the current set of data retrieval queries and method invocations.

How to: Work with Web Sites http://msdn.microsoft.com/en-us/library/ee535521.aspx

 

 

QUESTION 88

You have a Microsoft .NET Framework console application that uses the SharePoint client object model.

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

01 ClientContext cCtx = new ClientContext(“http://intranet/hr”);

02 List sharedDocList = cCtx.Web.Lists.GetByTitle(“Shared Documents”);

03 CamlQuery camlQuery = new CamlQuery();

04 camlQuery.ViewXml =

05 @”<View>

06 <Query>

07 <Where>

08 <Eq>

09

10 <Value Type=’Text’>Doc1.docx</Value>

11 </Eq>

12 </Where>

13 </Query>

14 </View>”;

15 ListItemCollection docLibItems = sharedDocList.GetItems(camlQuery);

16 cCtx.Load(sharedDocList);

17 cCtx.Load(docLibItems);

18 cCtx.ExecuteQuery();

You need to ensure that the application queries Shared Documents for a document named Doc1.docx.

Which code element should you add at line 09?

 

 

A. <FieldRef Name=’FileDirRef’/>

B. <FieldRef Name=’FileLeafRef’/>

C. <FieldRef Name=’FileRef’/>

D. <FieldRef Name=’File_x0020_Type’/>

 

Correct Answer: B

Explanation/Reference:

MNEMONIC RULE: “FileLeafRef; documents are made out of Leaves”

Identifies a field that contains information about the server-relative URL for the file node that is associated

with the specified SharePoint Foundation object.

SPBuiltInFieldId.FileLeafRef Field

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

 

 

QUESTION 89

You have a document library named MyDocs. MyDocs has a column named Column1. Column1 is a required column.

You discover that many documents are checked out because users fail to enter a value for Column1.

You need to create a Web Part to delete the documents.

Which code segment should you include in the Web Part?

 

 

A. foreach (SPCheckedOutFile file in ((SPDocumentLibrary)SPContext.Current.Web.Lists[“MyDocs”]).CheckedOutFiles){

 file.Delete();

}

B. foreach (SPItem file in SPContext.Current.Web.Lists[“MyDocs”].Items)

{

 if ((file(“CheckOutStatus”) == “CheckOut”))

{

 file.Delete();

}

}

C. foreach (SPListItem file in ((SPDocumentLibrary)SPContext.Current.Web.Lists[“MyDocs”]).Items){

 if ((file(“CheckOutStatus”) == “CheckOut”))

{

 file.Delete();

}

}

D. foreach (SPCheckedOutFile file in ((SPDocumentLibrary)SPContext.Current.Web.Lists[“MyDocs”]).CheckedOutFiles){

 file.TakeOverCheckOut();

}

 

Correct Answer: A

Explanation/Reference:

MNEMONIC RULE: “SPCheckedOutFile, file.Delete()”

Represents a checked-out file in a document library or workspace.

SPCheckedOutFile Class http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcheckedoutfile.aspx

 

 

QUESTION 90

You have a document library named Documents. Minor and major version management is enabled for the document library.

You plan to add a document named MyFile.docx to Documents.

You create a console application that contains the following code segment. (Line numbers are included for reference only.)

01 using (SPSite site = new SPSite(“http://intranet”))

02 {

03 SPList documents = site.RootWeb.Lists[“Documents”];

04 FileStream fstream = File.OpenRead(@”MyFile.docx”);

05 byte[] content = new byte[fstream.Length];

06 fstream.Read(content, 0, (int)fstream.Length);

07 fstream.Close();

08 site.RootWeb.Files.Add(documents.RootFolder.Url + “/MyFile.docx”,

content, true);

09 SPFile file = site.RootWeb.GetFile(documents.RootFolder.Url + “/

MyFile.docx”);

10 file.CheckIn(string.Empty);

11

12 }

You need to ensure that all users can see the document.

Which code segment should you add at line 11?

 

 

A. file.CanOpenFile(true);

B. file.Publish(string.Empty);

C. file.ReleaseLock(string.Empty);

D. file.Update();

 

Correct Answer: B

Explanation/Reference:

MNEMONIC RULE: “Minor and major versions to Publish”

Minor and major version management is enabled for the document library; therefore, we must use Publish () method.

SPFile.Publish Method http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.publish.aspx

 

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