Class 7 Computer Science Chapter 4 Complete Guide Book — Programming | PunjabTest.com

Class 7 Computer Science Chapter 4 Complete Guide Book — Programming | PunjabTest.com

PunjabTest.com > Class 7 > Computer Science — all chapters > Chapter 4: Programming

اس chapter میں topics (Topics in this chapter)

  1. 1. What Is a Program? — پروگرام کیا ہے؟
  2. 2. Programming Concepts: Data and Variables — پروگرامنگ تصورات: ڈیٹا اور ویری ایبلز
  3. 3. Sequence, Decisions and Loops in Programs — پروگراموں میں ترتیب، فیصلے اور لوپس
  4. 4. Writing and Testing a First Program — پہلا پروگرام لکھنا اور جانچنا
  5. 📝 Exercise Questions — with Answers
  6. 📌 Chapter Summary & Guidance
SOURCE NOTE

SLO-based practice chapter: no clean official PCTB book PDF for Class 7 Computer Science was available at build time, so this chapter is built from the PCTB/SNC Student Learning Outcomes (SLOs) for Class 7 Computer Science. It is practice material for the curriculum topics — NOT the official book exercise. When the official book is obtained, its exercise will replace this practice set. Nothing here is presented as a book page or an official question.

Chapter titles follow the PCTB/SNC curriculum progression for this class. All questions and answers below are original practice material written for this guide.

1. What Is a Program?پروگرام کیا ہے؟
🏷 Tags: program, programming language, instructions
ENGLISH

A program is a set of instructions a computer follows to do a task. A programming language is a formal language for writing those instructions — computers only understand 0s and 1s, so languages translate human ideas into machine steps.

Languages come in levels: machine language (0s and 1s, hard for humans), assembly language (short codes like ADD and MOV), and high-level languages (words closer to English, like Python and Scratch blocks).

اردو

پروگرام ہدایات کا مجموعہ ہے جس پر کمپیوٹر کسی کام کے لیے عمل کرتا ہے۔ پروگرامنگ زبان ان ہدایات کو لکھنے کی رسمی زبان ہے — کمپیوٹر صرف 0 اور 1 سمجھتا ہے اس لیے زبانیں انسانی خیالات کو مشینی مراحل میں بدلتی ہیں۔ زبانوں کی سطحیں ہیں: مشین زبان (0 اور 1، انسانوں کے لیے مشکل)، اسمبلی زبان (ADD اور MOV جیسے مختصر کوڈ) اور اعلیٰ سطحی زبانیں (انگریزی سے قریب الفاظ جیسے پائتھن اور اسکریچ بلاکس)۔

What Is a Program?Instructions→Machine Language→Assembly→High-LevelPunjabTest.com • diagram بنایا گیا ہے, کتاب کی تصویر نہیں
Program samjho: program ہدایات کا مجموعہ ہے — machine 0/1, assembly code, high-level انگریزی جیسی.
2. Programming Concepts: Data and Variablesپروگرامنگ تصورات: ڈیٹا اور ویری ایبلز
🏷 Tags: variable, data type, number, text
ENGLISH

A variable is a named box that stores a value that can change — for example, score = 0, and score grows as a game goes on. Data comes in types: numbers (for maths), text (names and messages), and true/false values (for decisions).

Choosing the right type matters: you cannot add two names like numbers, and storing a phone number as a number would lose a leading zero — so phone numbers are stored as text.

اردو

ویری ایبل ایک نام والا ڈبہ ہے جو بدلنے والی قدر محفوظ کرتا ہے — مثلاً اسکور = 0، اور کھیل چلنے کے ساتھ اسکور بڑھتا ہے۔ ڈیٹا کی اقسام ہیں: اعداد (حساب کے لیے)، متن (نام اور پیغامات) اور درست/غلط قدریں (فیصلوں کے لیے)۔ درست قسم چننا اہم ہے: دو ناموں کو اعداد کی طرح جمع نہیں کر سکتے، اور فون نمبر کو عدد بنا کر رکھنے سے شروع کا صفر ضائع ہو جائے گا اس لیے فون نمبر متن کے طور پر محفوظ ہوتا ہے۔

Programming Concepts: Data and VariablesVariable (box)→Numbers→Text→True / FalsePunjabTest.com • diagram بنایا گیا ہے, کتاب کی تصویر نہیں
Variables samjho: variable نام والا ڈبہ ہے — number حساب کے لیے, text نام کے لیے.
3. Sequence, Decisions and Loops in Programsپروگراموں میں ترتیب، فیصلے اور لوپس
🏷 Tags: sequence, if, loop, repeat
ENGLISH

Programs run in sequence (one step after another), unless a decision changes the path: 'if the password is correct, open the account, else show an error'. Loops repeat steps: 'repeat 5 times: print your name'.

These three ideas — sequence, decision, loop — build every program, from a calculator to a game. Learning to spot them in a problem is the heart of programming.

اردو

پروگرام ترتیب سے چلتے ہیں (ایک مرحلہ دوسرے کے بعد) جب تک کوئی فیصلہ راستہ نہ بدلے: 'اگر پاس ورڈ درست ہو تو اکاؤنٹ کھولو ورنہ غلطی دکھاؤ'۔ لوپس مراحل دہراتے ہیں: '5 بار دہراؤ: اپنا نام چھاپو'۔ یہ تین خیالات — ترتیب، فیصلہ، لوپ — ہر پروگرام بناتے ہیں، کیلکولیٹر سے لے کر کھیل تک۔ کسی مسئلے میں انہیں پہچاننا پروگرامنگ کا دل ہے۔

Sequence, Decisions and Loops in ProgramsSequence→If / Else→Loop→ProgramPunjabTest.com • diagram بنایا گیا ہے, کتاب کی تصویر نہیں
Sequence aur loops samjho: ترتیب, اگر-تو, دہراؤ — ہر program ان تینوں سے بنتا ہے.
4. Writing and Testing a First Programپہلا پروگرام لکھنا اور جانچنا
🏷 Tags: write, run, error, debug, test
ENGLISH

Writing a program has steps: understand the task, write the steps (algorithm), write the code, run it, and fix the errors it shows. Errors are normal — even experts make them daily.

Debugging means finding and fixing errors: read the error message, check the line it points to, test with simple data first, and fix one error at a time. A program that works on simple data can then be tested on harder data.

اردو

پروگرام لکھنے کے مراحل ہیں: کام سمجھو، مراحل لکھو (الگورتھم)، کوڈ لکھو، چلاؤ اور غلطیاں درست کرو۔ غلطیاں معمول کی بات ہیں — ماہرین بھی روز کرتے ہیں۔ ڈیبگنگ یعنی غلطیاں ڈھونڈنا اور درست کرنا: غلطی کا پیغام پڑھو، جس سطر کی طرف اشارہ ہو اسے دیکھو، پہلے سادہ ڈیٹا سے جانچو اور ایک وقت میں ایک غلطی درست کرو۔ سادہ ڈیٹا پر چلنے والا پروگرام پھر مشکل ڈیٹا پر جانچا جا سکتا ہے۔

Writing and Testing a First ProgramUnderstand→Write Code→Run→Fix ErrorsPunjabTest.com • diagram بنایا گیا ہے, کتاب کی تصویر نہیں
Debugging samjho: غلطیاں normal ہیں — پیغام پڑھو, ایک وقت ایک غلطی ٹھیک کرو.
📝 Exercise Questions — with Answers📝 مشق کے سوالات — جوابات کے ساتھ

اس chapter کی exercise SLO-based practice ہے — MCQs, short اور long سوال اس guide کے لیے لکھے گئے ہیں, کتاب کی official exercise نہیں. جواب کے ساتھ practice کرو.

Section A: Multiple Choice Questionsحصہ الف: کثیر الانتخابی سوالات

1. A program is:

  • A computer part
  • A set of instructions a computer follows ✓
  • A type of screen
  • A game console
Answer / جواب

Answer: (b) — A program is instructions for a task.

2. Machine language uses:

  • English words
  • Only 0s and 1s ✓
  • Pictures only
  • Urdu script only
Answer / جواب

Answer: (b) — Machine language is binary: 0s and 1s.

3. A variable is:

  • A fixed number
  • A named box storing a changeable value ✓
  • A cable
  • A printer
Answer / جواب

Answer: (b) — A variable stores a value that can change, like a score.

4. Which is a decision in a program?

  • Print your name 5 times
  • If password is correct, open the account ✓
  • Add 2 + 3
  • Turn the computer on
Answer / جواب

Answer: (b) — If/else decisions choose a path based on a condition.

5. A loop is used to:

  • Stop a program
  • Repeat steps ✓
  • Delete data
  • Draw a picture only
Answer / جواب

Answer: (b) — Loops repeat steps while a condition holds.

6. Debugging means:

  • Removing insects
  • Finding and fixing errors ✓
  • Buying a new computer
  • Printing code
Answer / جواب

Answer: (b) — Debugging is finding and fixing program errors.

Section B: Short Questionsحصہ ب: مختصر سوالات
1. What is a programming language?

Answer: A programming language is a formal language for writing the instructions that make up a program, translating human ideas into steps a computer can follow.

2. Why is a phone number stored as text, not as a number?

Answer: Because storing it as a number would lose a leading zero and because phone numbers are never used in maths; text keeps every digit exactly.

3. What is the difference between assembly and high-level languages?

Answer: Assembly uses short codes like ADD and MOV, close to the machine and hard to read. High-level languages use words closer to English, are easier to write and read, and work on many machines.

4. Give one example each of sequence, decision and loop.

Answer: Sequence: boil water, then add tea leaves, then serve — in order. Decision: if it rains, take an umbrella. Loop: repeat 5 times: write your name.

5. What should you do first when your program shows an error?

Answer: Read the error message carefully and look at the line it points to, then test with simple data before changing anything else.

Section C: Long Questionsحصہ ج: تفصیلی سوالات
1. Explain the levels of programming languages.

Answer: Machine language is 0s and 1s — the only language hardware understands directly, but very hard for humans. Assembly language uses short mnemonic codes like ADD and MOV for machine operations; it is easier than binary but still tied to one machine type. High-level languages (Python, Scratch) use English-like words and ready-made commands, are much easier to learn and read, and are translated into machine code by translators (compilers/interpreters).

2. Write a simple program plan (algorithm + code outline) to check if a number is even or odd.

Answer: Algorithm: (1) Input a number N. (2) If N divided by 2 leaves remainder 0, print 'Even', else print 'Odd'. Code outline: input N; if N % 2 == 0: print('Even') else: print('Odd'). Test: N=8 → remainder 0 → Even. N=7 → remainder 1 → Odd. The decision (if/else) is the heart of the program.

3. Why are errors normal in programming, and how do you debug?

Answer: Errors are normal because programs are long chains of exact steps — one wrong symbol breaks the chain, and even experts make errors daily. Debugging: read the error message, find the line it points to, test with simple data, fix one error at a time, and re-run. Keeping a calm, step-by-step approach turns errors from frustration into the main way programmers learn.

📌 باب کا خلاصہ و رہنمائی — اس باب میں کیا ہے؟
ENGLISH SUMMARY

Programming turns ideas into instructions a computer follows: programs are written in languages from machine code to high-level words, use variables to store values, and are built from sequence, decisions and loops — then tested and debugged until they work.

Revision guidance: پہلے MCQs خود حل کرو, پھر جواب ملاؤ; short سوالوں کے جواب اپنے الفاظ میں لکھ کر practice کرو; long سوالوں کے لیے ہر section کی headings اور مثالیں یاد رکھو.

اردو خلاصہ

پروگرامنگ خیالات کو ان ہدایات میں بدلتی ہے جن پر کمپیوٹر عمل کرتا ہے: پروگرام مشین کوڈ سے لے کر اعلیٰ سطحی الفاظ تک کی زبانوں میں لکھے جاتے ہیں، قدریں محفوظ کرنے کے لیے ویری ایبلز استعمال کرتے ہیں، اور ترتیب، فیصلوں اور لوپس سے بنتے ہیں — پھر جانچے اور درست کیے جاتے ہیں یہاں تک کہ کام کرنے لگیں۔

رہنمائی: پہلے ایم سی کیوز خود حل کریں پھر جوابات ملائیں؛ مختصر سوالات کے جوابات اپنے الفاظ میں لکھ کر مشق کریں؛ تفصیلی سوالات کے لیے ہر سیکشن کی سرخیاں اور مثالیں یاد رکھیں۔

Is chapter ke topics: What Is a Program? · Programming Concepts: Data and Variables · Sequence, Decisions and Loops in Programs · Writing and Testing a First Program · مشق

Topics (Urdu): پروگرام کیا ہے؟ · پروگرامنگ تصورات: ڈیٹا اور ویری ایبلز · پروگراموں میں ترتیب، فیصلے اور لوپس · پہلا پروگرام لکھنا اور جانچنا

Revision guidance: پہلے MCQs خود حل کرو, پھر جواب ملاؤ; short سوالوں کے جواب اپنے الفاظ میں لکھ کر practice کرو; long سوالوں کے لیے ہر section کی headings اور مثالیں یاد رکھو.

🎯 مزید MCQs اور Tests کے لیے

Chapter-wise tests, fresh random papers اور instant score کے لیے PunjabTest.com کا میں test section دیکھو:

PunjabTest.com — Tests →

PunjabTest.com — Complete Guide Book • Class 7 Computer Science, Chapter 4 (SLO-based practice (not the official book exercise), Session 2026–27) • English + Urdu

← Chapter 3 — Computational ThinkingChapter 5 — Digital Citizenship →