Last updated: 4 December 2026 · Punjab Board 9th Class Computer Science and Entrepreneurship (new syllabus 2025-26) · Unit 2
Easy, exam-focused notes for Unit 2: Number Systems of the new Punjab Board 9th class Computer Science book. Short answers are written to fit the board e-sheet answer space. All exercise MCQs are checked against the textbook answer key.
In this unit
- Decimal, binary, octal and hexadecimal
- Conversions with worked examples
- Whole numbers, integers and two’s complement
- Floating-point (real) numbers
- Binary arithmetic
- ASCII and Unicode (UTF-8, 16, 32)
- Storing images, audio and video
- Exercise: MCQs, short and long questions
- FAQs
2.1 Number systems
| System | Base | Digits used | Place values | Example |
|---|---|---|---|---|
| Decimal | 10 | 0–9 | 100, 101, 102 … | 523 = 5×10² + 2×10¹ + 3×10⁰ |
| Binary | 2 | 0, 1 | 20, 21, 22 … | 1011₂ = 8 + 0 + 2 + 1 = 11₁₀ |
| Octal | 8 | 0–7 | 80, 81, 82 … | 157₈ = 64 + 40 + 7 = 111₁₀ |
| Hexadecimal | 16 | 0–9, A–F (A=10 … F=15) | 160, 161, 162 … | 1A3₁₆ = 256 + 160 + 3 = 419₁₀ |
Why binary? Digital circuits have only two states, ON and OFF, which map neatly to 1 and 0. Letters, numbers, pictures and sound are all stored as binary in the end. One octal digit = 3 bits (8 = 2³) and one hex digit = 4 bits (16 = 2⁴), so octal and hex are short ways to write long binary numbers.
Conversions (worked examples)
Hex: group 4 bits: 1101 0110 1011 0010 → D 6 B 2 → D6B2₁₆. Add zeros on the left if a group is short.
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
2.2 Whole numbers, integers and two’s complement
- Whole numbers (W) = {0, 1, 2, 3, …} – no negatives; stored as unsigned numbers. With n bits the range is 0 to 2ⁿ − 1.
- Integers (Z) = {…, −2, −1, 0, 1, 2, …} – stored as signed numbers. The leftmost bit is the sign bit (0 = positive, 1 = negative).
- Signed range with n bits: −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1.
| Size | Unsigned range | Signed range |
|---|---|---|
| 1 byte (8 bits) | 0 to 255 | −128 to 127 |
| 2 bytes (16 bits) | 0 to 65,535 | −32,768 to 32,767 |
| 4 bytes (32 bits) | 0 to 4,294,967,295 | −2,147,483,648 to 2,147,483,647 |
2.3 Floating-point (real) numbers
Real numbers with a fraction are stored like scientific notation: number = sign × mantissa × 2exponent. To change a decimal fraction to binary, keep multiplying the fraction by 2 and write down the whole-number parts: 0.375 × 2 = 0.75 (0), 0.75 × 2 = 1.5 (1), 0.5 × 2 = 1.0 (1) → 0.375 = 0.011₂.
| Standard | Total bits | Sign | Exponent | Mantissa | Bias | Range (approx.) |
|---|---|---|---|---|---|---|
| Single precision | 32 | 1 | 8 | 23 | 127 | 1.4 × 10⁻⁴⁵ to 3.4 × 10³⁸ |
| Double precision | 64 | 1 | 11 | 52 | 1023 | 4.9 × 10⁻³²⁴ to 1.8 × 10³⁰⁸ |
Example: 5.75 = 101.11₂ = 1.0111 × 2². Sign = 0, exponent = 2 + 127 = 129 = 10000001, mantissa = the bits after the point: 0111000…0. For −5.75 only the sign bit changes to 1. 0.15625 = 1.25 × 2⁻³: exponent = −3 + 127 = 124 = 01111101, mantissa = 01000…0.
2.4 Binary arithmetic
| Addition rule | Result |
|---|---|
| 0 + 0 | 0 |
| 0 + 1 / 1 + 0 | 1 |
| 1 + 1 | 0, carry 1 |
| 1 + 1 + 1 | 1, carry 1 |
- Addition: 1101 + 1011 = 11000.
- Subtraction (by two’s complement): 9 − 6 → 1001 + (two’s complement of 0110 = 1010) = 10011 → discard the carry → 0011 = 3.
- Multiplication: 101 × 11 = 101 + 1010 = 1111 (5 × 3 = 15).
- Division: compare, subtract, shift, repeat. 1100 ÷ 10 = 110 (12 ÷ 2 = 6).
2.5 Text encoding: ASCII and Unicode
| Scheme | Bits / bytes per character | Characters | Key point |
|---|---|---|---|
| ASCII | 7 bits | 128 (codes 0–127) | English letters, digits, symbols. P = 80, a = 97, n = 110 |
| Extended ASCII | 8 bits | 256 | Adds accented letters and extra symbols |
| UTF-8 | 1 to 4 bytes (variable) | All Unicode | Backward compatible with ASCII. A = 01000001 (1 byte); Urdu ب (U+0628) = 2 bytes |
| UTF-16 | 2 or 4 bytes | All Unicode | Not compatible with ASCII. A = 00000000 01000001 |
| UTF-32 | 4 bytes (fixed) | All Unicode | Simple but uses the most space |
Unicode aims to give a code to every character of every writing system (over a million characters), so text in Urdu, Arabic, Chinese and English can be stored together. UTF = Unicode Transformation Format.
2.6 Storing images, audio and video
| Unit | Size |
|---|---|
| 1 Byte | 8 bits |
| 1 KB | 1024 bytes |
| 1 MB | 1024 KB |
| 1 GB | 1024 MB |
| 1 TB | 1024 GB |
| Then | PB, EB, ZB, YB (each 1024 times bigger) |
- Images: made of tiny dots called pixels. Each pixel’s colour is stored as RGB (Red, Green, Blue) values from 0 to 255; (255, 0, 0) is bright red. Formats: JPEG (compressed, small, some quality loss), PNG (transparency, no quality loss), GIF (simple animations, few colours).
- Audio: sound waves are recorded by sampling (measuring the wave at regular intervals; samples per second = sampling rate) and quantization (turning each sample into a number). Formats: MP3 (compressed), WAV (uncompressed, high quality), AAC (streaming).
- Video: many images called frames shown quickly with audio. Frame rate is measured in FPS (24 fps for movies, 30 fps for TV). Formats: MP4, AVI, MKV.
- Storage devices: HDD (spinning disks, large capacity), SSD (flash memory, faster), cloud storage (remote servers over the internet).
Unit 2 exercise (solved)
A. Multiple choice questions
1. What does ASCII stand for?
(a) American Standard Code for Information Interchange (b) Advanced Standard Code for Information Interchange (c) American Standard Communication for Information Interchange (d) Advanced Standard Communication for Information Interchange
Answer: (a) American Standard Code for Information Interchange – ASCII is the American Standard Code for Information Interchange.
2. Which of the following numbers is a valid binary number?
(a) 1101102 (b) 11011 (c) 110.11 (d) 1101A
Answer: (b) 11011 – Binary uses only 0 and 1; options with 2 or A are not binary.
3. How many bits are used in the standard ASCII encoding?
(a) 7 bits (b) 8 bits (c) 16 bits (d) 32 bits
Answer: (a) 7 bits – Standard ASCII has 128 characters, which need 7 bits.
4. Which of the following is a key advantage of Unicode over ASCII?
(a) It uses fewer bits per character (b) It can represent characters from many different languages (c) It is backward compatible with binary (d) It is specific to the English language
Answer: (b) It can represent characters from many different languages – Unicode covers the world’s writing systems.
5. How many bytes are used to store a typical integer?
(a) 1 byte (b) 2 bytes (c) 4 bytes (d) 8 bytes
Answer: (c) 4 bytes – A typical integer is 32 bits = 4 bytes.
6. What is the primary difference between signed and unsigned integers?
(a) Unsigned integers cannot be negative (b) Signed integers have a larger range (c) Unsigned integers are stored in floating-point format (d) Signed integers are only used for positive numbers
Answer: (a) Unsigned integers cannot be negative – Unsigned numbers have no sign bit, so they are 0 or positive.
7. In the single precision, how many bits are used for the exponent?
(a) 23 bits (b) 8 bits (c) 11 bits (d) 52 bits
Answer: (b) 8 bits – Single precision: 1 sign + 8 exponent + 23 mantissa bits.
8. What is the approximate range of values for single-precision floating-point numbers?
(a) 1.4 × 10⁻⁴⁵ to 3.4 × 10³⁸ (b) 1.4 × 10⁻³⁸ to 3.4 × 10⁴⁵ (c) 4.9 × 10⁻³²⁴ to 1.8 × 10³⁰⁸ (d) 4.9 × 10⁻³⁰⁸ to 1.8 × 10³²⁴
Answer: (a) 1.4 × 10⁻⁴⁵ to 3.4 × 10³⁸ – Option (c) is the double-precision range.
9. What are the tiny dots that make up an image called?
(a) Pixels (b) Bits (c) Bytes (d) Nodes
Answer: (a) Pixels – Each pixel stores one colour.
10. In an RGB colour model, what does RGB stand for?
(a) Red, Green, Blue (b) Red, Gray, Black (c) Right, Green, Blue (d) Red, Green, Brown
Answer: (a) Red, Green, Blue – Every colour is a mix of red, green and blue.
B. Short questions
C. Long questions
- Unicode gives each character a code point, e.g. A = U+0041, Urdu ب = U+0628.
- UTF-8: 1–4 bytes; A = 01000001 (1 byte); ب = 11011000 10101000 (2 bytes); works with old ASCII text.
- UTF-16: 2 or 4 bytes; A = 00000000 01000001; ب = 00000110 00101000; not ASCII-compatible.
- UTF-32: always 4 bytes; A = 00000000 00000000 00000000 01000001; simple but uses more space.
- Stored in 1, 2 or 4 bytes as binary.
- Unsigned (whole numbers): all bits hold the value; range 0 to 2ⁿ − 1 (255, 65,535, 4,294,967,295).
- Signed: leftmost bit is the sign bit; range −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1 (−128 to 127 for 1 byte).
- Negative values use two’s complement: invert the bits and add 1 (−5 = 11111011).
- Decimal → binary: divide by 2, read remainders bottom to top. 83 = 1010011₂.
- Binary → decimal: multiply each bit by its power of 2: 1011₂ = 8 + 0 + 2 + 1 = 11.
- Negative: −5 in 8 bits: 00000101 → invert 11111010 → +1 = 11111011.
- Back to decimal: sign bit is 1, so take the two’s complement again: 11111011 → 00000100 + 1 = 00000101 = 5 → value is −5.
(b) 11 − 10 = 1, bring down 0 → 10 − 10 = 0, bring down 0 → 110₂ (12 ÷ 2 = 6).
(b) 10111₂ (12 + 11 = 23).
(b) −5: 0101 → 1010 + 1 = 1011; 3 = 0011. 1011 + 0011 = 1110 = −2 (two’s complement of 1110 is 0010 = 2, and the sign bit is 1).
Method (a): two’s complement of 0100 = 1100; 1101 + 1100 = 1 1001 → discard carry → 1001.
9th class computer unit 2 MCQs with answers
Unit 2 (Number Systems) exercise MCQ answers: 1-a, 2-b, 3-a, 4-b, 5-c, 6-a, 7-b, 8-a, 9-a, 10-a.
How to convert decimal to binary 9th class computer?
Divide the number by 2 repeatedly, write each remainder, and read the remainders from bottom to top. Example: 83 = 1010011.
What is two’s complement?
A method to store negative numbers: invert all bits of the positive number and add 1. For example, −5 in 8 bits is 11111011.
Difference between ASCII and Unicode
ASCII uses 7 bits for 128 English characters; Unicode covers over a million characters of all languages using UTF-8, UTF-16 or UTF-32.
Range of unsigned 2-byte integer
0 to 65,535 (2¹⁶ − 1).
📄 Download these notes as PDF
Save this chapter to your phone or computer and read it offline, or share it with your friends.
The PDF downloads directly. Long chapters may take a few seconds.
More 9th Class Computer Science
Need a Computer Science home tutor?
Male & female Computer Science tutors in all major cities of Pakistan, home or online. 3-day free demo.
