Programming Techniques (OCR A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
13 cards from this deck
ShowHide
Practise the cards
13 cards from this deck
What are the 3 fundamental programming constructs?
What are the 3 fundamental programming constructs?
Sequence, iteration, and branching
What is sequence?
What is sequence?
Instructions executed one after another in order
What is iteration?
What is iteration?
Repeating instructions until a condition is met
While loop characteristic
While loop characteristic
Repeats as long as a condition is true
For loop characteristic
For loop characteristic
Repeats a specific number of times
Repeat-until loop characteristic
Repeat-until loop characteristic
Executes at least once, repeats until condition met
What is branching?
What is branching?
Allows program to make decisions based on conditions
IF statement function
IF statement function
Executes code block if condition is true
IF-ELSE statement function
IF-ELSE statement function
Provides alternative action if condition is false
IF-ELSEIF-ELSE ladder function
IF-ELSEIF-ELSE ladder function
Allows checking multiple conditions
CASE/SWITCH statement function
CASE/SWITCH statement function
Matches a value to predefined cases
What causes infinite loops?
What causes infinite loops?
Failing to update conditions in loops
Benefit of iteration
Benefit of iteration
Automates repetitive tasks, reducing redundancy
