Control Flow Graphs
- The graphical representation of a program's control structure is known as control flow graph
- It uses the elements like process blocks, decisions and junctions
- The flow graph is not to be confused with the earlier flowchart, though both are similar
- The four different types of flow graph elements are
Process Block:
A process block is a sequence of program statements which are not interrupted by either decisions or junctionsIf any one of the statements of the block is executed, then all followed statements are executed
Process block contains a piece of straight line code of one statement or hundreds of statements
A process has one entry and one exit
It can consist of a single statement or instruction, a sequence of statements or instructions, a single entry/exit subroutine, a macro or function call, or a sequence of these
Decisions
A decision is a program point at which the control flow can divergeExample: Machine language conditional branch and conditional skip instructions
In control flow, most of the decisions are two way but in some case it may have three way branches
Case Statements:
A case statement is a multi -way branch or a decisionExample: A jump table in assembly language and the PASCAL case statement
In the test design point of view, there are no differences between decisions and case statements
Junctions
A junction is a point in the program where the control flow can mergeExamples of junctions are, the target of a jump or skip instruction in ALP a label that is a target of GOTO
Post a Comment
Post a Comment