MAKE IT YOURS

A world for every learner

Choose a grade to discover its colours and creative world.

Grade 8 Functions & Return Values Worksheet with Answers

Grade 8 (US) · Year 9 (UK) · Class 8 (India) · Computer Science

Unit 6: Going FurtherAdvanced: Functions PreviewAdvanced

Tracing functions with parameters and return values, including functions that call other functions. This free middle school worksheet has 12 questions and a full answer key. Print it or save it as a PDF — every answer is checked by code, not guessed.

  • Answer keys checked by code
  • No ads, ever
  • No student accounts needed
  • Safety & privacy
Practice Sheetaethelsystems.com

Functions & Return Values

Grade 8 · Computer Science

Score___ / 12

Name

Class

Date

Learning goal: Advanced: Functions Preview

Directions: Read each question carefully and write your answer on the line. Use the diagram to help you.

RememberFunctions

Callf(3)Parameterx = 3Run body2 * x + 1Returnsends back 7
  1. 1

    What does this program print?

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

    What does this program print?

    1def f(x):2return 4 * x + 434print(f(f(2)))
  3. 3

    What does this program print?

    1def f(x):2return 4 * x + 534print(f(f(1)))
  4. 4

    What does this program print?

    1def f(x):2return 2 * x + 234print(f(f(3)))
  5. 5

    What does this program print?

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

    What does this program print?

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

    What does this program print?

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

    What does this program print?

    1def f(x):2return 4 * x + 134print(f(f(3)))
  9. 9

    What does this program print?

    1def f(x):2return 3 * x + 334print(f(f(4)))
  10. 10

    What does this program print?

    1def f(x):2return 3 * x + 334print(f(f(6)))
  11. 11

    What does this program print?

    1def f(x):2return 4 * x + 234print(f(f(3)))
  12. 12

    What does this program print?

    1def f(x):2return 2 * x + 534print(f(f(6)))

★ Challenge corner for fast finishers

A robot on a grid can only move forward 1 square, or turn. What is the fewest forward moves to go 4 squares east and 3 squares north?

How did I do?

Teacher's comments

Free printable worksheets with answer keys · aethelsystems.com/worksheets/computer/8/functions_returns

Answer key (click to show)
  1. 1.25
  2. 2.52
  3. 3.41
  4. 4.18
  5. 5.21
  6. 6.14
  7. 7.52
  8. 8.53
  9. 9.48
  10. 10.66
  11. 11.58
  12. 12.39
  13. ★7 (challenge corner)

Need another Functions & Return Values worksheet?

Generate unlimited fresh versions at easy, medium or hard difficulty, each with its own answer key. Free during our launch — no card needed.

Create a free account

How to use this worksheet

  • Works well as a bell-ringer, exit ticket, homework set or quick quiz.
  • Have students self-check with the answer key, then correct their own mistakes before you review.
  • Generate a new version of the same topic for a re-test, so students can't just memorise the answers.

Can't find what you need? Tell us which worksheet to make next.

Frequently asked questions

Does this Grade 8 Functions & Return Values worksheet come with answers?

Yes. The full answer key is on this page, and it prints on its own page after the questions. Every answer is calculated or checked by code rather than written by an AI model, so the key is always correct.

How do I print it or save it as a PDF?

Click "Download PDF" to save a ready-to-print PDF with the answer key on the last page, or click "Print" to send the worksheet and answer key straight to your printer.

Can I get a different Functions & Return Values worksheet?

Yes. Create a free account to generate as many fresh Grade 8 Functions & Return Values worksheets as you like, at easy, medium or hard difficulty, each with its own answer key.

Is this worksheet free?

Yes. This worksheet is free to print, and Practice Sheet is free to use during our launch with no card needed.