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 tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Practice › Class 9 › Computer Science

Python basics: practice questions

Class 9 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

  • Variables, operators and conditions.
  • 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? x = 2 x = x + 8 print(x)

    Show the answer

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

    Work: Run it line by line.

    Answer: 10

  2. 2.print(43 // 2)

    Show the answer

    Think: Python operators.

    Work: Floor division drops the remainder.

    Answer: 21

  3. 3.What does this print? print(20 // 5)

    Show the answer

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

    Work: Run it line by line.

    Answer: 4

  4. 4.print(20 // 9)

    Show the answer

    Think: Python operators.

    Work: Floor division drops the remainder.

    Answer: 2

  5. 5.What does this print? print(25 % 8)

    Show the answer

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

    Work: Run it line by line.

    Answer: 1

  6. 6.print(3 ** 2)

    Show the answer

    Think: Python operators.

    Work: Power.

    Answer: 9

  7. 7.What does this print? print(48 // 8)

    Show the answer

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

    Work: Run it line by line.

    Answer: 6

  8. 8.print(29 // 9)

    Show the answer

    Think: Python operators.

    Work: Floor division drops the remainder.

    Answer: 3

  9. 9.What does this print? print(28 % 3)

    Show the answer

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

    Work: Run it line by line.

    Answer: 1

  10. 10.print(49 % 9)

    Show the answer

    Think: Python operators.

    Work: The remainder.

    Answer: 4

Before you check an answer

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

Questions students ask

What does Python basics in Class 9 Computer Science cover?
Variables, operators and conditions. 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 basics?
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 9 Computer Science syllabus shared by CBSE and ICSE / ISC, and suit most state boards too.

Stuck on one of these?

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

Open Python basics in tuition
Loops