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.
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.
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 -= 2Show solution
a starts at 110 and the loop runs while a > 100.
Step by step:
110 > 100→ print110, thena = 110 - 2 = 108108 > 100→ print108, thena = 106106 > 100→ print106, thena = 104104 > 100→ print104, thena = 102102 > 100→ print102, thena = 100100 > 100is 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:
2022242628
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:
INDIA
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 = 0i = 2→ noi = 4→ yes,sum = 0 + 4 = 4i = 6→ noi = 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 are2, 3, 4→ no break - For
x = 2: products are4, 6, 8→ no break - For
x = 3: products are6, 9, 12→ wheny = 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:
- Print
Current variable value: 7 var = var - 1→var = 6if var == 3→ falseelsebranch:if var == 6→ true, sovar = var - 1makesvar = 5, thencontinue
Good bye!is skipped
Next iteration:
- Print
Current variable value: 5 var = 4if var == 3→ falseif var == 6→ false- Print
Good bye!
Next iteration:
- Print
Current variable value: 4 var = 3if var == 3→ true, sobreak
So the output is:
Current variable value: 7Current variable value: 5Good 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
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
[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
| 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 21 | iv) |
Free with a Super Tutor account
| Percentage of Marks | Grade |
|---|---|
| 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
- 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:
| Criteria | Grade |
|---|---|
| percentage > 85 | A |
| percentage < 85 && percentage >= 75 | B |
| percentage < 75 && percentage >= 50 | C |
| percentage > 30 && percentage <= 50 | D |
| percentage <30 | Reappear |
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?
Are these NCERT Solutions for Flow of Control free?
How should I revise Flow of Control for Class 11 exams?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Flow of Control
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
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.