click below
click below
Normal Size Small Size show me how
DAVJ277 2.1.2
J277 GCSE CS 2.1.2 DESIGNING, CREATING AND REFINING ALGORITHMS
Question | Answer |
---|---|
Why do we use structure diagrams? | We use structure diagrams to help us decompose a problem. |
Refine this code: print(1) print(2) print(3) print(4) print(5) | for i =1 to 5: print(i) next i |
What would the outputs be from this algorithm? total=0 for i = 1 to 9 step 2 total=total+i print (total) print(i) | 1 1 3 4 5 9 7 16 9 25 |
What would the outputs be from this algorithm for i = 1 to 9 step 2: if iMOD3 ==0: print(“Fizz”) else: print(“Buzz”) | Buzz Fizz Buzz Buzz Fizz |
Why do we use structure diagrams? | To help us decompose a problem. Smaller problems are easier to solve. |