1/39
Vocabulary flashcards covering key terms and example functions from zyBooks Chapter 6 on user-defined functions: basics, parameters, return values, modular development, arrays, and common lab exercises.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Function
A named list of statements that can be invoked (called) from elsewhere in a program.
Function definition
The code that introduces a new function, starting with the keyword Function, the function’s name, parameters (if any), and ending with its statements.
Function call
An invocation of a function’s name followed by parentheses that causes the function’s statements to execute.
Main function
The entry point of a program; execution always begins with Main().
Local variable
A variable declared inside a function and accessible only within that function.
Parameter
An input listed in a function definition that receives a value when the function is called.
Argument
A value or expression supplied to a function’s parameter during a call.
Return variable
A variable in a function that holds the single value the function will return.
Return statement
A statement (often the keyword return in many languages) that explicitly sends a value back to the caller and exits the function.
Void / returns nothing
Indicates that a function does not return a value.
Position-based parameter matching
Arguments are assigned to parameters based on their left-to-right order in the call.
Expression context
The ability to use a function call inside an expression because it evaluates to its returned value.
Function with no parameters
A function whose parentheses are empty; it is still called with ().
Function with multiple parameters
A function that lists two or more parameters, each receiving a corresponding argument.
Mathematical function
User-defined function created to perform a numeric calculation and return a numeric result (e.g., CircleArea).
Branch inside a function
Use of if-else statements within a function’s body.
Loop inside a function
Use of while or for loops within a function’s body.
Functions calling functions
When the statements of one user-defined function invoke another function.
Modular development
Dividing a program into separate, independently testable functions or modules.
Incremental development
Writing and testing small portions of code repeatedly to build a program step-by-step.
Function stub
A temporary, incomplete function definition used during early development to allow compilation and testing.
Readability benefit
Using functions keeps Main() short and makes program logic easier to understand.
Avoiding redundancy
Writing a computation once in a function and reusing it through calls instead of duplicating code.
Guideline: ≤ 20 statements
Typical recommendation for the maximum size of a beginner’s function to maintain clarity.
Array parameter
A parameter declared with the word array, allowing an entire array to be passed to a function.
numList.size
Property used inside a Coral function to obtain the length of an array parameter.
CountValsOverThreshold
Example function that returns how many elements in an array exceed a given threshold.
CircleArea example
Demonstrates computing area from diameter inside a function and reusing it multiple times.
PizzaCalories example
Shows one function (PizzaCalories) calling another (CircleArea) to calculate total calories.
AbsoluteValue
Typical helper function used to illustrate code reuse and avoidance of repetitive statements.
RaiseToPower
Built-in function example showing that functions can be nested inside expressions.
SeedRandomNumbers(2)
Call that seeds Coral’s random number generator for reproducible results (e.g., in PrintCoinFlips).
MilesToLaps
Example function converting miles walked to track laps (1 lap = 0.25 miles).
MaxMagnitude
User-defined function that returns the value with the greatest magnitude among two integers.
DrivingCost
Function that computes fuel cost from miles driven, miles per gallon, and dollars per gallon.
StepsToMiles
Function that converts pedometer steps to miles (2,000 steps = 1 mile).
SecondsToJiffies
Function that converts seconds to jiffies, where 1 jiffy = 0.01 seconds.
OutputLeapYear
Function that prints whether a given year satisfies leap-year rules (divisible by 4, and by 400 if century).
IntegerToBinary
Function that outputs the binary representation of a positive integer in reverse order.
getMinimumInt
Function returning the smallest element in an integer array, used for normalizing data.