2.2 programming fundamentals part 2 Flashcards
How do you make a loop?
For i =0 to 5:
The number are an example and will be printed out 5 times
What would the output be for the OR gate? 0 0 0 1 1 0 1 1
0 1 1 1 1
What would the output be for the AND gate? 0 0 0 1 1 0 1 1
0
0
0
1
What would the output be for the NOT gate?
0
1
It does the opposite
1
0
What are procedures?
Procedures carry out a set of instructions and stored under one name
What does procedures don’t require?
Parameter
What is a function?
Functions take a parameter and return a value (ALWAYS RETURN A VALUE)
What is a parameter?
Are variables used to pass values into the subprogram. They specify the name, datatype and value.
What are arguments?
Are the actual values that the parameters take when the sub program is called.
Why are functions and procedures useful?
They give the program more structure and readability and reduce the amount of code that is needed to write.
What is a Global variable?
Used in entire program
What is a local variable?
Can only be used in the structure they’re declared in