Control Structures in Programming

Computer Science
Year 9
11 questions
~22 mins
0 views0 downloads

About This Worksheet

This worksheet explores the use of control structures such as if statements, loops, and logic gates in programming. Complete the tasks to strengthen your understanding.

Worksheet Preview

Full preview • 11 questions

Control Structures in Programming

Subject: Computer ScienceGrade: Year 9
Name:
Date:
TeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizz

Untitled Worksheet

Grade Year 9
A

Questions

This worksheet explores the use of control structures such as if statements, loops, and logic gates in programming. Complete the tasks to strengthen your understanding.

Answer all questions in the spaces provided.
1.
Write a simple pseudo-code using an if statement that checks if a number stored in variable 'score' is greater than 50. If it is, display 'Pass'.
[3 marks]
2.
Describe a scenario where a 'while' loop could be used in a program. Write a brief pseudo-code example that counts from 1 to 10 using a while loop.
[4 marks]
3.
Complete the truth table for an AND logic gate with two inputs A and B. Fill in the output column based on the inputs.
[4 marks]
ABOutput
00
01
10
11
4.
Draw a logic circuit diagram for an OR gate with two inputs. Label the inputs and output clearly. Use standard logic gate symbols.
[6 marks]
Drawing / Sketch space
5.
Explain the difference between 'if' and 'elif' (or 'else if') statements in programming. Provide a short pseudo-code example demonstrating their use.
[4 marks]
6.
Describe a situation where a 'for' loop would be appropriate in a program. Write pseudo-code that prints all numbers from 1 to 5 using a 'for' loop.
[4 marks]
7.
Complete the truth table for a NAND gate with two inputs A and B. Fill in the output column.
[4 marks]
ABOutput
00
01
10
11
8.
Draw a flowchart that represents a program which asks the user for their age and then displays whether they are an adult (18 or over) or a minor (under 18). Use standard flowchart symbols and label each step.
[8 marks]
Drawing / Sketch space
9.
Write pseudo-code for a program that uses a 'do-while' loop to keep asking a user to enter a password until they enter the correct one ('letmein').
[5 marks]
10.
Explain how short-circuit evaluation works in logical expressions involving AND and OR operators. Provide an example where evaluation stops early.
[4 marks]
11.
Sketch a truth table for a XOR (exclusive OR) gate with two inputs. Label the inputs and output clearly.
[6 marks]
Drawing / Sketch space

Quick Actions

What is Remix?

Create a new worksheet based on this one. Change the grade level, topic, number of questions, or difficulty - then generate a fresh version.

  • • Change grade level (Grade 6 → Grade 7)
  • • Swap topics (Harry Potter → Macbeth)
  • • Add more questions (10 → 15)
  • • Adjust difficulty

Details

Created
1/2/2026
Updated
1/2/2026
Type
worksheet