Free Cheat-test Samples and Demo Questions Download
Adobe exams Adobe
Apple exams Apple
Avaya exams Avaya
Check Point exams Check Point
Cisco exams Cisco
Citrix exams Citrix
CIW exams CIW
CompTIA exams CompTIA
CWNP exams CWNP
EC-Council exams EC-Council
EMC exams EMC
Exin exams Exin
Fortinet exams Fortinet
GIAC exams GIAC
Hitachi exams Hitachi
HP exams HP
IBM exams IBM
Isaca exams Isaca
ISC exams ISC
ISEB exams ISEB
Juniper exams Juniper
LPI exams LPI
McAfee exams McAfee
Microsoft exams Microsoft
Oracle exams Oracle
PMI exams PMI
Riverbed exams Riverbed
SNIA exams SAP
Sun exams SAS
Symantec exams Symantec
VMware exams VMware
All certification exams

Microsoft 70-504(CSharp) Exam - Cheat-Test.com

Free 70-504(CSharp) Sample Questions:

Q: 1 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
Your application has a workflow named OrderWorkflow that has a rule set named OrderRuleSet.
You write the following code segment. (Line numbers are included for reference only.)
01 WorkflowRuntime workflowRuntime = new WorkflowRuntime();
02 WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(OrderWorkflow));
03 Activity wfDefinition = instance.GetWorkflowDefinition();
04 WorkflowChanges changes = new WorkflowChanges(wfDefinition);
05 CompositeActivity transientWf = changes.TransientWorkflow;
06
You need to read the current definition of the OrderRuleSet rule set.
Which code segment should you insert at line 06?
A. RuleSet ruleSet = (RuleSet)transientWf.UserData["OrderRuleSet"];
B. RuleSet ruleSet = (RuleSet)transientWf.GetValue(
DependencyProperty.FromName("OrderRuleSet",typeof(RuleSet)));
C. RuleDefinitions ruleDefs = (RuleDefinitions)
transientWf.UserData[RuleDefinitions.RuleDefinitionsProperty];RuleSet ruleSet =
ruleDefs.RuleSets["OrderRuleSet"];
D. RuleDefinitions ruleDefs = (RuleDefinitions)transientWf.GetValue(
RuleDefinitions.RuleDefinitionsProperty);RuleSet ruleSet =
ruleDefs.RuleSets["OrderRuleSet"];
Answer: D

Q: 2 A custom activity defined in an assembly named LitwareActivities is defined as follows:
namespace LitwareActivities
{
public class WriteLineActivity : Activity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
Console.WriteLine(Message);
return ActivityExecutionStatus.Closed;
}
private string _message;
public string Message
{
get { return _message; }
set { _message = value; }
}
...
}
}
You need to create a sequential workflow where the execution path can be generated on the fly by an application.
Which XML code segment should you use?
A. <SequentialWorkflowActivity
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"xmlns:x="http://schemas. microsoft.com/winfx/20
xmlns:Litware="clr-namespace:LitwareActivities;assembly=LitwareActivities"><Litware:WriteLineActivity
Message="Hello, WF"/></SequentialWorkflowActivity>
B. <Workflow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"xmlns:x="http:// schemas.microsoft.com/winfx/20
xmlns:Litware="clr-namespace:LitwareActivities;assembly=LitwareActivities"><Litware:WriteLineActivity
Message="Hello, WF"/></Workflow>
C. <Workflow xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
class:Litware="clr-namespace:LitwareActivities;assembly=LitwareActivities">
<Litware:WriteLineActivity Message="Hello, WF"/></Workflow>
D. <SequentialWorkflowActivity
class:Litware="clr-namespace:LitwareActivities;assembly=LitwareActivities"> <Litware:WriteLineActivity
Message="Hello, WF"/></SequentialWorkflowActivity>
Answer: A

Q: 3 You are creating a workflow application by using Microsoft .NET Framework
3.5. The application uses local communication. The workflow host must receive data from
an existing workflow instance. You need to define the communication between the workflow host and the
workflow instance. Which code segment should you use?
A. [ExternalDataExchange]public interface ICommunicationService { void CallHost(string someData);}
B. [ExternalDataExchange]public interface ICommunicationService { event
EventHandler<ExternalDataEventArgs> CallHost;}
C. public class CommunicationService : ExternalDataExchangeService { public event
EventHandler<ExternalDataEventArgs> CallHost;}
D. public class CommunicationService : ExternalDataExchangeService { public void CallHost(string
someData) { base.AddService(this); }}
Answer: A

Q: 4 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
The application has a workflow named WfService.
You write the following code segment.
public interface MyService
{
void DoWorkflow(int val1,ref int val2);
}
You need to expose the DoWorkflow method as a Web service.
What should you do?
A. Add a WebServiceInputActivity activity. Bind val1 and val2 as parameters.
B. Add a WebServiceInputActivity activity. Bind val2 as a parameter. Add a WebServiceOutputActivity
activity. Bind val1 as a return value.
C. Add a WebServiceInputActivity activity. Bind val1 as a parameter. Add a WebServiceOutputActivity
activity. Bind val2 as a return value.
D. Add a WebServiceInputActivity activity. Bind val1 and val2 as parameters. Add a WebServiceOutputActivity activity. Bind val2 as a return value.
Answer: D

Q: 5 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses the InvokeWebServiceActivity activity to call a Web service. You need to identify the method in the proxy class that you can use to communicate with the Web service. Which line of code should you use?
A. string Method = this.invokeWebServiceActivity1.Name;
B. String Method = this.invokeWebServiceActivity1.MethodName;
C. string Method = this.invokeWebServiceActivity1.QualifiedName;
D. string Method = this.invokeWebServiceActivity1.ToString();
Answer: B

Q: 6 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application is exposed as a Web service and uses confidential data. You need to ensure that only users in the Active Directory can access the workflow Web service method.
What should you do?
A. Configure the directory security setting of the IIS Web site so that only local users have access to the site.
B. Add an instance of WorkflowRoleCollection class in the workflow as a field. Use the Add property to add users who can gain access to the site.
C. Add an instance of the WebWorkflowRole class to the WorkflowRoleCollection collection that is represented by the WebServiceInputActivity.Roles property.
D. Add an instance of the ActiveDirectoryRole class to the WorkflowRoleCollection collection that is represented by the WebServiceInputActivity.Roles property.
Answer: D

Q: 7 You are creating a Windows Workflow Foundation workflow by using Microsoft .NET Framework 3.5. The workflow host must receive data from workflow instances by using a communication service named CustomerDataExchange. You need to configure the workflow runtime services to enable communication between the host and the workflow instances. Which code segment should you use?
A. WorkflowRuntime runtime = new WorkflowRuntime();CustomerDataExchange cde = new
CustomerDataExchange();runtime.AddService(cde);
B. WorkflowRuntime runtime = new WorkflowRuntime();CustomerDataExchange cde = new
CustomerDataExchange();ExternalDataExchangeService dataService =
new ExternalDataExchangeService();dataService.AddService(cde);
C. WorkflowRuntime runtime = new WorkflowRuntime();ExternalDataExchangeService dataService = new
ExternalDataExchangeService();CustomerDataExchange cde = new
CustomerDataExchange();dataService.AddService(cde);runtime.AddService(dataService);
D. WorkflowRuntime runtime = new WorkflowRuntime();ExternalDataExchangeService dataService = new
ExternalDataExchangeService();runtime.AddService(dataService);CustomerDataExchange cde = new
CustomerDataExchange();dataService.AddService(cde);
Answer: D

Q: 8 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. When a user logs in, the application uses the InvokeWebServiceActivity activity to retrieve data from a Web service. You need to retrieve the logged-in user details from a local database when the Web service is being called. Which code segment should you use?
A. this.invokeWebServiceActivity1.Invoked += new
EventHandler<InvokeWebServiceEventArgs>(OnInvoked); void OnInvoked(object sender,
InvokeWebServiceEventArgs e){ ...}
B. this.invokeWebServiceActivity1.Invoking += new
EventHandler<InvokeWebServiceEventArgs>(OnInvoking); void OnInvoking(object sender,
InvokeWebServiceEventArgs e){ ...}
C. this.invokeWebServiceActivity1.StatusChanged += new
EventHandler<ActivityExecutionStatusChangedEventArgs> (OnStatusChanged); private void
OnStatusChanged(object sender, EventArgs e){ if (invokeWebServiceActivity1.ExecutionStatus ==
ActivityExecutionStatus.Executing) { ... }}
D. this.invokeWebServiceActivity1.StatusChanged += new
EventHandler<ActivityExecutionStatusChangedEventArgs> (OnStatusChanged); private void
OnStatusChanged(object sender, EventArgs e){ if (invokeWebServiceActivity1.ExecutionStatus ==
ActivityExecutionStatus.Compensating) { ... }}
Answer: B

Q: 9 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses a sequential workflow.
You plan to add a workflow to the application.
You need to ensure that the workflow performs the following tasks:
It listens for an event raised by the host application.
It waits only for 30 minutes for the event to be raised.
What should you do?
A. Add the following activities in an EventHandlingScopeActivity activity:
A DelayActivity activity that has a delay of 30 minutes
A HandleExternalEventActivity activity
B. Add a DelayActivity activity that has a delay of 30 minutes before a HandleExternalEventActivity activity.
C. Add a ParallelActivity activity to the workflow. Add a HandleExternalEventActivity activity to one branch
of the ParallelActivity activity. Add a DelayActivity activity that has a delay of 30 minutes to the other branch.
D. Add a ListenActivity activity to the workflow. Add a HandleExternalEventActivity activity to one branch
of the ListenActivity activity. Add a DelayActivity activity that has a delay of 30 minutes to the other branch.
Answer: D

Q: 10 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application contains a state workflow.
You write the following code segment.
WorkflowRuntime runtime = new WorkflowRuntime();
WorkflowInstance instance = runtime.CreateWorkflow(
typeof(DynamicUpdateWorkflow));
instance.Start();
StateMachineWorkflowInstance smwi =
new StateMachineWorkflowInstance(runtime,
instance.InstanceId);
A dependency property named Status is defined in this workflow.
The value of a variable named amount is used to set the state of the workflow.
You need to ensure that the host application changes the state of the workflow on the basis of the value of
the amount variable.
What are the two possible code segments that you can use to achieve this goal? (Each correct answer
presents a complete solution. Choose two.)
A. if (amount >= 1000) smwi.SetState("HighValueState");else smwi.SetState("LowValueState");
B. if (amount >= 1000) smwi.StateMachineWorkflow.SetValue
(DynamicUpdateWorkflow.StatusProperty,"HighValueState")else
smwi.StateMachineWorkflow.SetValue (DynamicUpdateWorkflow.StatusProperty, "LowValueState");
C. if (amount >= 1000) instance.GetWorkflowDefinition().SetValue
(DynamicUpdateWorkflow.StatusProperty,"HighValueState");else
instance.GetWorkflowDefinition().SetValue (DynamicUpdateWorkflow.StatusProperty,"LowValueState");
D. if (amount >= 1000){ StateActivity high = (StateActivity)
smwi.StateMachineWorkflow.Activities["HighValueState"]; smwi.SetState(high);}else{
StateActivity low = (StateActivity) smwi.StateMachineWorkflow.Activities["LowValueState"];
smwi.SetState(low);}
Answer: A, D

Q: 11 You create an application in which users design simple sequential workflows.
The designs are stored as XOML in a SQL database. You need to start one of these sequential workflows from within your own workflow. What should you do?
A. Include a custom activity with a code segment that includes an invocation to the CreateWorkflow method
of the WorkflowRuntime class and then starts the workflow. The signature of the CreateWorkflow method invoked uses only the workflowType parameter.
B. Include a custom activity with a code segment that includes an invocation to the CreateWorkflow method
of WorkflowRuntime class and then starts the workflow. The signature of the CreateWorkflow method invoked uses only the XmlReader and workflowDefinitionReader parameters.
C. Include a custom activity with a code segment that includes an invocation to the CreateWorkflow method
of the WorkflowRuntime class and then starts the workflow. The signature of the CreateWorkflow method invoked uses only the workflowType, Dictionary<string,Object> namedArgumentValues, and Guid
instanceId parameters.
D. Include and configure an InvokeWorkflow activity
Answer: B

Q: 12 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses a sequential workflow. The workflow is implemented in a class named ProcessOrders. The workflow contains a dependency property named EmployeeID. You need to ensure that the EmployeeID property is assigned a value when the host application tries to create a new workflow instance. Which code segment should you use?
A. WorkflowRuntime runtime = new WorkflowRuntime();ProcessOrders processOrders = new
ProcessOrders();processOrders.EmployeeID =
"NBK";WorkflowInstance instance = runtime.CreateWorkflow(typeof(ProcessOrders));
B. WorkflowRuntime runtime = new WorkflowRuntime();ProcessOrders processOrders = new ProcessOrders
();processOrders.SetValue(ProcessOrders.EmployeeIDProperty , "NBK");WorkflowInstance instance =
runtime.CreateWorkflow(typeof(ProcessOrders));
C. WorkflowRuntime runtime = new WorkflowRuntime();Dictionary<string, object> dict = new
Dictionary<string,object>();dict.Add("EmployeeID",
"NBK");WorkflowInstance instance = runtime.CreateWorkflow(typeof(ProcessOrders), dict);
D. WorkflowRuntime runtime = new WorkflowRuntime();Dictionary<string, object> dict = new
Dictionary<string,object>();dict.Add("EmployeeIDProperty",
"NBK");WorkflowInstance instance = runtime.CreateWorkflow(typeof(ProcessOrders), dict);
Answer: C

Q: 13 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses a sequential workflow as shown in the following exhibit. (Click the Exhibit button for the sequential workflow image.)
The workflow implements an if condition as shown in the following exhibit. (Click the Exhibit button for
the if condition image.)
A new business policy requires the application to ascertain whether the amount is less than 15,000
instead of the current default.
You write the following code segment in the host application. (Line numbers are included for reference
only.)
01 Int32 newAmount = 15000;
02 WorkflowChanges workflowchanges =
03 new WorkflowChanges(instance.GetWorkflowDefinition());
04 CompositeActivity transient =
05 workflowchanges.TransientWorkflow;
06 RuleDefinitions ruleDefinitions = (RuleDefinitions)
07 transient.GetValue(RuleDefinitions.RuleDefinitionsProperty);
08 RuleConditionCollection conditions =
09 ruleDefinitions.Conditions;
10
11 (condition1.Expression as CodeBinaryOperatorExpression).Right
12 = new CodePrimitiveExpression(newAmount); instance.ApplyWorkflowChanges(workflowchanges);
You need to build a host application that modifies the condition according to the business requirement in
workflow instances that are currently executing.
Which code segment should you insert at line 10?

A. RuleExpressionCondition condition1 = (RuleExpressionCondition)conditions["Check"];
B. RuleExpressionCondition condition1 = (RuleExpressionCondition)conditions["ifElseBranch1"];
C. RuleExpressionCondition condition1 = (RuleExpressionCondition)conditions["ifElseBranch2"];
D. RuleExpressionCondition condition1 = (RuleExpressionCondition)conditions["Declarative Rule
Condition"];
Answer: A

Q: 14 You create a workflow host application by using Microsoft .NET Framework 3.5. You use Windows Workflow Foundation to create the application. You need to configure the workflow runtime to ensure that all the workflow instances run asynchronously. Which code segment should you use?
A. WorkflowRuntime runtime = new WorkflowRuntime();runtime.StartRuntime();WorkflowInstance instance = runtime.CreateWorkflow(typeof(CustomerWorkflow));instance.Start();
B. WorkflowRuntime runtime = new
WorkflowRuntime();runtime.StartRuntime();ManualWorkflowSchedulerService scheduler =
runtime.GetService<ManualWorkflowSchedulerService>();WorkflowInstance instance =
runtime.CreateWorkflow(typeof(CustomerWorkflow));scheduler.RunWorkflow(instance.InstanceId);
C. WorkflowRuntime runtime = new WorkflowRuntime();ManualWorkflowSchedulerService scheduler =
new
ManualWorkflowSchedulerService();runtime.AddService(scheduler);runtime.StartRuntime(); WorkflowInstance instance =
runtime.CreateWorkflow(typeof(CustomerWorkflow));instance.Start();
D. WorkflowRuntime runtime = new
WorkflowRuntime();runtime.StartRuntime();DefaultWorkflowSchedulerService scheduler = new
DefaultWorkflowSchedulerService();runtime.AddService(scheduler);WorkflowInstance instance =
runtime.CreateWorkflow(typeof(CustomerWorkflow));instance.Start();
Answer: A

Q: 15 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
The workflow has a ListenActivity activity as shown in the following exhibit. (Click the Exhibit button.)

The event handlers are bound to an ExternalDataExchange interface that defines the Approve and
Decline events.
You need to add a CodeActivity activity named CleanupActivity for the eventDrivenActivity1 branch to execute when a Decline event is raised.
What should you do?
A. Add a CancellationHandlerActivity activity to the listenActivity1 activity.
Add the CleanupActivity activity to the CancellationHandlerActivity activity.
B. Add a CancellationHandlerActivity activity to the eventDrivenActivity1 branch.
Add the CleanupActivity activity to the CancellationHandlerActivity activity.
C. Add a FaultHandlersActivity activity to the listenActivity1 activity.
Add a FaultHandlerActivity activity to the FaultHandlersActivity activity.
Add the CleanupActivity activity to the FaultHandlerActivity activity.
D. Add a FaultHandlersActivity activity to the eventDrivenActivity1 branch.
Add a FaultHandlerActivity activity to the FaultHandlersActivity activity.
Add the CleanupActivity activity to the FaultHandlerActivity activity.
Answer: B

Q: 16 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. You add a class to the workflow that implements the IPendingWork interface. The class interacts with a Microsoft SQL Server 2005 database. All database write operations must be performed in a transaction. You implement a Commit method of the IPendingWork interface. You need to complete the Commit method. Which code segment should you use?
A. public void Commit(Transaction trans, ICollection items) { SqlConnection con = new
SqlConnection("<con str>"); con.BeginTransaction(); ...}
B. public void Commit(Transaction trans, ICollection items) { SqlConnection con = new
SqlConnection("<con str>"); con.EnlistTransaction(trans); ...}
C. public void Commit(Transaction trans, ICollection items) { SqlConnection con = new
SqlConnection("<con str>"); con.EnlistTransaction(new
CommittableTransaction()); ...}
D. public void Commit(Transaction trans, ICollection items) { using (TransactionScope tscope=new
TransactionScope()) { SqlConnection con = new
SqlConnection("<con str>"); ... tscope.Complete(); }}
Answer: B

Q: 17 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The workflow uses a TransactionScopeActivity activity. When you run the workflow, a runtime exception is thrown. You need to add a workflow runtime service to make the workflow functional. Which runtime service should you use?
A. SqlTrackingService
B. SqlWorkflowPersistenceService
C. ManualWorkflowSchedulerService
D. SharedConnectionWorkflowBatchService
Answer: B

Q: 18 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses a sequential workflow that contains five activities. You need to configure the workflow to continue processing even if an activity throws an error.
What should you do?
A. Subscribe to the WorkflowTerminated event in the host to capture errors thrown by workflow instances.
B. Place the potentially offending activities in a TransactionScope activity. Set the IsolationLevel property of the TransactionScope activity to Serializable.
C. Use the SequentialWorkflowActivity instance of the FaultHandlersActivity activity to add one or more instances of the FaultHandlerActivity activity. Ensure that one of the FaultHandlerActivity instances catches the System.Exception class.
D. Place the potentially offending activities in a SequenceActivity activity. Add one or more
FaultHandlerActivity instances to the FaultHandlersActivity instance of the SequenceActivity activity. Ensure that the FaultHandlerActivity instances catch the System.Exception class.
Answer: D

Q: 19 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
Your workflow has a rule set and a property named Discount. The rule set includes two rules named RuleA and RuleB.
The RuleA rule has the following properties:
Expression = "IF this.Discount > 10 THEN this.Discount=10"
Reevaluation = "Always"
Priority = 0
The RuleB rule has the following properties:
Expression = "IF this.OrderAmount > 2000 THEN this.Discount = this.Discount + 5"
Reevaluation = "Always"
Priority = 0
The rule set has its chaining behavior set to Explicit Update Only.
You need to ensure that the RuleA rule is re-evaluated after the RuleB rule.
What should you do?
A. Set the expression for the RuleB rule to "IF this.OrderAmount > 2000 THEN this.Discount = this.Discount + 5 Update("RuleA")"
B. Set the expression for the RuleB rule to "IF this.OrderAmount > 2000 THEN this.Discount = this.Discount + 5 Update("this/Discount")"
C. Set the expression for the RuleA rule to "IF this.Discount > 10 THEN this.Discount = 10 Update(RuleB")"
D. Set the expression for the RuleA rule to "IF this.Discount > 10 THEN this.Discount = 10
Update("this/Discount")"
Answer: B

Q: 20 You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. You plan to use an exception logging strategy to log unhandled exceptions that occur in the workflow. You need to identify a logging strategy that works for Sequential workflows and state machineCbased workflows. Which strategy should you use?
A. Bind an event handler to the WorkflowTerminated event of the WorkflowRuntime instance in the host application. Log the exception inline.
B. Add a FaultHandlersActivity activity to the workflow and include a FaultHandlerActivity activity that matches the System.Exception type. Log the exception by using the CodeActivity activity.
C. Create a custom class derived from WorkflowRuntimeService that binds an event handler to the
WorkflowAborted event of the WorkflowRuntime instance in the host application. Log the workflow inline.
D. Declare a global EventDrivenActivity activity named ExceptionOccurred and add a FaultHandlersActivity activity to it. Include a FaultHandlerActivity activity that matches the System.Exception type. Log the exception by using the CodeActivity activity.
Answer: A


© 2014 Cheat-Test.com, All Rights Reserved