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 10 › Computer Science

Functions: practice questions

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

  • def, parameters and return.
  • def area(l, b): return l * b packs a job into a name. Call it as often as you like: area(3, 4).
  • Parameters carry values in; return sends one value back. A function without return gives None.
  • Functions often decide: def grade(m): return "Pass" if m >= 33 else "Fail".
  • 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.def f(x): return 6 * x + 5 print(f(6))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 41

  2. 2.def f(x): return 9 * x + 6 print(f(7))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 69

  3. 3.def f(x): return 6 * x + 1 print(f(8))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 49

  4. 4.def f(x): return 5 * x + 1 print(f(6))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 31

  5. 5.def f(x): return 6 * x + 8 print(f(1))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 14

  6. 6.def f(x): return 8 * x + 1 print(f(8))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 65

  7. 7.def f(x): return 6 * x + 4 print(f(8))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 52

  8. 8.def f(x): return 2 * x + 2 print(f(3))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 8

  9. 9.def f(x): return 7 * x + 2 print(f(9))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 65

  10. 10.def f(x): return 8 * x + 7 print(f(9))

    Show the answer

    Think: What does return give back?

    Work: Put the argument in for x.

    Answer: 79

Before you check an answer

  • What does return give back?

Questions students ask

What does Functions in Class 10 Computer Science cover?
def, parameters and return. def area(l, b): return l * b packs a job into a name. Call it as often as you like: area(3, 4). Parameters carry values in; return sends one value back. A function without return gives None.
How should I practise Functions?
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 10 Computer Science syllabus shared by CBSE and ICSE / ISC, and suit most state boards too.

Stuck on one of these?

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

Open Functions in tuition
Lists and stringsData and spreadsheets