Algorithms & Errors
Pseudocode Basics
Input, Output & Operators
Conditions & Tracing
Writing Algorithms
100

What is an algorithm?

A step-by-step set of instructions to solve a problem.

100

Give a correct pseudocode input statement.

INPUT age

100

What arithmetic operator is used in: 

total = cost * number ?

Multiplication operator (*)

100

What two conditions are checked in:
INPUT

number IF number >= 1 AND number <= 10 THEN

OUTPUT “Valid”

ELSE 

OUTPUT “Invalid”

ENDIF  

number ≥ 1 and number ≤ 10.

100

Write pseudocode to compare two colors.

IF color1 == color2 THEN
 OUTPUT "The colors match"
ELSE
 OUTPUT "The colors do not match"
ENDIF

200

Why are algorithms important?

They ensure tasks can be carried out accurately and computers follow clear steps.

200

Name two rules of pseudocode.

Use simple English-like statements; 

use ALL CAPS for keywords.

200

Write a correct output using the variable score.

OUTPUT "Your total score is:", score

200

If the input is 0 for that algorithm, what is the output?

Invalid

200

Write pseudocode to check which number is larger.

IF num1 > num2 THEN OUTPUT num1
ELSEIF num2 > num1 THEN OUTPUT num2
ELSE OUTPUT "The numbers are the same"

300

What is a logic error?

A mistake where the algorithm runs but produces the wrong result.

300

What keyword must end decision blocks in pseudocode?

ENDIF

300

In the expression:
result = value1 + value2 * 2
What is calculated first?

value2 * 2, because multiplication has higher precedence.

300

Trace this algorithm with inputs (5, 1, 10). 

INPUT first INPUT second INPUT third IF first < second AND first < third THEN result ← second * third ELSEIF second < third THEN result ← first * third ELSE result ← first * second ENDIF OUTPUT result

What is the final output?

50

300

Write pseudocode to determine the largest of three numbers.

The “largest of 3” algorithm from the guide.

400

Give one example of a logic error.

Using + instead of *

wrong condition

or incorrect output wording.

400

Rewrite this Python statement in pseudocode:
print("Hello", name)

OUTPUT "Hello", name

400

What is the logic error in this pseudocode?

INPUT nights 

INPUT type

IF type == "elite" THEN

cost ← 100 * nights 

ELSE

cost ← 50 + nights

ENDIF 

OUTPUT cost


It should be 50 * nights, not 50 + nights.

400

In the tracing example, why is the second condition true?

Because 1 < 10.

400

What correction is needed if a pseudocode IF statement is missing THEN?

Add THEN after the condition.

500

Why is testing algorithms with sample inputs important?

It helps find logic errors

tests different values

checks edge cases

and confirms correct outputs.

500

What is the correction for this pseudocode error?


IF number > 100 AND number < 200 OUTPUT "Correct"


Add THEN and proper indentation.

500

What does the algorithm total = cost * number calculate?

The total cost by multiplying cost × number.

500

In the algorithm comparing numbers and colors, what is output if both numbers are the same?

"The numbers are the same"

500

For the 3-number largest algorithm, what is output if c is the largest?

OUTPUT "The largest number is ", c