Lesson 4.1.1.11

4.1.1.11 Parameters and returning values Quiz: AQA Computer Science, Unit 1

20 questions

In partnership with Revision Ninja

Lesson 4.1.1.11, Parameters and returning values: 20 multiple choice questions for the AQA Computer Science (7517), Unit 1: Fundamentals of 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 the term for a value passed into a subroutine when it is called?

    • Global variable
    • Return value
    • Local variable
    • Parameter
  2. What component of a subroutine defines its parameters and return type?

    • Interface
    • Recursion base
    • Body
    • Stack frame
  3. A function is defined as calculateArea(width, height) and returns width times height. What are width and height?

    • Constants
    • Parameters
    • Global variables only
    • Return addresses
  4. Where can a value returned by a function be directly used?

    • In a header
    • In a comment
    • In a declaration
    • In an expression
  5. A function called getMax takes two integers and returns the larger. It is called with getMax(7, 12). What is returned?

    • 19
    • 12
    • 7
    • 5
  6. A subroutine is called with the arguments (3, 4) and it adds them and returns the result. What is the returned value?

    • 12
    • 34
    • 7
    • 1
  7. What term describes the actual value passed into a subroutine during a call?

    • Identifier
    • Argument
    • Parameter
    • Local variable
  8. What key programming benefit does using parameters in subroutines provide?

    • Automatic debugging
    • Faster execution
    • Code reusability
    • Reduced stack size
  9. What happens to a subroutine call if its returned value is not assigned?

    • Runtime crash
    • Compilation error
    • Subroutine skipped
    • Subroutine still runs
  10. A procedure has three parameters. How many values must the caller supply if all three are needed?

    • 3
    • 1
    • 0
    • 2
  11. What is a key advantage of passing parameters into subroutines rather than using global variables?

    • Automatic iteration
    • Improved modularity
    • Reduced memory
    • Faster execution
  12. A function returns the average of three values passed in as parameters. Which expression returns the correct average for 4, 6 and 8?

    • (4 + 6 + 8) DIV 2
    • 4 + 6 + 8 / 3
    • (4 * 6 * 8) / 3
    • (4 + 6 + 8) / 3
  13. What type of error occurs when passing a string argument to a float parameter?

    • Syntax error
    • Logic error
    • Stack overflow
    • Type mismatch
  14. What does defining a subroutine interface establish prior to implementation?

    • Inputs and outputs
    • Execution speed
    • Memory address
    • Variable lifetimes
  15. A function returns the square of a parameter. What is returned when the function is called with 5?

    • 5
    • 15
    • 25
    • 10
  16. A function returns the number of characters in a string passed as a parameter. The string "CPU" is passed. What is returned?

    • 0
    • 2
    • 4
    • 3
  17. What error occurs if an invalid array index parameter is passed into a subroutine?

    • Out of bounds
    • Type mismatch
    • Syntax error
    • Stack overflow
  18. How many parameters and return values are needed for a function calculating petrol cost?

    • One parameter, two returns
    • Two parameters, one return
    • Zero parameters, zero returns
    • Two parameters, two returns
  19. A function is called as average(10, 20). If the function returns the mean of its two parameters, what is returned?

    • 15
    • 20
    • 10
    • 30
  20. A subroutine takes a parameter and returns the parameter multiplied by 10. The caller passes 4 and stores the result. What is stored?

    • 14
    • 4
    • 400
    • 40

All AQA Computer Science quizzes