What is branching within a program? Branching is similar to a fork like structure. It basically means a change in the flow of a program where it executes to a different part of the program module. The decision to branch is usually based on the answer of the end user.
How is branching controlled? Branching is controlled by conditional test statements. The statement is executed once the test condition is met. The branch will flow in a certain direction depending on the criteria that was input. Otherwise, sequential flow of statement will be directed to other area of the program.
What is the role of an if statement in control structures? An if statement is basically a single block of instructions where the test condition have been met, then the statements will be executed sequentially. Otherwise, the statements are skipped over if the test condition failed.
To determine which types of selection structures, each groups or blocks of statements must be tested to determine which of these statements can be executed. 1) A single alternative structure contains only a single block of statements. If the test condition is met, the statements are executed. The statements are skipped if the test condition is not met. 2) There are two blocks of statements in a dual alternative structure. If the first block is executed after the test condition is met, then the program skips over the second block. If the first block of statements failed the test condition, it will be skipped and the second block is executed. 3) Containing more than two blocks of statements is called a case (multiple) alternative structure. With a case structure, there is a single test expression that determines which block of code is to be executed, depending on which value in the program matches the given options and all the other blocks are skipped.