Worksheets › Class 11 › Flow of Control

Class 11 · Computer Science worksheet

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

Open a printable sample sheet

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

    In Python, the statements inside an if block are marked by:

    1. the keyword end
    2. semicolons
    3. curly brackets
    4. indentation
    Answer

    (d) indentation

  2. 2.

    What does this program print? temp = 41 if temp < 20:     print('cold') elif temp <= 34:     print('pleasant') else:     print('hot')

    1. hot
    2. cold
    3. pleasant
    4. cold pleasant
    Answer

    (a) hot

    41: the first true condition wins

  3. 3.

    What does this program print? s = 0 for i in range(7):     s = s + i print(s)

    1. 15
    2. 28
    3. 21
    4. 22
    Answer

    (c) 21

    i takes 0, 1, 2, 3, 4, 5, 6 (the stop value 7 is not included)

Section B · short answer

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

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

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

More Class 11 Computer Science