|
Microsoft 70-541 Exam - XXYYInc.com Free 70-541 Sample Questions:
1. You are creating a Microsoft Windows SharePoint Services site.
You need to add a new site column of type Choice to the site.
Which code segment should you use?
A. Shared Sub CreateSiteColumn(ByVal web As SPWeb, ByVal _
columnName As String, ByVal required As Boolean)
web.Fields.Add(columnName, SPFieldType.Choice, required)
End Sub
B. Shared Sub CreateSiteColumn(ByVal web As SPWeb, ByVal _
columnName As String, ByVal required As Boolean)
web.Lists(0).Fields.Add(columnName, SPFieldType.Choice, required)
End Sub
C. Shared Sub CreateSiteColumn(ByVal web As SPWeb, ByVal _
columnName As String, ByVal required As Boolean)
web.Lists(0).Views(0).ViewFields.Add(columnName, _
SPFieldType.Choice, required)
End Sub
D. Shared Sub CreateSiteColumn(ByVal web As SPWeb, ByVal _
columnName As String, ByVal type As SPFieldType, ByVal required As _
Boolean)
Dim field As SPField = New SPFieldChoice(web.Lists(0).Fields, _
columnName)
field.Required = required
field.Up date()
End Sub
Answer: A
2. You create a Microsoft Windows SharePoint Services site.
You need to change the group of the site column.
Which code segment should you use?
A. Protected Sub ChangeGroup(ByVal web As SPWeb, _
ByVal fieldName As String)
Dim changegroup As String = "MyNewColumnGroup"
Dim myFieldName As SPField = web.AvailableFields(f ieldName)
myFieldName.Group = changegroup
web.Update()
End Sub
B. Protected Sub ChangeGroup(ByVal web As SPWeb, _
ByVal fieldName As String)
Dim myFieldName As SPField = web.AvailableFields(f ieldName)
myFieldName.Group = "MyNewColumnGroup"
myFieldName.Update()
End Sub
C. Protected Sub ChangeGroup(ByVal web As SPWeb, _
ByVal fieldName As String)
Dim changegroup As String = "MyNewColumnGroup"
Dim myFieldName As SPField = web.AvailableFields(f ieldName)
myFieldName.SetCustomProperty("Group", changegroup)
web.Update()
End Sub
D. Protected Sub ChangeGroup(ByVal web As SPWeb, _
ByVal fieldName As String)
Dim changegroup As String = "MyNewColumnGroup"
Dim myFieldName As SPField = web.AvailableFields(f ieldName)
myFieldName.SetCustomProperty("Group", changegroup)
myFieldName.Update()
End Sub
Answer: B
3. You create a custom task list in a Microsoft Windows SharePoint Services site.
You need to prevent users from changing the custom task list. You also need to ensure that an error message is displayed when a user tries to change the list.
Which code segment should you use?
A. Public Overloads Overrides Sub ItemUpdating(ByVal properties _
As SPItemEventProperties)
properties.Cancel = True
properties.ErrorMessage = "Updating is not supported."
End Sub
B. Public Overloads Overrides Sub ItemUpdated(ByVal properties _
As SPItemEventProperties)
properties.Cancel = True
properties.ErrorMessage = "Updating is not supported."
End Sub
C. Public Overloads Overrides Sub ItemUncheckingOut(ByVal _
properties As SPItemEventProperties)
properties.Cancel = True
properties.ErrorMessage = "Updating is not supported."
End Sub
D. Public Overloads Overrides Sub ItemUncheckedOut(ByVal _
properties As SPItemEventProperties)
properties.Cancel = True
properties.ErrorMessage = "Updating is not supported."
End Sub
Answer: A
4. You create a TimeTracking feature and install the feature on a Microsoft Windows SharePoint Services site.
You write the following code segment. (Line numbers are included for reference only.)
01 Public Class TimeTrackerEventReceiver Inherits SPFeatureReceiver
02
03 Public Sub NotifyUser(ByVal user As SPUser, ByVal featureName As String)
04
05 co de omitted
06 End Sub
07 ...
08
You need to ensure that the site administrator is notified only when the TimeTracking feature is activated.
Which code segment should you insert at line 07?
A. Public Sub New()
Dim properties As SPFeatureReceiverProperties = _
New SPFeatureReceiverProperties()
If properties.Definition.Farm.CurrentUserIsAdministrator() Then
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.CurrentUser, properties.Feature.Definition.Name)
End If
End Sub
B. Public Sub New()
Dim web As SPWeb = SPControl.GetContextWeb(New HttpContext(Nothing))
NotifyUser(web.SiteAdministrators(0), "TimeTracker")
End Sub
C. Public Overloads Overrides Sub FeatureActivated(ByVal _
properties As SPFeatureReceiverProperties)
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.SiteAdministrators(0), _
properties.Feature.Definition.Name)
End Sub
D. Public Overloads Overrides Sub FeatureInstalled(ByVal _
properties As SPFeatureReceiverProperties)
If properties.Definition.ActivateOnDefault Then
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.SiteAdministrators(0), p roperties.Definition.Name)
End If
End Sub
Answer: C
5. You are writing a program that will periodically display activity on a Microsoft Windows SharePoint Services site.
For each job, you need to display the time that the job will run next.
Which code segment should you use?
A. For Each job As SPJobDefinition In _
SPFarm.Local.TimerService.JobDefinitions
Console.WriteLine("Job {0} will run at {1}", job.DisplayName, _
job.Schedule.NextExecution(DateTime.Now))
Next
B. For Each job As SPJobDefinition In _
SPFarm.Local.TimerService.JobDefinitions
Console.WriteLine("Job {0} will run at {1}", job.DisplayName, _
job.Schedule.NextExecution(DateTime.MinValue))
Next
C. For Each job As SPRunningJob In _
SPFarm.Local.TimerService.JobDefinitions
Console.WriteLine("Job {0} will run at {1}", _
j ob.JobDefinitionTitle, _
job.JobDefinition.Schedule.NextExecution(DateTime.Now))
Next
D. For Each job As SPJobDefinition In _
SPFarm.Local.TimerService.JobDefinitions
Console.WriteLine("Job {0} will run at {1}", _
job.JobDefinitionTitle, _
job.JobDefinition.Schedule.NextExecution(DateTime.MinValue))
Next
Answer: A
|
|