Fun computer science · Classes 6 to 10

Coding basics: variables, decisions and lists

Programs are just careful instructions. Read a few lines the way the computer does, guess what it prints, then run it and see.

1. Variables are named boxes

Each line changes what is in the boxes. Predict the final x, then set the numbers and run the program.

2. Making a decision

A program can choose. Set the pass mark and the student’s marks, and see which branch runs.

Common trap: = stores a value, == compares two values. And marks >= 40 is true when marks are exactly 40; marks > 40 is not.

3. Lists and indexes

A list keeps many values in a row. The first item is at index 0, not 1.

Remember in one minute

Practice now: 3 levels, worked answers, progress tracker →

This is a practice aid made by BodhiScore, not a textbook or an official board resource. Your school’s textbook decides the exact syllabus and the way answers are written. Nothing on this page is saved or sent anywhere. This is a practice aid, not a substitute for your school textbook. These are standard computing facts; where a value depends on a convention the question says which one is used.

Share