{"base":{"id":"cs9-10","subject":"Algorithms","title":"Sequence, selection and iteration together","scene":"code9","steps":[{"mode":"combo","eyebrow":"A quiz program","title":"All three at once","body":"This quiz asks 3 questions in a loop, checks each answer with IF, and keeps a score. Choose which answers are right, then run it.","actions":[{"id":"q1","label":"Toggle answer 1"},{"id":"q2","label":"Toggle answer 2"},{"id":"q3","label":"Toggle answer 3"},{"id":"run","label":"Run"}]},{"mode":"constructs","eyebrow":"Name the parts","title":"Sequence, selection, iteration","body":"Highlight each construct in the quiz program: steps in order (sequence), choices (selection) and repetition (iteration).","actions":[{"id":"k0","label":"Sequence"},{"id":"k1","label":"Selection"},{"id":"k2","label":"Iteration"}]},{"mode":"grade","eyebrow":"Another example","title":"Count the passes","body":"This program reads three marks and counts how many are 50 or more. The IF is inside the loop, so it runs once per mark. Change the marks.","controls":[{"id":"a","label":"Mark 1","min":0,"max":100,"step":5,"value":65},{"id":"b","label":"Mark 2","min":0,"max":100,"step":5,"value":40},{"id":"c","label":"Mark 3","min":0,"max":100,"step":5,"value":50}],"actions":[{"id":"step","label":"Step"},{"id":"run","label":"Run"},{"id":"reset","label":"Reset"}]},{"mode":"quiz","eyebrow":"Check yourself","title":"Inside the loop","body":"An IF statement is inside a FOR loop that runs 5 times.","question":"How many times is the IF condition checked?","options":["1","It depends on the answer","5"],"answer":2,"right":"Correct. It is checked once on every pass of the loop.","wrong":"Not quite. Everything inside the loop repeats.","look":"grade"}],"more":[{"type":"cards","id":"ideas","eyebrow":"Popular idea vs science","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"\"A program uses only one construct.\"","body":"Most useful programs combine sequence, selection and iteration."},{"tag":"Popular idea","title":"\"An IF inside a loop runs once.\"","body":"It runs on every pass."},{"tag":"Popular idea","title":"\"Indentation doesn't matter in pseudocode.\"","body":"Indentation shows which lines are inside the loop or IF."}]},{"type":"cards","id":"code","eyebrow":"Pseudocode","title":"Combining constructs","items":[{"tag":"Quiz","title":"Loop + IF","body":"score ← 0\nFOR q ← 1 TO 3\n    INPUT answer\n    IF answer = correct[q] THEN\n        score ← score + 1\n    ENDIF\nNEXT q\nOUTPUT score","code":true}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Times-table tester","items":[{"title":"Plan a quiz","time":"20 minutes","need":["Paper"],"steps":["Plan a program that asks 5 times-table questions.","Mark which lines are sequence, selection and iteration.","Add feedback: 'Well done' for 5/5, otherwise 'Keep practising'.","Trace it with a partner giving answers."],"why":"Planning shows how the three constructs fit together before any coding.","safety":"No safety risks."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Six more questions","questions":[{"question":"Which construct repeats steps?","options":["Iteration","Selection","Sequence"],"answer":0,"right":"Correct. Loops are iteration.","wrong":"Not quite. Repeat = ?"},{"question":"Which construct chooses between paths?","options":["Iteration","Sequence","Selection"],"answer":2,"right":"Correct. IF statements.","wrong":"Not quite. Choose = ?"},{"question":"Lines that run one after another in order are…","options":["selection","sequence","iteration"],"answer":1,"right":"Correct. Order matters.","wrong":"Not quite. One after another."},{"question":"Marks 70, 30, 55 into the pass counter (≥ 50). Output?","options":["2","1","3"],"answer":0,"right":"Correct. 70 and 55 pass.","wrong":"Not quite. Check each mark."},{"question":"Where should score ← 0 go?","options":["Inside the loop","After the loop","Before the loop"],"answer":2,"right":"Correct. Otherwise it resets every pass.","wrong":"Not quite. When should it start at 0?"},{"question":"What shows which lines are inside a loop in pseudocode?","options":["Capital letters","Indentation","Line numbers"],"answer":1,"right":"Correct. Indented lines are inside.","wrong":"Not quite. How are they laid out?"}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can explain…","items":["what sequence, selection and iteration are","how to combine them in one program","why an IF inside a loop runs on every pass","where to initialise a counter"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"sequence","meaning":"Steps run in order."},{"word":"selection","meaning":"Choosing steps with IF."},{"word":"iteration","meaning":"Repeating steps with a loop."},{"word":"construct","meaning":"A basic building block of programs."},{"word":"initialise","meaning":"Give a variable its starting value."}]},{"type":"sources","id":"sources","title":"Sources","items":["BBC Bitesize KS3 Computer Science","Raspberry Pi Foundation, Computing curriculum resources"]}]},"overlay":null}