Programing Flashcards
how do you define a subroutine
def function1():
define a local varibable
A variables that is declared inside the function
define a global variable
variable that can be accessed and changed throughout the whole program, including subroutines
which varible is a global varibale:
SUBROUTINE add(a, b)
value ← a + b
RETURN value
ENDSUBROUTINE
new_value ← add(3, 5)
OUTPUT new_value
new_variable
which varibles are globle:
SUBROUTINE add(a, b)
value ← a + b
RETURN value
ENDSUBROUTINE
new_value ← add(3, 5)
OUTPUT new_value
a
b
local
what is decomposition
Breaking the problem down into smaller sub-problems, so that each sub-problem accomplishes an identifiable task, which might itself be further subdivided.
what is pattern recognition
Finding repeating patterns that could be solved quickly
what is abstraction
Removing unnecessary detail from a problem
how is data represented in boolean logic
on or off
what is a variable
a named memory address that holds a value
what is a constant
A constant is a location in memory which stores a value that does NOT change.
what is iteration
a loop that repeats certain steps
what is selection
a section of code is run only if a condition is met
what is IF, ELIF and ELSE and example of
selection and iteration
when shoud you use ELIF
if the first statement isnt true and you want to test for a second condition
What is the symbol for real division
//
What does “//” do
finds the integer of a divison
e.g 100//3 = 33
What is an integer
data types
A whole number
What is a real
data types
A fraction/ decimal number
What is Boolean
Data types
Only stores True or False