DoAssignment study guide

B1.1 · Use basic programming terms correctly

Learn to use basic programming terms correctly through clear examples and targeted practice.

Ontario Grade 10 Computer Science

Introduction to Programming

Ontario Grade 10 Computer Studies — ICS2O B1.1

Programming terms help people explain what a program does and how its instructions work. Imagine a program that greets a visitor: the visitor's name is input, the program uses that name to prepare a greeting, and the greeting is output. This lesson introduces basic terms through small examples. Python 3 is used to make the examples concrete; classroom languages can differ in spelling and symbols. The code is shown as text and is not being run.

What you will learn

  • Use basic programming terms accurately when describing a short program.
  • Recognize input, processing, and output in a familiar scenario.
  • Distinguish a variable, a value, an instruction, and a condition.
  • Describe sequence, selection, and repetition in plain language.

1. Input, processing, and output

A program follows instructions to work with information. Input is information given to a program. For example, when a person types a name, that text is input.
Processing is work the program does with information. It might compare a response with a word or combine a greeting with a name. Output is information the program provides, such as a message displayed on screen.
In a greeting program, the visitor types a name, the program prepares a greeting using that name, and then the program displays the greeting. These three roles are often described as input, process, and output. This description explains the program's job without making a claim about a particular device.
  • Input is information provided to a program.
  • Processing is work the program performs on information.
  • Output is information the program provides.

2. Instructions, variables, and values

A program is made of instructions, also called statements. A statement tells the computer to do something, such as receive input or display a message. When instructions are carried out in order, one after another, that order is called sequence.
A variable is a named place in a program where a value can be kept. In the greeting example, `visitor` is a variable. If a person types `Mina`, then `Mina` is the value stored in `visitor` for that run. The variable name and its value are different things.
An assignment instruction gives a variable a value. In Python, the equals sign in an assignment sets the variable's value; it does not ask whether two things are equal. Text written inside quotation marks in code is called a string. When the program receives typed text, it can use that text as a value.
A fixed piece of information written directly into an instruction, such as the words `Hello, `, is a value used by the program. Use the term variable for a named place that can hold a value, and value for the information held or used.
  • A statement is an instruction in a program.
  • A variable is a named place for a value.
  • Sequence means instructions are carried out in order.
  • An assignment gives a variable a value.

3. Decisions and repetition

A condition is a test that can be judged true or false. For example, a program can check whether a response is exactly the word `yes`. Selection means choosing an action based on a condition. In Python, an `if` instruction can express selection.
A program can also repeat an instruction or group of instructions. This is called repetition, or a loop. A program that asks for a response three times repeats its input instruction three times. The loop in this example has a clear end.
Sequence carries out instructions in order, selection chooses an action based on a condition, and repetition carries out instructions again. These terms describe ways a program carries out its instructions.
  • A condition can be true or false.
  • Selection chooses an action based on a condition.
  • Repetition carries out an instruction or group of instructions again.

4. Reading and describing a program

When explaining a program, name what its parts do. For example: “The program gets a name as input, stores it in the variable `visitor`, uses that value to prepare a greeting, and displays the greeting as output.” This is more precise than saying only that the program “uses a name.”
A comment is a note for people reading code. In Python, a comment begins with `#`; it is not an instruction that performs the program's task. Debugging means finding and correcting a problem in a program. A bug is a problem that makes a program behave differently from what was intended.
You can trace a short program by hand: follow each instruction in order and note the values that matter. The examples below give expected results based on reading the code, not on running it. When practising, explain the input, processing, and output in your own words.
  • Describe a program by naming its input, processing, and output.
  • A comment is a note for people reading code.
  • Debugging means finding and correcting a program problem.

Hand trace for the greeting example

StageInformation or action
Prompt shownName:
InputMina
Variable valuevisitor holds Mina
ProcessingCombine Hello, with Mina
Final result messageHello, Mina

Worked example

A greeting from a name

A program asks a visitor for a name and displays a greeting. If the person enters Mina, identify the input, variable, processing, and final result message.

Python 3

visitor = input("Name: ")
message = "Hello, " + visitor
print(message)
  1. Identify the input
    The visitor types Mina. That typed text is input. The instruction also displays the prompt `Name: ` while waiting for the response.
  2. Follow the instructions
    The program stores the entered text in the variable `visitor`. It then combines the greeting text with the value in `visitor` and displays the result.
  3. State the final result message
    For the assumed input Mina, the final result message is `Hello, Mina`. This is the result after the prompt and response, not the complete visible interaction. This is a hand trace from the code, not a claim that the code was run.
Answer: Input: Mina. Variable: `visitor`, whose value is Mina. Processing: combine the greeting text with the variable's value. Final result message: `Hello, Mina`. The program also displays the prompt `Name: ` before receiving the input.
Check: The variable name `visitor` is not the input itself; it is the named place that holds the input value.

Worked example

Choosing a message with a condition

A program asks whether a visitor wants a reminder. If the response is exactly `yes`, it displays `Reminder on`; otherwise it displays `Reminder off`. Trace the program for `yes` and `no`, and check what happens for `Yes` with a capital letter.

Python 3

reply = input("Reminder? ")
if reply == "yes":
    print("Reminder on")
else:
    print("Reminder off")
  1. Name the condition
    The condition checks whether the value in `reply` is exactly `yes`. The condition is true for the lowercase response `yes` and false for `no`.
  2. Follow the selected action
    Selection means choosing the action that matches the condition. For `yes`, the program displays `Reminder on`. For `no`, it displays `Reminder off`. The input instruction also displays the prompt `Reminder? ` before receiving a response.
  3. Check the exact match
    The condition asks for an exact match. The response `Yes` has a capital first letter, so it does not match lowercase `yes`; the program chooses the `else` action.
Answer: For input `yes`, the final result message is `Reminder on`. For input `no`, it is `Reminder off`. For input `Yes`, it is `Reminder off`. Each time, the program displays the prompt `Reminder? ` before receiving the response.
Check: This is selection, not repetition: a single response determines which of the two messages is displayed.

Worked example

Repeating a prompt a set number of times

A program asks for a short response three times and then displays `Finished`. Identify the repeated instruction and the final result message.

Python 3

for attempt in range(1, 4):
    response = input("Enter a response: ")
print("Finished")
  1. Find the repeated instruction
    The `for` instruction repeats the indented input instruction three times. The variable `attempt` takes the values 1, 2, and 3 in turn.
  2. Trace the prompts and inputs
    The prompt `Enter a response: ` is displayed once during each repetition. For a hand trace, suppose the person enters `A`, then `B`, then `C`. These are three inputs, not final result messages.
  3. Identify the final result message
    After the loop ends, the next instruction displays `Finished`. It is the final result message, not the complete visible interaction: the three prompts and responses appear before it. This expected result comes from reading the code, not from running it.
Answer: The input instruction is repeated three times, and the prompt `Enter a response: ` appears each time. Assuming the responses A, B, and C, the final result message is `Finished`, displayed after the three prompts and responses.
Check: `Finished` is output because the program displays it. The repeated input instruction is also accompanied by a displayed prompt each time.

Common mistakes and how to avoid them

Calling a variable the same thing as its value.
Correction: A variable is a named place, such as `visitor`; its value might be `Mina`.
Calling every instruction input or output.
Correction: Input is information provided to a program, output is information the program provides, and processing is work done with information.
Saying an `if` instruction repeats an action.
Correction: An `if` instruction supports selection by choosing an action based on a condition. Repetition means carrying out an instruction or group of instructions again.
Treating a prompt displayed by `input` as if it were the user's response.
Correction: The prompt is text displayed by the program; the typed response is input. State both when describing the visible interaction.
Treating a comment as an instruction that produces the program's result.
Correction: A comment is a note for people reading code; it does not perform the program's task.

Lesson summary

  • Input is information given to a program; processing is work performed; output is information the program provides.
  • A statement is an instruction. A variable is a named place for a value.
  • Sequence means instructions are carried out in order; selection chooses an action; repetition carries out instructions again.
  • A condition can be true or false. Comments help people read code, and debugging means finding and correcting a problem.
  • When a program displays a prompt, distinguish that prompt from the user's input and from the program's final result message.

Check your understanding

Question 1

In the greeting example, what is `visitor`?
  1. The variable that holds the entered name
  2. The displayed output
  3. The instruction to ask for a name
  4. The condition that chooses a message
Show answer and explanation
The variable that holds the entered name
`visitor` is the variable. The entered name is its value, and the greeting is the final result message.

Question 2

A program checks whether a response is `yes` and chooses one of two messages. Which term best describes this choice?
  1. Selection
  2. Repetition
  3. Input
  4. Comment
Show answer and explanation
Selection
Selection chooses an action based on a condition.

Question 3

A loop asks for a response three times. What does repetition describe?
  1. The input instruction being carried out again
  2. The value entered the first time
  3. The final message only
  4. A note written for the programmer
Show answer and explanation
The input instruction being carried out again
Repetition means an instruction or group of instructions is carried out again.

Question 4

In the reminder example, what happens for the response `Yes` with a capital Y?
  1. The `else` action is chosen because the condition checks for exactly `yes`
  2. The `yes` action is chosen because the words look similar
  3. Both messages are displayed
  4. The condition repeats until the response changes
Show answer and explanation
The `else` action is chosen because the condition checks for exactly `yes`
The condition checks for an exact match with lowercase `yes`; `Yes` does not match, so the `else` action is selected.

Key terms

Input
Information provided to a program.
Processing
Work a program performs on information.
Output
Information a program provides.
Statement
An instruction in a program.
Variable
A named place in a program where a value can be kept.
Value
Information held or used by a program.
Condition
A test that can be judged true or false.
Sequence
Instructions carried out in order.

Continue through ICS2O

View the complete ICS2O Ontario Grade 10 Computer Science curriculum and lessons

Tutor support for B1.1 · Use basic programming terms correctly

Working on B1.1 · Use basic programming terms correctly in ICS2O? Bring the question and your own attempt. In a live session, you can trace a small input step by step, compare expected and actual output, and test an edge case. Ask about the first step that does not make sense, then try a similar question yourself.

Explore coding tutoring · Request an eligible free 30-minute introduction. Your request is matched by subject and language; a tutor must accept before a time is confirmed.

برای مبحث B1.1 · کاربرد درست اصطلاح‌های پایه برنامه‌نویسی در درس ICS2O، سؤال و تلاش خود را همراه بیاورید. در جلسه می‌توانید یک ورودی کوچک را گام‌به‌گام دنبال کنید، خروجی مورد انتظار و واقعی را مقایسه کنید و یک حالت مرزی را بیازمایید. راهنمای معلم برنامه‌نویسی را ببینید یا جلسهٔ معارفهٔ رایگان ۳۰ دقیقه‌ای درخواست کنید. زمان جلسه پس از پذیرش معلم قطعی می‌شود.

About this lesson and its review

Published by DoAssignment. This reviewed lesson follows Ontario Grade 10 Computer Science (ICS2O), expectation B1.1. It is a study resource, not an official curriculum publication.

Before publication, content is checked for structure, mathematical or chemical notation, calculations, course boundaries, and readability. Errors can still occur, so corrections are welcomed.

Official curriculum reference

Report a correction or ask a question