Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuition

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labs

Reference

GlossaryBlogDiscoveries
Practice › Class 11 › Computer Science

Python programming: practice questions

Class 11 Computer Science. Ten questions with step-by-step answers, for CBSE and ICSE. Try each one before you open its answer.

Practise this with your AI tutorGo to the questions

Key ideas

  • Flow of control and loops.
  • These are the multi-step questions examiners like to set. Read each one twice, write down what you know, then plan before you calculate.
  • These go beyond the syllabus. Each one has a neat idea that makes it short; brute force is slow.

Read each question twice and say the answer out loud before you check it. For code or binary questions, work it out on paper step by step, the way a computer would.

Ten questions

  1. 1.What does this print? total = 0 for i in range(1, 5): total += i print(total)

    Show the answer

    Think: Add each i.

    Work: 1 + 2 + … + 4.

    Answer: 10

  2. 2.What does this print? print(54 // 6)

    Show the answer

    Think: // is whole-number division, % is the remainder.

    Work: Run it line by line.

    Answer: 9

  3. 3.What does this print? total = 0 for i in range(1, 7): total += i print(total)

    Show the answer

    Think: Add each i.

    Work: 1 + 2 + … + 6.

    Answer: 21

  4. 4.What does this print? x = 9 y = 3 print(x * y + 1)

    Show the answer

    Think: // is whole-number division, % is the remainder.

    Work: Run it line by line.

    Answer: 28

  5. 5.What does this print? total = 0 for i in range(1, 9): total += i print(total)

    Show the answer

    Think: Add each i.

    Work: 1 + 2 + … + 8.

    Answer: 36

  6. 6.What does this print? x = 6 y = 2 print(x * y + 1)

    Show the answer

    Think: // is whole-number division, % is the remainder.

    Work: Run it line by line.

    Answer: 13

  7. 7.What does this print? total = 0 for i in range(1, 4): total += i print(total)

    Show the answer

    Think: Add each i.

    Work: 1 + 2 + … + 3.

    Answer: 6

  8. 8.What does this print? x = 8 x = x + 3 print(x)

    Show the answer

    Think: // is whole-number division, % is the remainder.

    Work: Run it line by line.

    Answer: 11

  9. 9.What does this print? total = 0 for i in range(1, 8): total += i print(total)

    Show the answer

    Think: Add each i.

    Work: 1 + 2 + … + 7.

    Answer: 28

  10. 10.What does this print? x = 9 x = x + 3 print(x)

    Show the answer

    Think: // is whole-number division, % is the remainder.

    Work: Run it line by line.

    Answer: 12

Before you check an answer

  • // is whole-number division, % is the remainder.

Questions students ask

What does Python programming in Class 11 Computer Science cover?
Flow of control and loops. These are the multi-step questions examiners like to set. Read each one twice, write down what you know, then plan before you calculate. These go beyond the syllabus. Each one has a neat idea that makes it short; brute force is slow.
How should I practise Python programming?
Read each question twice and say the answer out loud before you check it. For code or binary questions, work it out on paper step by step, the way a computer would. Try all ten questions on this page, then open the chapter in Gradient tuition for step-by-step lessons, a live experiment and an AI tutor who explains where you went wrong.
Is this for CBSE or ICSE?
The questions follow the Class 11 Computer Science syllabus shared by CBSE and ICSE / ISC, and suit most state boards too.

Stuck on one of these?

Gradient tuition teaches Python programming step by step, with experiments you can play with and an AI tutor who circles the part of the question you missed.

Open Python programming in tuition
Computer systemsStrings, lists and dictionaries