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.
The 20 questions
-
What is the term for a value passed into a subroutine when it is called?
- Global variable
- Return value
- Local variable
- Parameter
-
What component of a subroutine defines its parameters and return type?
- Interface
- Recursion base
- Body
- Stack frame
-
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
-
Where can a value returned by a function be directly used?
- In a header
- In a comment
- In a declaration
- In an expression
-
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
-
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
-
What term describes the actual value passed into a subroutine during a call?
- Identifier
- Argument
- Parameter
- Local variable
-
What key programming benefit does using parameters in subroutines provide?
- Automatic debugging
- Faster execution
- Code reusability
- Reduced stack size
-
What happens to a subroutine call if its returned value is not assigned?
- Runtime crash
- Compilation error
- Subroutine skipped
- Subroutine still runs
-
A procedure has three parameters. How many values must the caller supply if all three are needed?
- 3
- 1
- 0
- 2
-
What is a key advantage of passing parameters into subroutines rather than using global variables?
- Automatic iteration
- Improved modularity
- Reduced memory
- Faster execution
-
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
-
What type of error occurs when passing a string argument to a float parameter?
- Syntax error
- Logic error
- Stack overflow
- Type mismatch
-
What does defining a subroutine interface establish prior to implementation?
- Inputs and outputs
- Execution speed
- Memory address
- Variable lifetimes
-
A function returns the square of a parameter. What is returned when the function is called with 5?
- 5
- 15
- 25
- 10
-
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
-
What error occurs if an invalid array index parameter is passed into a subroutine?
- Out of bounds
- Type mismatch
- Syntax error
- Stack overflow
-
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
-
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
-
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
Related quizzes
- Data types Quiz · 4.1.1.1 · 20 questions
- Programming concepts: sequence, selection and iteration Quiz · 4.1.1.2 · 20 questions
- Arithmetic operations Quiz · 4.1.1.3 · 20 questions
- Relational and Boolean operations Quiz · 4.1.1.4 · 20 questions
- Constants and variables Quiz · 4.1.1.6 · 20 questions
- String-handling operations Quiz · 4.1.1.7 · 20 questions
- Random numbers and exception handling Quiz · 4.1.1.8 · 20 questions
- Subroutines Quiz · 4.1.1.10 · 20 questions
- Local and global variables Quiz · 4.1.1.13 · 20 questions
- Stack frames in subroutine calls Quiz · 4.1.1.15 · 20 questions