Skip to main content

Class 7 (Grade 7) ยท Computer Science

Introduction to Programming: Class 7 Computer Science

Variables, conditions, loops and functions, writing code that works.

  • Lesson
  • 10 quizzes
  • Worksheet PDF

A step-by-step lesson, 10 self-marking quizzes and a printable worksheet, all on Introduction to Programming for Class 7.

Introduction to Programming: the short answer

The type matters: "5" + "3" gives "53" because those are strings being joined, while 5 + 3 gives 8. This is one of the most common beginner bugs.

Learn it: the lesson

Introduction to Programming8 steps ยท one idea at a time ยท quick check at the endStart the lesson โ†’
What the lesson covers8 steps ยท tap to see
  1. 1A program is instructions you can run

    A program is a sequence of instructions a computer can execute.

    Learn this in the lesson โ†’
  2. 2Variables and data types

    A variable is a named store for a value.

    Learn this in the lesson โ†’
  3. 3Conditions and comparison

    Selection lets a program choose between paths.

    Learn this in the lesson โ†’
  4. 4Loops, and the infinite loop trap

    A count loop: you know how many times.

    Learn this in the lesson โ†’
  5. 5Functions

    A function is a named, reusable block of code.

    Learn this in the lesson โ†’
  6. 6Debugging methodically

    When a program misbehaves, the computer did exactly what you wrote.

    Learn this in the lesson โ†’
  7. 7What programming gives you

    Automation. Any repetitive task on a computer can usually be automated, renaming hundreds of files, processing a spreadsheet.

    Learn this in the lesson โ†’
  8. 8Where it usually goes wrong

    Using = instead of == in a condition.

    Learn this in the lesson โ†’
  9. Quick check: see what you remember

Introduction to Programming: Class 7 Computer Science notes

A program is instructions you can run

A program is a sequence of instructions a computer can execute.

Writing one has two distinct stages, and confusing them causes most beginner frustration:

  • The algorithm, working out what steps solve the problem. This is the hard part.
  • The code: writing those steps in a language the computer accepts. This is the easier part.

Plan on paper first. Debugging a wrong plan written in correct code is miserable.

Variables and data types

A variable is a named store for a value.

  • Integer, whole numbers
  • Float: decimals
  • String: text, in quotes
  • Boolean: True or False

The type matters: "5" + "3" gives "53" because those are strings being joined, while 5 + 3 gives 8. This is one of the most common beginner bugs.

Conditions and comparison

Selection lets a program choose between paths.

One = assigns; two == compare. Mixing them is the single most frequent error in early programming, and in many languages it produces no error message at all.

Order matters in elif chains, the first true condition wins, so put the most specific first.

Loops, and the infinite loop trap

A count loop: you know how many times.

Prints 0, 1, 2, 3, 4, five numbers starting at zero, which surprises everyone at first.

A condition loop, you do not know in advance.

Key facts

  • Algorithm first, code second.
  • Variables hold values; the type changes the behaviour.
  • = assigns, == compares; check loops can terminate.
  • Functions avoid repetition; logic errors are the hardest: test edge cases.

Introduction to Programming MCQs with answers

Tap an answer to check it.

  1. What is a computer program?

    Answer: A. A set of instructions written for a computer to perform a task A program is a list of instructions in a programming language that tells the computer exactly how to carry out a task.

  2. Which of these best describes debugging?

    Answer: A. Finding and fixing errors in a program Debugging means locating the bugs (errors) in code and correcting them so the program works as intended.

  3. A student wants a program to add two numbers entered by the user and display the result. Which sequence of steps is correct?

    Answer: A. Get input for both numbers, add them, then display the result A program must take input first, then process it with the addition, and only then output the result, in that order.

  4. Which of these best explains why planning with pseudocode or a flowchart before coding saves time?

    Answer: A. It helps catch logic errors early, before writing actual code Planning in pseudocode or a flowchart lets you spot logic mistakes before coding, which is cheaper than fixing finished code.

More questions in the 10 quizzes below โ†“ ยท All Class 7 Computer Science MCQs with answers โ†’

Practise real quizzes on this topic: 10 quizzes

Each quiz marks itself the moment it is finished and explains every answer. Start easy and work up.

๐Ÿ–จ๏ธClass 7 Computer Science: Introduction to ProgrammingProgramming means writing a set of instructions for a computer to follow, using ideas such as variables, algorithms, loops, pseudocode and debugging. The sheet mentions Scratch as a block-based starting point for beginners.See the worksheet โ†’

โฌ‡ Download free PDFFree sample copy with a light QuizByt mark. A free account gives you more.