CBSE Class 11 Informatics Practice: Flow of Control Notes

These notes for CBSE Class 11 Informatics Practice cover the fundamental concept of Flow of Control in programming languages like C, C++, and Java. It explains the three main programming constructs: Sequence, Selection, and Iteration. The Selection construct details decision-making statements such as if, if-else, if-else if-else, nested if-else, and the switch statement, including their syntax and examples. The Iteration construct explores different types of loops: while, do-while, and for loops, illustrating their usage with code snippets and outputs. Additionally, the notes discuss jump statements like break and continue, clarifying their roles in altering the normal flow of program execution. These notes are designed to aid students in understanding and revising these crucial programming concepts for their exams.

Last optimized 10 Aug 2026

Flow of Control in C, C++,  and Java, Class 11 Nnotes PDF Download

 

PROGRAMMING CONSTRUCT 1. SEQUENCE 2. SELECTION 3. ITERATION

Decision Making Statements ( Selection Construct) :-

There are two types of decision making statements in Java. They are: · if statements · switch statements

The if Statement:

An if statement consists of a Boolean expression followed by one or more statements.

Syntax:

The syntax of an if statement is:

If the Boolean expression evaluates to true then the block of code inside the if statement will be

executed. If not the first set of code after the end of the if statement (after the closing curly brace)

will be executed.

Example:

The if...else Statement:

An if statement can be followed by an optional else statement, which executes when the Boolean

expression is false.

Syntax:

The syntax of an if...else is: 

The if...else if...else Statement:

An if statement can be followed by an optional else if...else statement, which is very useful to

test various conditions using single if...else if statement.

When using if , else if , else statements there are few points to keep in mind.

· An if can have zero or one else’s and it must come after any else if’s.

· An if can have zero to many else if’s and they must come before the else.

· Once an else if succeeds, none of the remaining else if’s or else’s will be tested.

Syntax:

The syntax of an if...else is: 

Example:

Nested if...else Statement:

It is always legal to nest if-else statements which means you can use one if or else if statement

inside another if or else if statement.

Syntax:- The syntax for a nested if...else is as follows: 

You can nest else if...else in the similar way as we have nested if statement.

Example:

The switch Statement :-

A switch statement allows a variable to be tested for equality against a list of values. Each value

is called a case, and the variable being switched on is checked for each case.

Syntax:

The syntax of enhanced for loop is: 

The following rules apply to a switch statement:

· The variable used in a switch statement can only be a byte, short, int, or char.

· You can have any number of case statements within a switch. Each case is followed by

the value to be compared to and a colon.

· The value for a case must be the same data type as the variable in the switch and it must

be a constant or a literal.

· When the variable being switched on is equal to a case, the statements following that case

will execute until a break statement is reached.

· When a break statement is reached, the switch terminates, and the flow of control jumps

to the next line following the switch statement.

· Not every case needs to contain a break. If no break appears, the flow of control will fall

through to subsequent cases until a break is reached.

· A switch statement can have an optional default case, which must appear at the end of the

switch. The default case can be used for performing a task when none of the cases is true. No

break is needed in the default case.

Example

Iteration Construct :-

1. Java while Loop

The while loop or while statement continually executes a block of statements while a particular condition

is true. The while syntax can be written as: 

while (expression) { statement(s) } The while loop evaluates expression, which must return a boolean value. If the while loop expression

returns true, then the statements with in the while block will be executed. The while loop continuously

executes the statements within the block, until the expression returns false.

Here is a simple while loop example, which executes until i value became 10: 

int i=0;

while(i < 10){

//this block will executed until

//i value became 10

System.out.print(i+" ");

i=i+1; } Output:

0 1 2 3 4 5 6 7 8 9

2. Java do-while Loop :-

A do-while loop is similar to a while loop, except that a do-while loop is guaranteed to execute at least

one time. The difference between do-while and while loop is that do-while evaluates its condition at the

bottom of the loop instead of the top. Therefore, the statements within the do block are always executed at

least once.

Here is the syntax to write do-while loop:  do {

statement(s) } while (expression); } While (expression);

The do-while statement evaluates expression, which must return a boolean value. If the expression is true,

the flow of control goes back to the do, and the statements within the loop executes again. This process

repeats until the expression returns false.

Here is a simple do-while example 

int i = 0;

do {

System.out.print(i+" ");

i=i+1;

} while(i<10);

3. Java for Loop :-

The for statement or for loop provides a way to iterate over a range or list of values. Using for loop you

can repeatedly loops until a particular condition is satisfied. The general form of the for statement can be

expressed as follows:

for (initialization; condition

for terminating; loop increment) { statement(s)  } In the above statement, initialization expression initializes the loop; it is executed only once, as the loop

begins.

When the termination condition returns false, then the loop terminates. The increment expression is invoked after each iteration through the loop. Here you can either increment

or decrement a value.

Here is a simple for loop example to display numbers from 1 to 10. 

for(int i=1;i<=10;i++){

System.out.print(i+" "); } System.out.println( ); /** * another example to increment by 2 steps */ for(int i=1;i<=10;i=i+2){

System.out.print(i+" "); } System.out.println( ); /** * Below loop prints the numbers in reverse order */ for(int i=10;i>0;i--){

System.out.print(i+" "); } System.out.println( )

Statement for Jump:--
1. break statement in java:-

The break statement is one of the control statement in java. The break statement is generally used

to break the loop before the completion of the loop. The break statement is used when we want

to jump out of a single loop or single case in switch statement. Here is a simple example for break statement:

2. continue statement in java:-

The continue statement skips the current iteration of a for, while , or do-while loop. The moment it

encounters continue statement, it skips the rest of the statements in the loop and evaluates the

expression for next iterations. The difference between break and continue statements are, break

statement comes out of the loop, continue statement skips the current iteration and jumps to the next

iteration in a single loop.

Here is a simple example for continue statement: 

Frequently asked questions

What are the main programming constructs discussed in these notes?

The notes cover three main programming constructs: Sequence, Selection, and Iteration.

What types of decision-making statements are explained?

The notes explain if statements, if-else statements, if-else if-else statements, nested if-else statements, and switch statements.

Which loop structures are covered in the Iteration Construct section?

The Iteration Construct section covers Java's while loop, do-while loop, and for loop.

What is the purpose of the break statement?

The break statement is used to exit a loop or a switch statement prematurely.

How does the continue statement differ from the break statement?

The continue statement skips the current iteration of a loop and proceeds to the next, while the break statement exits the loop entirely.

What are the allowed data types for the variable in a switch statement?

The variable in a switch statement can only be of type byte, short, int, or char.

Are these notes suitable for CBSE Class 11 Informatics Practice students?

Yes, these notes are specifically designed for CBSE Class 11 Informatics Practice students covering the Flow of Control topic.