Functions Flashcards
What is a function in programming?
A module that groups statements to perform a task and can return a value.
How can a returned value from a function be used?
Like any other value in the program.
What are library functions?
Built-in functions provided by a programming language.
What three things must be known to use a library function?
Its purpose, required arguments, and returned data type.
What does defining a function create?
A module that can be reused.
What does a function header specify?
Return type, function name, and parameter variables.
What does the function body contain?
Statements executed when called, including a return statement.
What is the purpose of a return statement?
To send a value back to the caller.
How does a flowchart represent a function?
It starts with a terminal symbol and includes the function name and parameters.
What can the return statement return besides a single value?
An expression.
What is an IPO chart?
A tool to organize function inputs, processing steps, and outputs.
What does “IPO” stand for in an IPO chart?
Input, Processing, Output.
What is the purpose of an IPO chart in function design?
What is the purpose of an IPO chart in function design?
What is a function parameter?
A variable listed in the function header that receives input.
How do functions improve code structure?
By modularizing tasks, reducing redundancy, and enhancing readability.