03 SPSite site = new SPSite("http://www.contoso.com/default.aspx");
04 {
05 SPWeb web = site.OpenWeb();
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?
A. Add the following line of code at line 06: web.Close(); B. Add the following line of code at line 06: web.Dispose(); C. Add the following line of code at line 06: site.Close(); D. Change line 03 to the following code segment: using (SPSite site = new SPSite("http://www.contoso.com/default.aspx"))
D. Change line 03 to the following code segment: using (SPSite site = new SPSite("http://www.contoso.com/default.aspx"))
MNEMONIC RULE: "using statement"
You can automatically dispose SharePoint objects that implement the IDisposable interface by using theMicrosoft Visual C# and Visual Basic using statement.
You have a timer job that has the following constructors. (Line numbers are included for reference only.)
01 public TimerJob1 (): base() {}
02 public TimerJobl(SPWebApplication wApp)
You need to ensure that the timer job runs on only the first available timer server.
Which base class constructor should you use in line 02?
A. base(null, wApp, null/ SPJobLockType.ContentDatabase){} B. base(null, wApp, null, SPJobLockType.None){} C. base( " TimerJobl" , wApp, null, SPJobLockType.Job){} D. base("TimerJobl" , wApp, null, SPJobLockType.None){}
C. base( " TimerJobl" , wApp, null, SPJobLockType.Job){}
Question 253:
You have a SharePoint list named Projects and a site column named PrivateColumn. You need to prevent users from adding PrivateColumn to the Projects list. Users must be able to add any other site column to the Projects list. What should you do?
A. Create an event receiver that inherits SPListEventReceiver and override FieldAdded. B. Create an event receiver that inherits SPListEventReceiver and override FieldAdding. C. Create an event receiver that inherits SPItemEventReceiver and override ItemAdded. D. Create an event receiver that inherits SPItemEventReceiver and override ItemAdding.
B. Create an event receiver that inherits SPListEventReceiver and override FieldAdding.
MNEMONIC RULE: "FieldAdding to a List"
Question 254:
You created a custom ASPX page that updates a list. The page is deployed to the Jayouts folder. The page contains the following code segment.
A user attempts to update the list by using the p age 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?
A. FormDigest B. UlVersionedContent C. InputFormCustomValidator D. EncodedLiteral
A. FormDigest
Question 255:
You update a solution validator. You need to ensure that all SharePoint solutions are validated the next time the solutions are executed. What should you do?
A. Modify the Guid attribute of the solution validator. B. Deactivate and activate all of the installed solutions. C. Modify the Signature property of the solution validator. D. In the Feature that deploys the solution validator, modify the Version attribute of the Feature element.
C. Modify the Signature property of the solution validator.
MNEMONIC RULE: "signature solution validator" Gets or sets the version number and state hash of a solution validator. SPSolutionValidator.Signature Property http://msdn.microsoft.com/enus/library/microsoft.sharepoint.usercode.spsolutionvalidator.signature.aspx
Question 256:
You have a SharePoint farm that has more than 100 custom Features.
You upgrade several Features in the farm.
You need to ensure that the site collection uses the most up-to-date versions of the Features. Only Features that require an upgrade must be evaluated.
Which code segment should you use?
A. SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local); foreach (SPWebService myWebService1 in webServices) { SPFeatureQueryResultCollection queryResults = myWebService1.QueryFeatures (SPFeatureScope.Site, true); IEnumerator featureEnumerator = queryResults.GetEnumerator(); while (featureEnumerator.MoveNext()) { SPFeature feature = featureEnumerator.Current; feature.Upgrade(false); } } B. SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local); foreach (SPWebService myWebService1 in webServices) { SPFeatureQueryResultCollection queryResults = myWebService1.QueryFeatures (SPFeatureScope.Web, true); IEnumerator featureEnumerator = queryResults.GetEnumerator(); while (featureEnumerator.MoveNext()) { SPFeature feature = featureEnumerator.Current; feature.Upgrade(false); } } C. SPSite site = SPContext.Current.Site; SPFeatureCollection allFeatures = site.Features; foreach (SPFeature currentFeature in allFeatures) { currentFeature.Upgrade(true); } D. SPWeb web = SPContext.Current.Web; SPFeatureCollection allFeatures = web.Features; foreach (SPFeature currentFeature in allFeatures) { currentFeature.Upgrade(true); }
A. SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local); foreach (SPWebService myWebService1 in webServices) { SPFeatureQueryResultCollection queryResults = myWebService1.QueryFeatures (SPFeatureScope.Site, true); IEnumerator featureEnumerator = queryResults.GetEnumerator(); while (featureEnumerator.MoveNext()) { SPFeature feature = featureEnumerator.Current; feature.Upgrade(false); } }
MNEMONIC RULE: "large chunk of code, SPFeatureScope.Site" Since we are working with the site collection, we need to use SPFeatureScope.Site, not SPFeatureScope.Web.
needsUpgrade (Boolean): if true, only features that need to be upgraded are included. If false, only featuresthat do not need to be upgraded are included.
SPSite.QueryFeatures Method (Guid, Boolean)
http://msdn.microsoft.com/en-us/library/ee545763.
Question 257:
You have a SharePoint site that has the URL http://contoso.com/hr.
You are creating a new Web Part.
You need to create a reference to the current subsite without having to dispose of any returned objects.
Which code segment should you use?
A. SPSite siteCollection = new SPSite("http://www.contoso.com"); SPWebCollection site = siteCollection.AllWebs; B. SPSite siteCollection = new SPSite("http://www.contoso.com"); SPWeb site = siteCollection.RootWeb; C. SPSite site = SPContext.Current.Site; D. SPWeb site = SPContext.Current.Web;
A. SPSite siteCollection = new SPSite("http://www.contoso.com"); SPWebCollection site = siteCollection.AllWebs;
MNEMONIC RULE: "One-line SPWeb"
NEVER dispose of anything created with the use of SPContext objects, so your choice is now limited toanswers C and D.
Since you need a reference to the subsite (in SharePoint world, subsite = web), answer D is correct.
SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in yourcode. This is true also for the SPSite and SPWeb objects returned by SPContext.Site, SPContext.Current.Site,SPContext.Web, and
You have a SharePoint list named Projects and a site column named PrivateColumn.
You need to prevent users from adding PrivateColumn to the Projects list. Users must be able to add any other site column to the Projects list.
What should you do?
A. Create an event receiver that inherits SPListEventReceiver and override FieldAdded. B. Create an event receiver that inherits SPListEventReceiver and override FieldAdding. C. Create an event receiver that inherits SPItemEventReceiver and override ItemAdded. D. Create an event receiver that inherits SPItemEventReceiver and override ItemAdding.
B. Create an event receiver that inherits SPListEventReceiver and override FieldAdding.
MNEMONIC RULE: "FieldAdding to a List"
Question 259:
You create a custom field type and a CustomFieldControl.ascx user control. You need to write the code-behind of the CustomFieldControl.acsx user control. Which object should you override?
A. SPFieldText B. BaseFieldControl C. SPFieldCalculated D. WebPart
B. BaseFieldControl
MNEMONIC RULE: "CustomFieldControl = BaseFieldControl" Renders a field on a form page (not a list view page) by using one or more child controls such as a label, link,or text box control. BaseFieldControl Class http://msdn.microsoft.com/enus/library/microsoft.sharepoint.webcontrols.basefieldcontrol.aspx
Question 260:
You use a custom site definition to create SharePoint sites.
You need to add a Web Part to the home page of the site definition.
Which file should you modify?
A. Onet.xml B. default.master C. web.conflg D. Sp.xml
A. Onet.xml
MNEMONIC RULE: "third-party site definition = Onet.xml" You can perform the following kinds of tasks in a custom Onet.xml file that is used for either a custom sitedefinition or a custom web template:
Specify an alternative cascading style sheet (CSS) file, JavaScript file, or ASPX header file for a sitedefinition.
Modify navigation areas for the home page and list pages. Add a new list definition as an option in the UI. Define one configuration for the site definition or web template, specifying the lists, modules, files, and WebParts that are included
when the configuration is instantiated. Specify Features to be included automatically with websites that are created from the site definition or webtemplate.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Microsoft exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 70-573 exam preparations
and Microsoft certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.