1.2.4 types of programming language Flashcards
this deck only contains part (SLR08) of 1.2.4 as theres more stuff on paper. reference screenshots on phone for photos of example code etc (7th june 2024)
1
Q
what is a computer program
A
- series of statements (instructions) that are executed one after another
2
Q
all but the most trivial (insignificant) of programs tend to do what 3 things
A
- accept input
- process data
- produce output
3
Q
what are the 3 programming constructs (used in procedural languages)
A
- sequence
- selection
- iteration
4
Q
what is sequencing
A
- executing instructions one after another
5
Q
what is selection
A
- allows a program to branch and follow a different direction depending on outcome of a certain condition
6
Q
what is iteration
A
- repeating / looping sections of code
7
Q
how do you create an infinite loop
A
WHILE True
8
Q
what is a FOR loop (type and what does it mean)
A
- count-controlled loop
- used when required number of iterations is known ahead of execution
9
Q
what is a WHILE loop (type and what does it mean)
A
- condition-controlled loop
- used when required number of iterations isn’t known because the variable used to determine when the iteration ends is changing within the iteration itself
10
Q
what is a DO… UNTIL loop
A
- alternative to WHILE where the code executes at least once before condition is checked
11
Q
what is the difference between WHILE loop and DO…UNTIL loop
A
- WHILE loop, condition checked at start (if condition met, we may never execute the following lines of code in WHILE loop)
- DO… UNTIL loop always executes code once before checking exit condition at end
12
Q
what do programming constructs do
A
- control flow of program
13
Q
What is program flow?
A
The path that a program follows as it runs from start to finish.
14
Q
what is nesting
A
- process of putting one statement inside another
- this can be achieved through both iteration and selection statements
15
Q
What is a variable?
A
- pointer to a memory location that holds a value. It is defined by a name/label.
CAN BE CHANGED WHILE THE PROGRAM IS RUNNING.