Comp Sci Ch 7 Ch 8 Flashcards
What is a function?
grouping of statements for repeatedly used operations
- a named list of statements
function definition vs call
definition - function’s type, name, parameters and block of statements
call- name and arguments
what is a return statement?
and what is void
can return only one
void function does not return
what is a parameter? and how does it look
a function input specified in a function definition
type and name
what is an argument?
a value provided to a functions parameter during a call
what are multiple parameters separated by
comma
order in which program should run when declaring functions
declare before main and then call in main (this one better)
OR
declare header (but instead of {, have ;) before main then call in main and then define after main
what is modular development?
dividing program into separate modules that can be developed and tested separately and then integrated into one single program
what is incremental development?
a process of writing, compiling and testing a small amount of code
what is a function stub?
a function definition that statements have not been written
-write the header, braces, and return 0
-because just want it to complie
what is unit testing?
process of individually testing a small part or unit of a program
what is a test bench?
test harness
a separate program whose purpose is to check that a function returns
what is a test vector?
each unique set of input values
how would you use a test vector?
cout what you are testing, what you expect and what you got by calling function with literals to test
what predefined function can you use to test a function what does it do and what do you have to include
include <cassert></cassert>
assert( functionName(literal arguments) == what you should get)
- it exits program if input expression is false and tell you the line and expression
what is the one function you will never call
main