Programming Techniques Flashcards
What is selection?
A section of code that will only run if a certain condition is met
What is sequence?
A set of instructions, followed one after the other
What is iteration?
A repeating process (usually set by a for loop)
What is branching?
Another word for selection
What is the scope of a variable?
Whether it is a local or global variable
What is a local variable?
A variable declared within a subroutine that is destroyed at the end of it
What is a global variable?
A variable declared outside a subroutine that can be accessed at any point during it
What are the negatives of using global variables?
- Can be unintentionally overwritten
- Takes up more memory than local variables
- Can cause potential naming conflicts
What is modularity in programming?
Breaking a large program down into smaller chunks
What are the 2 different types of subroutine?
- Procedure
- Function
What is a procedure?
A module of code that can take parameters but cannot return a value
What is a function?
A module of code that can take parameters and returns a value
What are the 2 methods of passing data into a subroutine?
- Passing by reference
- Passing by value