Pseudocode Flashcards
What is pseudocode?
Pseudocode is is a way of showing an algorithm using text, and without being specific to a particular coding language. This means that pseudocode can be created in many different versions.
What would be an example of pseudocode for making a cup of tea?
START 1) Fetch a cup and teabag. 2) Fill kettle with hot water. 3)Turn kettle on. 4)Put teabag in cup. 5)Wait for water to boil. 6)Pour water into cup. 7)Stir teabag. 8)Take out teabag. 9)Pour milk and sugar in cup (optional) 10)Serve tea. END
Give the advantages of pseudocode.
Pseudocode is quick to write out and can easily be converted into any other coding language. Also, there is not one exact correct way to write pseudocode, as long as it makes sense to the person reading it. Also, this means that people with no experience of coding can understand and use the code.
What would be the pseudocode for a company changing an employee’s password to a random 6 number password?
START 1)Take employee's current password 2)Change the letter into a number 3)Repeat this for every letter 4)Display the new 6-number password. END
Name 5 pseudocode keywords and describe what they do.
PRINT- This displays something to the screen
INPUT- This is a way that a user can type a piece of data.
OUTPUT- This shows that something will appear on the screen.
WHILE- A loop that keeps going while a condition is true.
FOR- A loop that repeats the code inside them a number of times.
REPEAT- A loop that keeps going until the condition is true.
IF- A loop that allows you to check if a condition is true.
ELSE- Part of a loop that tells the program what to do if the loop is false.
What are the disadvantages of pseudocode?
The disadvantages are that pseudocode doesn’t have the same structure as a flowchart, so it doesn’t have the full logic of the code. For someone who is inexperienced, it is difficult to understand the logic compared to a flowchart.