Pseudocode & Flowcharts Flashcards
Card 1 of 19
All 19 cards in this deck
Which flowchart symbol is a rounded rectangle (oval), and what is it used for?
The terminal symbol — the Start or Stop of the algorithm.
Which flowchart symbol is a plain rectangle, and what is it used for?
The process symbol — a calculation or an assignment to a variable.
Which flowchart symbol is a diamond, and what is it used for?
The decision symbol — a condition with two labelled exits (Yes/No or True/False).
Which flowchart symbol is a parallelogram, and what is it used for?
The input/output symbol — data entered into or sent out of the algorithm.
Which flowchart symbol is a rectangle with two extra vertical lines at its sides?
The sub program symbol — a call to a separate sub program.
What do the lines with arrowheads in a flowchart show?
The flow of control — the order and direction in which the symbols are followed.
What are the steps to work out the output of a flowchart for a given input?
e.g. input 5 to a flowchart that doubles a number then adds 1
- Start at the Start terminal and follow the arrows: number = 5
- Carry out each symbol's instruction, taking the branch that matches at a decision: , then
- Record whatever reaches an output symbol: output 11
What are the steps to complete a missing decision in a partially drawn flowchart?
e.g. an empty diamond whose Yes branch outputs "Pass"; the pass mark is 50
- Look at what each branch out of the symbol does: Yes gives "Pass"
- Work out the condition that must be true to take the Yes branch: score >= 50
- Write it inside the diamond, labelling both exits Yes and No
What are the steps to draw a flowchart for a described algorithm?
e.g. input a number and output "Big" if it is over 100
- Begin with a Start terminal and a parallelogram for each input: input number
- Add rectangles for processes and diamonds for decisions with Yes/No exits: number > 100?
- Add output symbols and a Stop terminal, joining everything with arrows: output "Big"
Which operator joins (concatenates) two strings in OCR Exam Reference Language?
+, e.g."Hello" + "Everyone"gives"HelloEveryone".True or false? In pseudocode you can write
word1 == "Hello"to store the string "Hello" inword1.False. Assignment uses a single
=;==is a comparison, not an assignment.What is nested selection?
e.g. only checking the password once the username is correct
An if statement placed inside another if statement, so the inner condition is tested only when the outer one is true.
What is nested iteration?
e.g. a loop of 4 stars inside a loop of 3 rows
A loop placed inside another loop; the inner loop runs fully on every pass of the outer loop (here, 12 stars).
Give one way to refine an algorithm to make it more efficient.
Replace repeated lines of code with a loop (iteration).
e.g. one loop running five times instead of five separate input lines.Name three ways an algorithm can be written.
Pseudocode, a flowchart, and Exam Reference Language or a high-level programming language.
What is pseudocode?
A way of writing out an algorithm in structured, code-like statements without following the rules of any particular programming language.
Give two features of well-written pseudocode.
Any two of: easy to read and follow; precise rather than vague; laid out like real code (e.g. indented); easy to turn into any programming language.
On a flowchart, how does a sequence differ from selection?
A sequence follows a single path from Start to Stop with no decisions; selection has a decision diamond that splits the flow into different routes.
How does iteration appear on a flowchart?
An arrow leads back to an earlier point, usually from a decision, so a group of steps is repeated.