Questions: Program Structure and Control Flow

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Consider this pseudocode: x = 5 / IF x > 3: print('A') / print('B'). What gets printed when this runs?

AOnly 'A' — the if-statement skips 'B' once its condition is satisfied
BOnly 'B' — branching replaces the default sequence
CBoth 'A' then 'B' — the branch executes its block, then execution continues sequentially
DNothing — conditional statements don't produce output without an else clause
Question 2 Multiple Choice

A loop is set up to print 'Hello' while a counter is less than 3, starting at 0 and incrementing by 1 each time. How many times does 'Hello' print?

A2 — the loop runs for values 0 and 1, and stops before reaching 3
B3 — the loop runs for values 0, 1, and 2
C4 — the loop runs for values 0, 1, 2, and 3 before the condition fails
D1 — the loop body only executes once per control flow structure
Question 3 True / False

If a statement appears earlier in the source code file, it will generally execute before a statement that appears later in the file.

TTrue
FFalse
Question 4 True / False

A program with no conditional statements and no loops will always produce the same output when run with the same input.

TTrue
FFalse
Question 5 Short Answer

Why is the written order of statements in source code not always the order in which they execute?

Think about your answer, then reveal below.