Windows Workflow Foundation (WWF) Interview Questions
These Windows Workflow Foundation (WWF) interview questions include topics such as activities, code activities, the workflow runtime engine, code conditions and rule conditions.
They are suitable for the following job roles:
- C# Developer
- SharePoint Developer
- .NET Developer
We wrote these questions so other IT developers could practice for their next interview or technical test. They are suitable for both consultants, temp staff or full time permanent roles.
If the organisation is using Windows Workflow Foundation then these questions should help you out..
Interview Questions
1. An Activity is the fundamental building block of workflows. An Activity defines a set of properties and events, such as any class, along with execution logic that defines the activity's run-time behavior. A set of additional components can be associated with an Activity. Which class do all activities derive from?
System.Workflow.ComponentModel.Activity
System.Workflow.ComponentModel.ActivityBind
System.Workflow.ComponentModel.CompositeActivity
System.Workflow.ComponentModel.CodeActivity
Show AnswerAnswer:
System.Workflow.ComponentModel.Activity
Comments:
The System.Workflow.ComponentModel namespace provides the base classes, interfaces, and core modeling constructs that are used to create activities and workflows
2. You are creating a new workflow that writes data to a database when a process has been completed. To write to the database you have chosen to use the CodeActivity. which event of the CodeActivity class should you use to write your code?
AfterResponse
Save
BeforeResponse
ExecuteCode
Show AnswerAnswer:
ExecuteCode
Comments:
CodeActivity fires when the CodeActivity starts. AfterResponse and BeforeResponse are part of the SendActivity class and not CodeActivity.
3. As part of a new internal development project you have been creating new Workflows for various business procedures. You now want to host these workflows. Can you complete the two missing words from the paragraph below which describes how to run a workflow?
Create a new instance of the ___ and call the ___ method with the type of the workflow. Finally call Start on the returned WorkflowInstance object.
WorkflowRuntime, GetService
WorkflowRuntime, AddService
WorkflowRuntime, StartRuntime
WorkflowRuntime, CreateWorkflow
Show AnswerAnswer:
WorkflowRuntime, CreateWorkflow
Comments:
The CreateWorkflow mathod creates a workflow instance by using the specified parameters. After you create the workflow instance, call WorkflowInstance..::.Start on the WorkflowInstance object returned by the CreateWorkflow method to begin its execution.
4. As part of a new business requirement your team has been developing new Workflows using .NET 3.5. Some of these workflows run without parameters where as others require them. Which parameter type should you pass to the CreateWorkflow method to pass parameters to a workflow?
Multidimensional Object Array
Dictionary
Custom parameter class
List
Show AnswerAnswer:
Dictionary
Comments:
The CreateWrokflow method accepts a Dictionary(TKey, TValue) of objects keyed by string that represents the arguments to the workflow.
5. A new workflow called ReportSignOff created by the senior development team is throwing an exception every time its run. This workflow expects several parameters and it can't run without them. The exception thrown is ArgumentException with the following message
The workflow ReportSignOff has no public writable property named ‘person'
What is the cause of this exception?
The parameter person was missing from the arguments used to start the workflow
The parameter person should be passed as Person
None of these
The person argument is a reserved word and cannot be used
Show AnswerAnswer:
The parameter person should be passed as Person
Comments:
Properties are declared with a capitalised first letter. Private variables are commonly declared with lowercase syntax.
6. Which of the following is TRUE regarding workflows and the workflow runtime engine?
There can be several workflow runtime engines within an application domain
All of these
Compiled workflows can be executed inside console applications, forms-based applications, Windows Services and ASP.NET Web sites
Each instance of the runtime engine can support multiple workflow instances running concurrently
Show AnswerAnswer:
All of these
Comments:
Every running workflow instance is created and maintained by an in-process runtime engine that is commonly referred to as the workflow runtime engine. There can be several workflow runtime engines within an application domain, and each instance of the runtime engine can support multiple workflow instances running concurrently.
7. You are designing a new windows workflow that meets the needs of the HR department of you organisation. This workflow should contain an activity that calls a local service with a set of parameters. Which type of activity should you add to the workflow?
CallExternalMethodActivity
CompensateActivity
EventDrivenActivity
StateActivity
Show AnswerAnswer:
CallExternalMethodActivity
Comments:
The CallExternalMethodActivity activity and the HandleExternalEventActivity activity can be used for input and output communications with a local service. The base CallExternalMethodActivity class invokes the method specified by the InterfaceType and MethodName properties on the corresponding local service that is registered with the WorkflowRuntime
8. You are in the process of creating a new Windows Workflow and need to choose the type of activity to use. The activity must iterate through a collection of entities and must be similar to the .NET foreach statement. Which activity type should you choose?
ConditionedActivbi
ReplicatorActivity
IfElseActivity
WhileActivity
Show AnswerAnswer:
ReplicatorActivity
Comments:
The ReplicatorActivity is similar to a for each statement in code. If you are presented with a task in which you repeat the same function on many different entities, ReplicatorActivity may be a better solution than WhileActivity
9. A RuleSet consists of one or more rule conditions and their resulting actions. You can think of a rule as an IF-THEN-ELSE statement, with the condition corresponding to the IF, and the actions defining the behavior of the THEN and ELSE clauses. What can an action do?
Set a field or property on a workflow
Any of these
Call static methods on types in referenced assemblies
Call a method on a workflow or objects in a workflow
Show AnswerAnswer:
Any of these
10. What is FALSE regarding workflow Code Conditions and Declarative Rule Conditions
Declarative Rule Conditions are defined separately from the workflow code
Code Conditions can be modified at runtime without the need to recompile any code Code Conditions work by writing code within an event handler that evaluate to a Boolean result
Code Conditions can be modified at runtime without the need to recompile any code
Declarative Rule Conditions can be modified at runtime without the need to recompile any code
Show AnswerAnswer:
Code Conditions can be modified at runtime without the need to recompile any code Code Conditions work by writing code within an event handler that evaluate to a Boolean result
Comments:
The primary reason for a developer to use a rule condition instead of a code condition is that rule conditions become part of the model and can be dynamically updated at run time on executing workflow instances. A secondary advantage of rule conditions is that as part of the model, more sophisticated tools can be built on top of the model to provide additional authoring experiences, dependency management, cross-condition analysis, and so on.
11. You have created a new complex workflow that sends emails based on multiple if else logic branches. The code is not executing as you would have liked and you need figure out which if else branches are causing the problem. What is the easiest option you could try?
Use the workflow designer to disable workflows
Remove each branch from the source code one by one
Remove all if else branches and use a CompensationActivity branch
Add console output for each if else branch to help debugging
Show AnswerAnswer:
Use the workflow designer to disable workflows
Comments:
The ability to enable and disable activities is a great feature of the workflow designer
12. The development team has created a new workflow that implements new business logic for you company. However, the workflow is throwing an unhandled exception. Which event of the WorkflowRuntime will be thrown?
WorkflowCompleted
WorkflowPersisted
WorkflowSuspended
WorkflowTerminated
Show AnswerAnswer:
WorkflowTerminated
Comments:
The workflow can be terminated by the host through a call to the Terminate method, by a TerminateActivity activity, or by the workflow runtime engine when an unhandled exception occurs.
13. The WorkflowInstance class exposes methods and properties that can be used to control the execution of a workflow instance; it is essentially a proxy to the actual workflow instance used by the workflow runtime engine. Since multiple instances of the same workflow can be running. Which property of the WorkflowInstance can be used to distinguish them?
InstanceId int
InstanceId Guid
InstanceId dictionary
InstanceId string
Show AnswerAnswer:
InstanceId Guid
Comments:
The InstanceId property is the unique identifier (Guid) for the workflow instance.
14. The PolicyActivity encapsulates a set of rules known as a RuleSet and evaluates them in order. After evaluating a rule, the engine may determine that a previous rule in the sequence requires reevaluation. Sometimes this can be the case if the current rule modified a value that a prior rule was dependent upon. What is the name of this process?
Backward chaining
Strong links
Link chaining
Forward chaining
Show AnswerAnswer:
Forward chaining
Comments:
Chaining is based on the identified dependencies among rules; more specifically, the dependencies among the actions of a rule and the conditions of other rules.
15. As part of a larger specialized workflow you want to develop a custom activity that supports child activities. Which class should you derive from?
CompositeActivity
Activity
DelayActivity
CodeActivity
Show AnswerAnswer:
CompositeActivity
Comments:
Derivative of Activity that is the base class for all activities that contain other activities. A CompositeActivity is responsible for managing the execution of its child activities.
16. The development team at Workflow enterprises has developed a new workflow for authoring project management reports. During execution of the workflow, the workflow will need to wait for an external event. Which activity would be best to achieve this?
DelayActivity
SequenceActivity
CodeActivity
ReplicatorActivity
Show AnswerAnswer:
DelayActivity
Comments:
The DelayActivity provides the logic to establish a timer and to wait, asynchronously, for timer's expiration
17. The development team has created a workflow for music production. They now want to add a new activity to your workflow that will spawn a second workflow. Which activity should you add to the workflow?
ReplicatorActivity
ParallelActivity
SequenceActivity
InvokeWorkflowActivity
Show AnswerAnswer:
InvokeWorkflowActivity
Comments:
You can use the InvokeWorkflowActivity activity to start one workflow from another. The InvokeWorkflowActivity activity finishes before the launched workflow starts executing and the next activity in the workflow branch is executed.
18. You have designed a new workflow and want to share properties between different activities. Rather than write code to pass values from one activity to another which is not the recommended process, you want to use a better technique. What should you do?
Use the CompensationActivity to pass values between activities
There is no better way to pass values between activities
Use the ParallelActivity to pass values between activities
Use the ActivityBind class to bind one property to another
Show AnswerAnswer:
Use the ActivityBind class to bind one property to another
Comments:
The ActivityBind class binds an activity's property to a property, field, indexer, method, event, or another activity's property