Programming techniques Flashcards
What is a sequence?
A series of statements that are executed one afte ranother
What is Selection?
Where a decesion is made based on the state of a boolan expression
What is iteration?
Iteratin mean repition. It is used to make a section of code repeat itself
for i in range(0,3):
print(i)
What is recursion?
This is where a procedure or function calls itself. It is another way of producing iteration. recursion will call a stack overflow error if a terminating condition is not built in. def recuse (number): print(number) recurse(number)
What is a global variable?
Can be seen throughout a program. They are declared or set outside any function or subprograms
Global variables can be dangerous .it is easy to overlook when they are changed
What is a local variable?
Local variables are set or declared inside a function or other subprogram, they can only be accessed from within that subprogram
What are functions?
A subroutine retrun a value
What are procedures
Perform some opeartios but do not return a value
What is passing by reference?
Parameters can be passed by reference. this means that the address of the variable is passed to the subprogram
Features of IDE?
BREAKPOINT- this will cause the program to stop on the line so that you can see where it reaches that line
WATCH-set a watch on a variable so that its value is displayed each time it changes
STEP THROUGH-you can step through a program line at a time so that you can see what is happening
What is passing by value?
If a parameter is passed by value, its actual value is passed to the subroutine, where it is treated as a local variable. changing a parameter inside the subroutine will not affect its value outside the subroutine