Skip to content
← Computer Science

Computer Science · Class 11 Optional

Ch 6Flow of Control — Class 11 Computer Science, concept-first.

Every program has an order in which its statements run, and controlling that order is what this chapter is about. The textbook opens with a simple picture: a school bus taking children to school along a road that offers exactly one route (Figure 6.1).

39

Q&A

20

Concepts

Not available

Exam weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

String Input Type

Imagine you're writing a program that asks someone for their name. The user types "Ravi" and presses Enter. What just arrived inside your program? A string — a sequence of characters: 'R', 'a', 'v', 'i'.

Start with this concept →

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

6.1

Introduction

Every program has an order in which its statements run, and controlling that order is what this chapter is about.

6.2

Selection

5 Q

Real life is full of decisions. Standing in a stationery shop with 10 rupees, you find several different pens all priced at 10 rupees each — you must choose one.

6.3

Indentation

How does Python know which statements belong to the if block and which come after it? Most programming languages answer this by wrapping the statements of a block inside curly brackets.

6.4

Repetition

Many tasks in daily life repeat: the electricity bill is paid every month, seasons return every year. Nature repeats too — Figure 6.3 shows the life cycle of a butterfly, which passes through four sta…

6.4.1

The ‘For’ Loop

5 Q

The for statement is used to iterate over a range of values or a sequence. The loop body executes once for each item in that range.

6.4.2

The ‘While’ Loop

2 Q

The while statement executes a block of code repeatedly as long as the control condition of the loop is true.

6.5

Break and Continue Statement

Looping constructs let a programmer repeat tasks efficiently — but sometimes the normal round-and-round flow of a loop needs to be interrupted.

6.5.1

Break Statement

3 Q

The break statement alters the normal flow of execution: it terminates the current loop immediately and resumes execution at the statement following that loop.

6.5.2

Continue Statement

Where break abandons a loop entirely, the continue statement abandons only the current iteration. When continue is encountered, control skips the remaining statements in the body of the loop for that…

6.6

Nested Loops

4 Q

A loop may contain another loop inside its body. A loop placed inside another loop is called a nested loop.

Summary

- The order in which the statements of a program are executed is called the flow of control; it is shaped using control structures, of which Python supports two types — selection and repetition.

Exercises

More questions

11 Q