Topic 1 - Computational Thinking Flashcards
What does decomposition mean?
Breaking down into smaller parts.
What does abstraction mean?
The process of removing or hiding unnecessary details so that you can focus solely on the important points.
What’s an algorithm for?
It provides the precise instructions needed to solve a problem
What’s an algorithm?
A step-by-step procedure for solving a problem or carrying out a task.
What is a subprogram?
A self-contained block of code that performs a specific task within a larger program.
What subprograms are commonly used in high-level programming languages?
- print()
- len()
- random.randint()
- math.floor()
What does abstraction allow?
Allows a programmer to specify what a subprogram must do without worrying about how it will work.
What are the uses of subprograms (6)?
- breaking down a complex problem
- make program logic clearer
- make it easier to maintain code
- enable code to be used as many times as needed within a program
- enable code used for common tasks to be stored in libraries and reused in other programs
- working together on a project
How can algorithms be displayed before being translated into program code?
As flowcharts.
How is a terminal presented in a flowchart?
An oval.
How is a decision/ selection presented in a flowchart?
A diamond.
How is a process presented in a flowchart?
A rectangle.
How is an input/ output presented in a flowchart?
A parallelogram.
How is subprogram presented in a flowchart?
A rectangle with margins on both sides.
What does a terminal do in a flowchart?
It shows the start and end of an algorithm.
What does a decision/ selection do in a flowchart?
Shows yes/no or true/false decisions where there are two possible outcomes.
What does a process do in a flowchart?
Shows data processing, e.g. a calculation.
What does an input/output do in a flowchart?
Shows when data is input into or output by the algorithm.
What does a subprogram do in a flowchart?
Shows a function or procedure that has its own flowchart.
What does a line do in a flowchart?
Shows that flow of the program.
What are the four programming constructs?
- sequence
- selection
- repetition
- iteration
What are programming constructs for?
To control the flow of a program.
What is selection used for?
To choose between two or more options.
How can selection be presented in python?
- if
- elif
- else
What is repetition?
The process of repeating a set of instructions until there is a desired outcome.
What is condition-controlled repetition?
When the number of times a loop is executed is not known before the loop is started.
What is count-controlled repetition?
When the number of times a loop is executed is known before the loop is started.
How is repetition represented in python?
while
for… in range()