9th Class Computer Science Unit 2 Number Systems – Notes, MCQs and Questions (New Syllabus)

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

  1. Decimal, binary, octal and hexadecimal
  2. Conversions with worked examples
  3. Whole numbers, integers and two’s complement
  4. Floating-point (real) numbers
  5. Binary arithmetic
  6. ASCII and Unicode (UTF-8, 16, 32)
  7. Storing images, audio and video
  8. Exercise: MCQs, short and long questions
  9. FAQs

2.1 Number systems

SystemBaseDigits usedPlace valuesExample
Decimal100–9100, 101, 102 …523 = 5×10² + 2×10¹ + 3×10⁰
Binary20, 120, 21, 22 …1011₂ = 8 + 0 + 2 + 1 = 11₁₀
Octal80–780, 81, 82 …157₈ = 64 + 40 + 7 = 111₁₀
Hexadecimal160–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)

Decimal → binary: 83
Divide by 2 and note remainders: 83→41 r1, 41→20 r1, 20→10 r0, 10→5 r0, 5→2 r1, 2→1 r0, 1→0 r1. Read remainders from bottom to top: 83 = 1010011₂
Decimal → octal: 83
83 ÷ 8 = 10 r3, 10 ÷ 8 = 1 r2, 1 ÷ 8 = 0 r1 → 83 = 123₈
Decimal → hexadecimal: 2297
2297 ÷ 16 = 143 r9, 143 ÷ 16 = 8 r15 (F), 8 ÷ 16 = 0 r8 → 2297 = 8F9₁₆
Binary → octal and hexadecimal
Octal: group 3 bits from the right: 110 101 011 → 6 5 3 → 653₈.
Hex: group 4 bits: 1101 0110 1011 0010 → D 6 B 2 → D6B2₁₆. Add zeros on the left if a group is short.
Hex0123456789ABCDEF
Binary0000000100100011010001010110011110001001101010111100110111101111

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.
SizeUnsigned rangeSigned 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
Two’s complement of −5 (8 bits)
1. +5 = 00000101   2. Invert all bits: 11111010   3. Add 1: 11111011 = −5
Note: the book prints the 4-byte minimum as −2³¹ − 1. The correct value is −2³¹ = −2,147,483,648, which matches the number written next to it.

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₂.

StandardTotal bitsSignExponentMantissaBiasRange (approx.)
Single precision3218231271.4 × 10⁻⁴⁵ to 3.4 × 10³⁸
Double precision641115210234.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.

Note on Table 2.3: for 5.75 the book writes the mantissa as 10111000…; the stored 23-bit mantissa (bits after the leading 1) is 01110000000000000000000. The sign and exponent values in the book are correct. Floating-point values can have small round-off errors.

2.4 Binary arithmetic

Addition ruleResult
0 + 00
0 + 1 / 1 + 01
1 + 10, carry 1
1 + 1 + 11, 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

SchemeBits / bytes per characterCharactersKey point
ASCII7 bits128 (codes 0–127)English letters, digits, symbols. P = 80, a = 97, n = 110
Extended ASCII8 bits256Adds accented letters and extra symbols
UTF-81 to 4 bytes (variable)All UnicodeBackward compatible with ASCII. A = 01000001 (1 byte); Urdu ب (U+0628) = 2 bytes
UTF-162 or 4 bytesAll UnicodeNot compatible with ASCII. A = 00000000 01000001
UTF-324 bytes (fixed)All UnicodeSimple 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

UnitSize
1 Byte8 bits
1 KB1024 bytes
1 MB1024 KB
1 GB1024 MB
1 TB1024 GB
ThenPB, 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

Q1. What is the primary purpose of the ASCII encoding scheme?
ASCII gives a unique number (0–127) to each English letter, digit and symbol, so that different computers and devices can store and exchange text in the same way. Example: P = 80, a = 97.
Q2. Explain the difference between ASCII and Unicode.
ASCII uses 7 bits and represents only 128 characters (mainly English). Unicode can represent over a million characters from all languages (Urdu, Arabic, Chinese etc.) using UTF-8, UTF-16 or UTF-32.
Q3. How does Unicode handle characters from different languages?
Unicode gives every character of every language a unique code point (e.g. A = U+0041, ب = U+0628) and stores it with an encoding: UTF-8 (1–4 bytes), UTF-16 (2 or 4 bytes) or UTF-32 (always 4 bytes).
Q4. What is the range of values for an unsigned 2-byte integer?
2 bytes = 16 bits, so the range is 0 to 2¹⁶ − 1 = 0 to 65,535.
Q5. Explain how a negative integer is represented in binary.
By two’s complement: write the positive number in binary, invert all bits, then add 1. Example: +5 = 00000101 → 11111010 → +1 = 11111011 = −5. The leftmost (sign) bit 1 shows it is negative.
Q6. What is the benefit of using unsigned integers?
No bit is used for the sign, so the same number of bits can store a larger positive value (1 byte: 0–255 instead of −128 to 127). They suit quantities that are never negative, like age or number of students.
Q7. How does the number of bits affect the range of integer values?
More bits give a bigger range. With n bits, unsigned range = 0 to 2ⁿ − 1 and signed range = −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1. Example: 8 bits → 0–255; 16 bits → 0–65,535.
Q8. Why are whole numbers commonly used in computing for quantities that cannot be negative?
Things like age, number of students, marks or items in stock can never be below zero. Storing them as whole (unsigned) numbers avoids wrong negative values and gives a larger positive range.
Q9. How is the range of floating-point numbers calculated for single precision?
Single precision uses 32 bits: 1 sign bit, 8 exponent bits (bias 127, exponent −126 to +127) and 23 mantissa bits. This gives values from about 1.4 × 10⁻⁴⁵ to 3.4 × 10³⁸.
Q10. Why is it important to understand the limitations of floating-point representation in scientific computing?
Floating-point numbers have limited bits, so many values are stored only approximately and small round-off errors appear. In scientific calculations these errors can add up, so they must be checked to keep results accurate.

C. Long questions

Q1. Explain how characters are encoded using Unicode, with examples.
  • 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.
Q2. Describe how integers are stored in computer memory.
  • 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).
Q3. Convert a decimal integer to binary and back, with positive and negative examples.
  • 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.
Q4. Perform: (a) 101 × 11 (b) 1100 ÷ 10
(a) 101 × 1 = 101; 101 × 1 shifted = 1010; 101 + 1010 = 1111₂ (5 × 3 = 15).
(b) 11 − 10 = 1, bring down 0 → 10 − 10 = 0, bring down 0 → 110₂ (12 ÷ 2 = 6).
Q5. Add: (a) 101 + 110 (b) 1100 + 1011
(a) 1011₂ (5 + 6 = 11).
(b) 10111₂ (12 + 11 = 23).
Q6. Convert to 4-bit binary and add: (a) 7 + (−4) (b) −5 + 3
(a) 7 = 0111; −4: 0100 → 1011 + 1 = 1100. 0111 + 1100 = 1 0011 → discard carry → 0011 = 3.
(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).
Q7. Solve: (a) 1101 − 0100 (b) 1010 − 0011 (c) 1000 − 0110 (d) 1110 − 100
(a) 1001 (13 − 4 = 9)   (b) 0111 (10 − 3 = 7)   (c) 0010 (8 − 6 = 2)   (d) 1010 (14 − 4 = 10).
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.

Scroll to Top