Programming Construct
Selection & IF/ELSE
Loop & Iteration
Pseudocode
Debugging & trace tables
100

What is Sequence?

Steps carried out one after another.

100

Which flowchart shape represents a decision?

A diamond.

100

What is a count-controlled loop?

A loop that repeats a fixed/set number of times.

100

Which pseudocode command is used to receive data from the user?

INPUT

100

What is a logic error?

An error where the program runs but produces the wrong result.

200

What is Selection?

Making a choice using IF/ELSE.

200

What does the comparison operator >= mean?

Greater than or equal to.

200

How many times does this loop repeat?


FOR count = 1 TO 5


5 times.

200

Which pseudocode command displays a result?

OUTPUT

200

What is a trace table used for?

To track the values of variables as a program runs.

300

What is Iteration?

Repeating one or more steps using a loop.

300

Complete this pseudocode:


IF mark >= 50 ___   OUTPUT "Pass" ENDIF


THEN

300

What keyword is used to move to the next repetition of a FOR loop?

NEXT

300

Write pseudocode that outputs "Pass" if a score is 40 or more, otherwise outputs "Fail".

INPUT score IF score >= 40 THEN   OUTPUT "Pass" ELSE   OUTPUT "Fail" ENDIF

300

If a = 6 and b = 9, which number is larger?

9

400

Name the three basic programming constructs.

Sequence, Selection and Iteration.

400

In an IF/ELSE statement, what happens when the IF condition is FALSE?

The ELSE branch is executed.

400

Where should the IF/ELSE statement be placed when processing 3 test scores?

Inside the loop, so each score is checked.

400

Write pseudocode using a count-controlled loop to input 3 test scores.

FOR count = 1 TO 3   INPUT score NEXT count

400

This program should output the larger number. What is the logic error?


IF a < b THEN   OUTPUT a ELSE   OUTPUT b ENDIF


The condition is wrong. It should be:


IF a > b THEN


500

What is a condition in programming?

A statement that is evaluated as TRUE or FALSE.

500

Is mark > 50 TRUE or FALSE when mark = 50?

FALSE, because 50 is not greater than 50.

500

What is the final value of total?


SET total = 0 FOR count = 1 TO 5   SET total = total + count NEXT count


15

500

Write pseudocode that inputs two numbers and outputs the larger number.


INPUT a INPUT b IF a > b THEN   OUTPUT a ELSE   OUTPUT b ENDIF

500

Trace the program and give the final output:


SET total = 0 FOR count = 1 TO 5   SET total = total + count NEXT count OUTPUT total


15

M
e
n
u