Pearson Edexcel 1CP2 GCSE Computer Science · Topic 1: Computational Thinking
Stretch tasks Algorithms, Flowcharts and Pseudocode
Quiz Challenge
A quiz game against four computer players, then short and long written answers.
- Quiz Blitz12 questions against the clock
- Quick Fire4 short answers
- Big Think2 long answers
About 20 minutes
This or That
Pixel the cat asks 8 questions. Each has two answers: pick the right one.
- Two answers to every question
- A fish treat for every right answer
- Streaks win Pixel shades, then a party hat
About 4 minutes
Memory Match
Flip the cards two at a time to match each term card to its meaning card.
- 12 cards: each term has a meaning
- One peek at every card
- Combo points for pairs found in a row
6 pairs, about 4 minutes
Sort It
Sort each statement into the right box, like the tick-box tables in the exam.
- 12 cards to sort into 4 boxes
- Drag a card, tap a box or press its number
- Combo points for cards sorted in a row
12 cards, about 4 minutes
The games need JavaScript. Every question is below, with the answers at the end.
Read the lesson: Algorithms, Flowcharts and Pseudocode
Algorithms, Flowcharts and Pseudocode: the questions
Quiz Challenge, round 1: Quiz Blitz
Which flowchart symbol holds a decision?
- A rounded rectangle
- A rectangle
- A diamond
- A parallelogram
Which flowchart symbol is used for input and output?
- A circle
- A parallelogram
- A diamond
- A rectangle
What is sent to the display?
SET total TO 0 SET count TO 1 WHILE count <= 4 DO SET total TO total + count SET count TO count + 1 END WHILE SEND total TO DISPLAYHow does Edexcel pseudocode assign 5 to x?
- LET x BE 5
- SET x TO 5
- x = 5
- x <- 5
A REPEAT ... UNTIL loop always runs at least once.
- True
- False
A WHILE loop always runs at least once.
- True
- False
What does this send to the display?
SET name TO 'Priya' SEND 'Hello ' & name TO DISPLAY- Hello Priya
- Hello & name
- 'Hello ' & Priya
- name
What does a function do that a procedure does not?
- Runs code
- Returns a value
- Takes parameters
- Has a name
In Edexcel pseudocode, what does <> mean?
- Not equal to
- Less than
- Joins two strings
- Assignment
Which TWO belong in a trace table?
Tick 2.
- The program's file name
- A flowchart
- A column for each variable
- A new row every time a value changes
- Only the final answer
What is sent to the display?
SET scores TO [12, 7, 19, 3] SEND scores[1] TO DISPLAYWhy must a total be initialised before a loop, not inside it?
- Loops cannot contain SET
- It runs faster
- Edexcel forbids it
- Inside, it would reset on every pass
Quiz Challenge, round 2: Quick Fire
Explain the difference between an algorithm and a program. [2 marks]
Explain the difference between a WHILE loop and a REPEAT ... UNTIL loop. [2 marks]
This algorithm should keep asking until the password is correct, but it loops forever after one wrong guess. Explain why, and how to fix it. [2 marks]
RECEIVE password FROM (STRING) KEYBOARD WHILE password <> 'letmein' DO SEND 'Wrong' TO DISPLAY END WHILE SEND 'Access granted' TO DISPLAYDescribe how to complete a trace table so that it earns marks even if you make a slip. [2 marks]
Quiz Challenge, round 3: Big Think
Write an algorithm, in pseudocode, that asks the user for 10 numbers and then displays their total and how many of them were negative. [6 marks]
A student's flowchart for a password check has a decision diamond containing 'add one to attempts', an unlabelled branch, and a loop arrow that rejoins below the input. Explain each error and how to correct it. [6 marks]
This or That: tick the right answer
Which shape is used for START and STOP?
- A diamond
- A rounded rectangle
Which loop can run zero times?
- WHILE
- REPEAT ... UNTIL
Which loop walks through every element without handling an index?
- WHILE
- FOREACH
Edexcel or OCR: SEND total TO DISPLAY?
- Edexcel
- OCR
Which returns a value with RETURN?
- A procedure
- A function
Where must a loop arrow rejoin, so the user is asked again?
- Above the input
- Below the input
scores is [12, 7, 19, 3]. What is scores[3]?
- 3
- 19
In a trace table, overwrite old values or add a new row?
- Add a new row
- Overwrite them
Memory Match: match each term to its meaning
| Term | Meaning |
|---|---|
| A Algorithm | 1 A subprogram that returns a value |
| B Trace table | 2 Precise steps that always finish |
| C Decision symbol | 3 Rounded rectangle for START and STOP |
| D Terminal symbol | 4 Records each variable after every step |
| E Function | 5 A subprogram that returns nothing |
| F Procedure | 6 A diamond holding a condition |
Sort It: tick one box in each row
Which flowchart symbol would each step use?
| Statement | Terminal | Process | Input or output | Decision |
|---|---|---|---|---|
| STOP | ||||
| START | ||||
| Read the password | ||||
| Enter the user's age | ||||
| Display 'Access granted' | ||||
| Set count to 0 | ||||
| Print the total | ||||
| Add one to attempts | ||||
age >= 18? | ||||
total = total + price | ||||
| Is the password correct? | ||||
count > 10? |
Answers
Round 1: Quiz Blitz
- A diamond A diamond holds a condition with two labelled outputs.
- A parallelogram Reading data in and sending data out both use a parallelogram.
- 10 1 + 2 + 3 + 4 = 10.
- SET x TO 5 Assignment is SET ... TO.
- True It tests its condition after the body.
- False It tests first, so it can run zero times.
- Hello Priya & joins values together.
- Returns a value A function uses RETURN. A procedure does a job and returns nothing.
- Not equal to = compares for equality and <> for not equal.
- A column for each variable; A new row every time a value changes The history of values is the working, and the working earns marks.
- 7 Indices start at 0, so scores[1] is the second element.
- Inside, it would reset on every pass A total set to 0 inside the loop loses everything added so far.
Round 2: Quick Fire
- An algorithm is a sequence of steps, in any form
- A program is an algorithm written in a programming language so a computer can run it
Model answerAn algorithm is a precise sequence of steps that solves a problem, which can be written as a flowchart or pseudocode. A program is an algorithm written in a particular programming language, such as Python, so that a computer can run it.
- WHILE tests its condition before the body, so it may run zero times
- REPEAT ... UNTIL tests after the body, so it always runs at least once
Model answerA WHILE loop tests its condition before the body, so it can run zero times. A REPEAT ... UNTIL loop tests its condition after the body, so it always runs at least once.
- The password is only read once, so the condition never changes
- Add a RECEIVE inside the loop
Model answerThe password is only read once, before the loop, so inside the loop it never changes and the condition stays true forever. A RECEIVE password FROM (STRING) KEYBOARD line must be added inside the loop, so the user is asked again on every pass.
- One column for each variable, and for output
- A new row every time a value changes, never overwriting
- Work one line at a time, using the current values
Model answerDraw one column for each variable and one for output, and write the starting values in the first row. Work through the algorithm one line at a time, adding a new row every time a value changes rather than overwriting it, so the working shows even if one value is wrong.
Round 3: Big Think
- A loop that runs 10 times
- RECEIVE a number inside the loop
- Set the total to 0 before the loop
- Add each number to the total
- Test whether the number is below 0
- Add 1 to a count of negatives
- Send the total to the display after the loop
- Send the count of negatives to the display
Model answerPSEUDOCODESET total TO 0 SET negatives TO 0 FOR index FROM 1 TO 10 DO RECEIVE number FROM (INTEGER) KEYBOARD SET total TO total + number IF number < 0 THEN SET negatives TO negatives + 1 END IF END FOR SEND total TO DISPLAY SEND negatives TO DISPLAY- A diamond must hold a condition, not a statement
- Such as attempts < 3
- The statement belongs in a process rectangle
- Both branches must be labelled Yes and No
- Otherwise nobody can tell which way the algorithm goes
- The loop arrow must rejoin above the input
- Otherwise the same wrong password is tested forever
- So the user is asked again each time
Model answerA decision diamond must contain a condition with two possible answers, such as attempts < 3, not a statement. The statement 'add one to attempts' belongs in a process rectangle. Both branches out of the diamond must be labelled Yes and No, otherwise nobody can tell which way the algorithm goes. The loop arrow must rejoin above the input, so the user is asked again each time. Rejoining below the input means the same wrong password is tested forever.
This or That
- A rounded rectangle The terminal symbol is a rounded rectangle, one at each end.
- WHILE WHILE tests first. REPEAT tests after the body, so it always runs once.
- FOREACH FOREACH visits each element of a data structure in turn.
- Edexcel OCR writes print(total). Edexcel writes SEND ... TO DISPLAY.
- A function A procedure does a job but returns nothing.
- Above the input Rejoining below the input tests the same value forever.
- 3 Indices start at 0, so scores[3] is the fourth element.
- Add a new row The history is the working, and the working earns the marks.
Memory Match
- A 2 Algorithm: Precise steps that always finish
- B 4 Trace table: Records each variable after every step
- C 6 Decision symbol: A diamond holding a condition
- D 3 Terminal symbol: Rounded rectangle for START and STOP
- E 1 Function: A subprogram that returns a value
- F 5 Procedure: A subprogram that returns nothing
Sort It
- Terminal STOP STOP sits in a rounded rectangle too.
- Terminal START START sits in a rounded rectangle.
- Input or output Read the password Reading data in uses a parallelogram.
- Input or output Enter the user's age Input uses a parallelogram.
- Input or output Display 'Access granted' Sending data out uses a parallelogram.
- Process Set count to 0 An assignment is a process.
- Input or output Print the total Output uses a parallelogram.
- Process Add one to attempts A statement belongs in a process box, never a diamond.
- Decision
age >= 18? A comparison is a decision. - Process
total = total + priceA calculation is a process rectangle. - Decision Is the password correct? A yes or no question is a decision.
- Decision
count > 10? A condition with two answers goes in a diamond.