Lesson T2.3.1

T2.3.1 Procedures and functions Quiz: KS3 Computing, Unit 2

20 questions

In partnership with Revision Ninja

Lesson T2.3.1, Procedures and functions: 20 multiple choice questions for the KS3 Computing (National Curriculum), Unit 2: Programming, written with Revision Ninja.

Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.

Host this setFree Play

The 20 questions

  1. What is a procedure?

    • A single number that is stored for later use inside the program
    • A list that stores a set of items in order, each with its own index
    • A named block of code that carries out a task and can be called when needed
    • A loop that repeats until the computer is turned off by the user
  2. What does a function return?

    • A picture that is shown on the screen
    • A complete copy of the whole program
    • An error message in every case
    • A value back to the code that called it
  3. Python defines the function def double(n): return n * 2. What does double(5) give?

    • 25
    • 10
    • 7
    • 5
  4. What is a parameter?

    • A name given to a program when it is saved to the computer's disk
    • A loop that stops after a set number of steps has been completed
    • A value passed into a procedure or function when it is called
    • The colour used to draw a button on screen when the program starts
  5. Why are procedures useful?

    • They make the program longer and harder to read for other programmers
    • They stop the program from ever needing any input from the user
    • They replace the need for variables by storing values in the code itself
    • They let the same code be reused without copying it many times
  6. What is the difference between a procedure and a function?

    • A function returns a value, while a procedure carries out a task
    • There is no difference between the two
    • A function can only be used on numbers
    • A procedure returns a value, while a function never does
  7. A function called area takes width and height and returns width times height. What does area(3, 4) return?

    • 12
    • 1
    • 34
    • 7
  8. Which is a good name for a procedure that draws a square?

    • x1
    • draw_square
    • thing2
    • stuff
  9. What happens when a procedure is called?

    • The program stops running immediately
    • The procedure is deleted from memory
    • The instructions inside it are carried out
    • The procedure changes into a number
  10. A function is given the list [2, 4, 6] and returns the total of its items. What is returned?

    • 6
    • 3
    • 12
    • 24
  11. Why should a function have a clear single purpose?

    • So that it always returns the same number
    • So it is easier to test, understand and reuse
    • So that the program uses no variables
    • So that it can never be called by other code
  12. A procedure is called three times. How many times are its instructions carried out?

    • Once only, no matter how often it is called
    • Ten times, because each call repeats it
    • Zero times, because it is only defined
    • Three times
  13. What is the result of a function that has no return statement in Python?

    • It always gives back the number zero
    • It causes the program to stop with an error
    • It gives back the value None
    • It gives back the whole program code
  14. A function is defined as def add(a, b): return a + b. What is add(2, 9)?

    • 2
    • 7
    • 29
    • 11
  15. Why might a programmer give a function a parameter instead of using a fixed value inside it?

    • So the function can never be changed later
    • So the same function can work with different values
    • So the function runs without any input
    • So the function becomes a list of numbers
  16. What is the purpose of a function's name?

    • To identify the function so that it can be called
    • To set the speed at which it runs on the processor
    • To store the value it returns in memory for later use
    • To decide the colour of its output on screen
  17. Which statement best describes a procedure in a game?

    • The name of the game shown on the title screen when it first loads
    • A reusable block such as play_sound that can be called from many places
    • A list of all the players who have joined the game so far this week
    • A single number that counts the player's score as the game is played
  18. A function calculates the average of a list. Which value does it return?

    • The number of items in the list only
    • The first item in the list
    • A copy of the list with no changes
    • The average of the list items
  19. Why are functions and procedures described as building blocks of a program?

    • They are the only parts of a program that the computer can run
    • They make the program smaller by removing all instructions
    • They can be combined to build larger programs from smaller parts
    • They replace the need for any data in a program
  20. A procedure prints 'Well done' when it is called. What is printed after it is called twice?

    • Well done, printed five times
    • Well done, printed twice
    • Well done, printed once
    • Nothing is printed at all

All KS3 Computing quizzes