Page 72 - CG_v2.1_flipBooks_class_6
P. 72
Pseudocode
Pseudocode is a term which is often used in programming and algorithm-based fields. It is a
methodology that allows a programmer to represent the implementation of an algorithm.
In computer science, a pseudocode is used to describe the steps followed in an algorithm via simple
human comprehensible language.
Thus, it has no syntax of any programming language and can be easily understood.
Features of Pseudocode
l Its uses structured English statements.
l It can be reviewed or verified easily to see if it generates the desired outcome.
l Writing pseudocode will help to write the main code easily.
l All possible scenarios can be focused at single time.
Main Constructs of Peudocode
The pseudocode mainly uses words—‘SEQUENCE’, ‘WHILE’, ‘REPEAT’, and ‘IF–THEN–ELSE’. These
constructs are also called keywords and are used to describe the control flow of the algorithm.
1. SEQUENCE
It represents linear tasks, that are sequentially performed one after the other.
Example: washing clothes.
2. REPEAT UNTIL
It repeats an action until a specified condition is met.
Example: mixing salad.
3. REPEAT
It is used to repeat the task for a fixed number of times.
Example: Cooking food.
4. IF-Then-Else
It is a conditional statement that can change the flow of an algorithm.
Example: If the weather is cold, turn the fan off. Else, turn it on.
Guidelines for Writing a Pseudocode
l Always capitalise the initial word.
l Keep the statements independent of any programming language.
l Write only one statement per line.
l Always move in an ordered way.
l Keep it simple, concise and readable.
Example: Write pseudocode to print 'Above average marks' if the average marks in the three subjects
are greater than 60 and 'Below average marks' if the average marks are less than or equal to 60.
70 Computer Genius (V2.1)-VI

