Which term describes reusable steps that return a value?

Prepare for the IGCSE Algorithms and Pseudocode Exam. Study with comprehensive questions covering key algorithms and pseudocode techniques. Access hints and explanations to gear up for your exam success!

Multiple Choice

Which term describes reusable steps that return a value?

Explanation:
Reusable blocks of code that return a value are called functions. A function encapsulates a task, can be used from different parts of a program, and produces a result you can use in expressions orAssign to a variable. It may take inputs (parameters) to influence its result and then returns a value when it finishes. For example, a function that computes the square of a number takes the input and returns the computed result. Parameters are just the inputs given to a function, not the reusable block itself. Global variables are storage locations accessible from anywhere in the program, not blocks of code that perform a task. Library routines are prewritten code that can include functions or procedures; the exact concept described here—reusable steps that return a value—best matches the idea of a function.

Reusable blocks of code that return a value are called functions. A function encapsulates a task, can be used from different parts of a program, and produces a result you can use in expressions orAssign to a variable. It may take inputs (parameters) to influence its result and then returns a value when it finishes. For example, a function that computes the square of a number takes the input and returns the computed result.

Parameters are just the inputs given to a function, not the reusable block itself. Global variables are storage locations accessible from anywhere in the program, not blocks of code that perform a task. Library routines are prewritten code that can include functions or procedures; the exact concept described here—reusable steps that return a value—best matches the idea of a function.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy