Skip to main content
Chapter 6 of 11
NCERT Solutions

Flow of Control

CBSE · Class 11 · Computer Science

NCERT Solutions for Flow of Control — CBSE Class 11 Computer Science.

34 questions72 flashcards5 concepts

Interactive on Super Tutor

Studying Flow of Control? Get the full interactive chapter.

Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for ncert solutions and more.

1,000+ Class 11 students started this chapter today

21 Questions Solved · 3 Sections

11 worked solutions below. Unlock all 21 free in Super Tutor

EXERCISE

1What is the difference between else and elif construct of if statement?Show solution
The elif construct lets us check another condition after an `if`. If the first condition is false, Python checks the `elif` condition(s) one by one. The else construct is the final default part of the `if` statement and runs when none of the earlier conditions are true.

So:
- elif = “else if”, used for multiple conditions
- else = executes when all conditions are false

Not sure why a step works? check your working in Super Tutor

2What is the purpose of range() function? Give one example.Show solution
The range() function is used to create a sequence of integers for looping. It can specify a start, stop, and step value. The `stop` value is not included in the sequence.

Example: `list(range(2, 10))` gives `[2, 3, 4, 5, 6, 7, 8, 9]`.

Not sure why a step works? check your working in Super Tutor

3Differentiate between break and continue statements using examples.Show solution
break and continue are used to control loops, but they work differently:

- break: immediately ends the loop and control moves to the statement after the loop.
- continue: skips the remaining statements of the current iteration and goes back to the beginning of the loop for the next iteration.

Example of break:
```python
for i in range(1, 6):
if i == 3:
break
print(i)
```
Output:
`1 2`

Example of continue:
```python
for i in range(1, 6):
if i == 3:
continue
print(i)
```
Output:
`1 2 4 5`

Not sure why a step works? check your working in Super Tutor

4What is an infinite loop? Give one example.Show solution
An infinite loop is a loop whose condition never becomes false, so it keeps repeating forever.

Example:
```python
while True:
print("Hello")
```
This loop never stops unless it is broken by a `break` statement or the program is terminated.

Not sure why a step works? check your working in Super Tutor

5(i)a = 110
while a > 100:
print(a)
a -= 2
Show solution
`a` starts at `110` and the loop runs while `a > 100`.

Step by step:
- `110 > 100` → print `110`, then `a = 110 - 2 = 108`
- `108 > 100` → print `108`, then `a = 106`
- `106 > 100` → print `106`, then `a = 104`
- `104 > 100` → print `104`, then `a = 102`
- `102 > 100` → print `102`, then `a = 100`
- `100 > 100` is false, so the loop stops

So the output is the numbers from `110` down to `102`, decreasing by `2`.

Not sure why a step works? check your working in Super Tutor

5(ii)for i in range(20,30,2):
print(i)
Show solution
`range(20,30,2)` starts at `20`, increases by `2`, and stops before `30`.

So the values are:
- `20`
- `22`
- `24`
- `26`
- `28`

Not sure why a step works? check your working in Super Tutor

5(iii)country = 'INDIA'
for i in country:
print (i)
Show solution
The string `country = 'INDIA'` is a sequence of characters. The `for` loop prints each character one by one in order:

- `I`
- `N`
- `D`
- `I`
- `A`

Not sure why a step works? check your working in Super Tutor

5(iv)i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)
Show solution
Start with `i = 0` and `sum = 0`.

The loop runs while `i < 9`, and `i` increases by `2` each time.

Values of `i`: `0, 2, 4, 6, 8`

Check when `i % 4 == 0`:
- `i = 0` → yes, `sum = 0 + 0 = 0`
- `i = 2` → no
- `i = 4` → yes, `sum = 0 + 4 = 4`
- `i = 6` → no
- `i = 8` → yes, `sum = 4 + 8 = 12`

So the final printed value is `12`.

Not sure why a step works? check your working in Super Tutor

5(v)for x in range(1,4):
for y in range(2,5):
if x * y > 10:
break
print (x * y)
Show solution
For each `x` in `1, 2, 3`, the inner loop checks `y = 2, 3, 4`.

The statement `print(x * y)` is after `break`, so it is never executed.

Check the condition `x * y > 10`:
- For `x = 1`: products are `2, 3, 4` → no break
- For `x = 2`: products are `4, 6, 8` → no break
- For `x = 3`: products are `6, 9, 12` → when `y = 4`, condition becomes true and the inner loop breaks

Since the print is unreachable, nothing is printed.

Not sure why a step works? check your working in Super Tutor

5(vi)var = 7
while var > 0:
print ('Current variable value: ', var)
var = var -1
if var == 3:
break
else:
if var == 6:
var = var -1
continue
print ("Good bye!")
Show solution
Start with `var = 7`.

Loop steps:
1. Print `Current variable value: 7`
2. `var = var - 1` → `var = 6`
3. `if var == 3` → false
4. `else` branch: `if var == 6` → true, so `var = var - 1` makes `var = 5`, then `continue`
- `Good bye!` is skipped

Next iteration:
1. Print `Current variable value: 5`
2. `var = 4`
3. `if var == 3` → false
4. `if var == 6` → false
5. Print `Good bye!`

Next iteration:
1. Print `Current variable value: 4`
2. `var = 3`
3. `if var == 3` → true, so `break`

So the output is:
- `Current variable value: 7`
- `Current variable value: 5`
- `Good bye!`
- `Current variable value: 4`

Not sure why a step works? check your working in Super Tutor

PROGRAMMING EXERCISES

1Write a program that takes the name and age of the user as input and displays a message whether the user is eligible to apply for a driving license or not. (the eligible age is 18 years).Show solution
```python
name = input("Enter your name: ")
age = int(input("Enter your age: "))

if age >= 18:
print(name, "is eligible to apply for a driving license")
else:
print(name, "is not eligible to apply for a driving license")
```

Not sure why a step works? check your working in Super Tutor

2Write a function to print the table of a given number. The number has to be entered by the user.
3Write a program that prints minimum and maximum of five numbers entered by the user.
4Write a program to check if the year entered by the user is a leap year or not.
5Write a program to generate the sequence: -5, 10, -15, 20, -25... upto n, where n is an integer input by the user.
6Write a program to find the sum of 1+ 1/8 + 1/27...1/n³, where n is the number input by the user.
7Write a program to find the sum of digits of an integer number, input by the user.
8Write a function that checks whether an input number is a palindrome or not.
9Write a program to print the following patterns:
10Write a program to find the grade of a student when grades are allocated as given in the table below.

CASE STUDY-BASED QUESTIONS

6.1Write a menu driven program that has options to

10 more solved questions in Flow of Control

Every remaining exercise is solved step by step in Super Tutor, plus practice quizzes and flashcards for this chapter. Free to start.

Stuck on a step?

Ask Super Tutor AI to explain any solution on this page in a simpler way — free, 24x7.

Ask a Doubt Free

Frequently Asked Questions

What are the important topics in Flow of Control for CBSE Class 11 Computer Science?
Flow of Control covers several key topics that are frequently asked in CBSE Class 11 board exams. Focus on the core concepts listed on this page and practise related questions to build confidence.
How to score full marks in Flow of Control — CBSE Class 11 Computer Science?
Understand the core concepts first, then work through the 34 practice questions available for this chapter. Revise formulas and definitions regularly, and use flashcards for quick recall before the exam.
Where can I get free NCERT Solutions for Flow of Control Class 11 Computer Science?
This page has free step-by-step NCERT Solutions for every exercise question in Flow of Control (CBSE Class 11 Computer Science) — written the way examiners award marks: given, formula, working, answer.

Sources & Official References

Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.

For serious students

Get the full Flow of Control chapter — for free.

Quizzes, flashcards, AI doubt-solver and a step-by-step study plan for CBSE Class 11 Computer Science.