Skip to main content
Chapter 6 of 11
NCERT Solutions

Flow of Control — NCERT Solutions

CBSE · Class 11 · Computer Science

NCERT Solutions for Flow of Control, CBSE Class 11 Computer Science: 21 textbook questions solved step by step.

33 questions72 flashcards5 formulas & key relations5 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.

Free trial, no card needed.

21 Questions Solved · 3 Sections

The first 11 solutions are open to read. The other 10 are free with a Super Tutor account. 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:

for i in range(1, 6):
    if i == 3:
        break
    print(i)

Output:
1 2

Example of continue:

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:

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
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.

Free with a Super Tutor account

3Write a program that prints minimum and maximum of five numbers entered by the user.

Free with a Super Tutor account

4Write a program to check if the year entered by the user is a leap year or not.

Free with a Super Tutor account

5Write a program to generate the sequence: -5, 10, -15, 20, -25... upto n, where n is an integer input by the user.

Free with a Super Tutor account

6Write a program to find the sum of 1+ 1/8 + 1/27...1/n³, where n is the number input by the user.

Free with a Super Tutor account

7Write a program to find the sum of digits of an integer number, input by the user.

Free with a Super Tutor account

8Write a function that checks whether an input number is a palindrome or not.

[Note: A number or a string is called palindrome if it appears same when written in reverse order also. For example, 12321 is a palindrome while 123421 is not a palindrome]

Free with a Super Tutor account

9Write a program to print the following patterns:
i)***********ii)12 1 23 2 1 2 34 3 2 1 2 3 45 4 3 2 1 2 3 4 5
iii)1 2 3 4 51 2 3 41 2 31 21iv)

Free with a Super Tutor account

10Write a program to find the grade of a student when grades are allocated as given in the table below.
Percentage of MarksGrade
Above 90%A
80% to 90%B
70% to 80%C
60% to 70%D
Below 60%E

Percentage of the marks obtained by the student is input to the program.

Free with a Super Tutor account

Case Study-based Questions

6.1Write a menu driven program that has options to
  • accept the marks of the student in five major subjects in Class X and display the same.
  • calculate the sum of the marks of all subjects. Divide the total marks by number of subjects (i.e. 5), calculate percentage = total marks/5 and display the percentage.
  • Find the grade of the student as per the following criteria:
CriteriaGrade
percentage &gt; 85A
percentage &lt; 85 &amp;&amp; percentage &gt;= 75B
percentage &lt; 75 &amp;&amp; percentage &gt;= 50C
percentage &gt; 30 &amp;&amp; percentage &lt;= 50D
percentage &lt;30Reappear

Free with a Super Tutor account

10 more solved questions in Flow of Control

They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.

Frequently Asked Questions

What are the important topics in Flow of Control for CBSE Class 11 Computer Science?
Key topics in Flow of Control include Flow of Control and Sequence Execution, Selection Statements, Indentation in Python, Repetition and Loops. Study these first, then practise questions on each for Class 11 exams.
Are these NCERT Solutions for Flow of Control free?
The first 11 of the 21 solutions on this page are open to read. The other 10 are free with a Super Tutor account — signing up is free and needs no card.
How should I revise Flow of Control for Class 11 exams?
Learn the core ideas first, then work through the 33 practice questions on Flow of Control. Revise definitions regularly and use flashcards for quick recall before the exam.

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 — start free.

Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Computer Science. Free to start, no card needed.