Worksheets › Class 11 › Flow of Control
Class 11 · Computer Science worksheetFlow of Control
CBSE Computer Science. if, elif and else, for loops and range(), while loops, break and continue, nested loops and patterns, primes, palindromes and Fibonacci. Every sheet has 20 questions in three sections and an answer key, and the questions change every time.
Sample questions
Real questions from this chapter, as the app sets them. Tap Answer to see the answer and working.
Section A · multiple choice
- 1.
In Python, the statements inside an if block are marked by:
- the keyword end
- semicolons
- curly brackets
- indentation
Answer
(d) indentation
- 2.
What does this program print? temp = 41 if temp < 20: print('cold') elif temp <= 34: print('pleasant') else: print('hot')
- hot
- cold
- pleasant
- cold pleasant
Answer
(a) hot
41: the first true condition wins
- 3.
What does this program print? s = 0 for i in range(7): s = s + i print(s)
- 15
- 28
- 21
- 22
Answer
(c) 21
i takes 0, 1, 2, 3, 4, 5, 6 (the stop value 7 is not included)
Section B · short answer
- 4.
What is the difference between break and continue?
Answer
break leaves the loop completely; continue skips the rest of the current pass and starts the next one.
- 5.
What does this program print? s = 0 for i in range(6, 12): s = s + i * i print(s)
Answer
451
i = 6, 7, 8, 9, 10, 11
Section C · long answer
- 6.
Explain the if, if-else and if-elif-else statements with a flowchart idea and a program for each.
Answer
if runs a block when a condition is True; if-else chooses one of two blocks; if-elif-else checks conditions in turn, e.g. grades from marks.
Fresh sheets for your child
In the app, every Flow of Control sheet is new: the app remembers the questions your child has already had and leaves them out. Print the sheet as a PDF, or use notebook mode and write the answers in a notebook.
Coming soon for Android and iPhone.