Describe the 4 stage or problem solving in Computer Science.
Decomposition, it is when you break a problem down into smaller tasks so it is easier to solve
Abstraction, it is when you ignore the unnecessary information and focus only on the important facts
Pattern recognition, it is the process of identifying similar pattern within a problem
Algorithm, it is the final stage as step by step rules are created to solve the problem.
3 idea/construct of programming
Sequence, it is structuring code into a logical, sequential order.
Selection, it is the decision making using if statement
Iteration, repeating code, often using for loops or while loops
What is local variable
variables are declared within a specific subroutine and can only be used within that subroutine.
What is global variable
variables can be used at any point within the whole program.
Advantage of local variable
Local variable advantages
Saves memory - only uses memory when that local variable is needed - global variables use memory whether they are used or not.
Easier to debug local variables as they can only be changed within one subroutine.
You can reuse subroutines with local variables in other programs.
Advantage of local and global variable
Local variable advantages
Saves memory - only uses memory when that local variable is needed - global variables use memory whether they are used or not.
Easier to debug local variables as they can only be changed within
Global variable advantages
Variables can be used anywhere in the whole program (and in multiple subroutines).
Makes maintenance easier as they are only declared once.
Can be used for constants value that remain the same
What is a constant
A constant is data that does not change in value as the program is run - it is fixed and remains the same.
What is counts and rogue value
A count is a variable that is used to record the current iteration (loop number).
A rogue value is an unexpected value that will cause the loop to end.
What is self-documenting identifier
It is an efficient program will use variables with sensible names that immediately state their purpose in the program.