Microsoft Exam Questions

What should you do?

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.

Explanation:
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/