Skip to main content

Back to the full dot-point answer

SingaporeComputer ScienceQuick questions

Programming and Software Development

Quick questions on Python control flow and functions explained: H2 Computing

7short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is selection?
Show answer
Selection chooses between branches with if, elif and else. Conditions are tested top to bottom; the first true branch runs and the rest are skipped:
What is iteration?
Show answer
Iteration repeats statements. A for loop iterates a known sequence; a while loop repeats while a condition holds:
What is scope?
Show answer
Scope is where a name is visible:
What is an infinite while loop?
Show answer
A while condition that the body never changes loops forever; ensure each iteration moves toward making it false.
What is q1?
Show answer
State the difference between a for loop and a while loop. [2 marks]
What is q2?
Show answer
What does a function return if it has no return statement? [1 mark]
What is q3?
Show answer
Why does referencing another function's local variable cause an error? [2 marks]

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages