Convert between positive denary and positive hexadecimal

IGCSE Computer Science (0478) – Complete Syllabus Notes

1. Computer Systems – Data Representation

1.1 Number Systems Overview

  • Binary (base‑2) – digits 0, 1; place values are powers of 2 (…, 2³, 2², 2¹, 2⁰).
  • Denary / Decimal (base‑10) – digits 0‑9; place values are powers of 10.
  • Hexadecimal (base‑16) – digits 0‑9, A‑F (A=10 … F=15); place values are powers of 16.
Place‑value tables for quick reference
BasePowerValue
Binary2⁰1
2
4
8
2⁴16
Denary10⁰1
10¹10
10²100
Hex16⁰1
16¹16
16²256

1.2 Converting Positive Denary ↔ Hexadecimal

Denary → Hexadecimal (repeated division by 16)
  1. Divide the decimal number by 16.
  2. Record the remainder (0‑15). Replace 10‑15 with A‑F.
  3. Replace the original number with the integer quotient.
  4. Repeat steps 1‑3 until the quotient is 0.
  5. Read the remainders **bottom‑to‑top** – this string is the hexadecimal value.

Example: Convert 43910 to hex.

  1. 439 ÷ 16 = 27 R 7 → digit 7
  2. 27 ÷ 16 = 1 R 11 → digit B
  3. 1 ÷ 16 = 0 R 1 → digit 1

Result: 1B716

Hexadecimal → Denary (positional method)
  1. Write the hex number and assign powers of 16 from right‑most (16⁰) to left.
  2. Replace each hex digit with its decimal value.
  3. Multiply each value by its corresponding power of 16.
  4. Sum the products.

Example: Convert 2F316 to decimal.

Hex digitDecimal valuePower of 16Product
2216² = 2562 × 256 = 512
F1516¹ = 1615 × 16 = 240
3316⁰ = 13 × 1 = 3

Sum = 512 + 240 + 3 = 75510.

1.3 Converting Positive Denary ↔ Binary (for completeness)

Denary → Binary (repeated division by 2)
  1. Divide the decimal number by 2.
  2. Record the remainder (0 or 1).
  3. Replace the number with the integer quotient.
  4. Repeat until the quotient is 0.
  5. Read the remainders bottom‑to‑top – this is the binary representation.

Example: 4510 → 101101₂

Binary → Denary (positional method)
  1. Write the binary number and assign powers of 2 from right‑most (2⁰).
  2. Multiply each bit by its power of 2.
  3. Sum the products.

Example: 101101₂ = 1·2⁵ + 0·2⁴ + 1·2³ + 1·2² + 0·2¹ + 1·2⁰ = 32 + 0 + 8 + 4 + 0 + 1 = 45₁₀.

1.4 Binary ↔ Hexadecimal (group‑by‑four bits)

  • Four binary bits correspond exactly to one hex digit because 2⁴ = 16.
  • Binary → Hex: Split the binary number into groups of four starting at the right‑most bit, add leading zeros if needed, then replace each group with its hex equivalent.
  • Hex → Binary: Replace each hex digit with its 4‑bit binary equivalent.

Example: 1101 0110₂ → groups 1101 0110 → D 6 → D616.

Example: 3A916 → 3 = 0011, A = 1010, 9 = 1001 → 0011 1010 1001₂.

1.5 Overflow, Two’s‑Complement & Logical Shifts (signed integers)

Overflow

In an n‑bit unsigned word the largest value is 2ⁿ‑1. Adding two numbers whose sum exceeds this limit discards the high‑order carry – the stored result is wrong (overflow).

Example (8‑bit unsigned):

Operand AOperand BExact 9‑bit sumStored 8‑bit result
200₁₀ = 11001000₂100₁₀ = 01100100₂11001100₂ (carry 1)1001100₂ = 44₁₀ (overflow)
Two’s‑Complement (signed integers)
  1. Write the absolute value in binary using the required number of bits.
  2. Invert every bit (0→1, 1→0).
  3. Add 1 to the inverted pattern.

Example: Represent ‑25 in an 8‑bit word.

  1. 25₁₀ = 00011001₂
  2. Invert → 11100110₂
  3. Add 1 → 11100111₂ → stored pattern for ‑25₁₀

To convert a two’s‑complement word back to decimal:

  • If the left‑most bit is 0, treat it as ordinary binary.
  • If the left‑most bit is 1, invert, add 1, then prefix a minus sign.
Logical Shifts
  • Logical left shift (<<): bits move left, 0 inserted on the right. Equivalent to multiplying by 2 (ignoring overflow).
  • Logical right shift (>>): bits move right, 0 inserted on the left. Equivalent to integer division by 2 (floor).

Example (8‑bit): 00110101₂ << 1 → 01101010₂ (53₁₀ → 106₁₀).

2. Computer Systems – Hardware

2.1 Central Processing Unit (CPU)

  • Fetch‑Decode‑Execute cycle – the CPU repeatedly fetches an instruction from memory, decodes it, and executes it.
  • Clock speed – measured in MHz or GHz; determines how many cycles occur per second.
  • Registers – small, fast storage inside the CPU (e.g., accumulator, program counter).
  • ALU (Arithmetic‑Logic Unit) – performs arithmetic and logical operations.
  • Cache – a small, fast memory that stores frequently used data/instructions.
  • Multi‑core processors – more than one execution unit on a single chip, allowing parallel processing.

2.2 Memory Hierarchy

LevelTypical SizeTypical SpeedPurpose
Registerstens of bytesfastestImmediate data for the CPU
Cache (L1/L2/L3)KB‑MBnanosecondsSpeed up access to main memory
RAM (Main memory)GBnanoseconds‑microsecondsStore programs & data while running
Secondary storageGB‑TBmillisecondsLong‑term data retention (HDD, SSD, optical)

2.3 Input & Output Devices

  • Input: keyboard, mouse, touch screen, scanner, microphone, sensors (temperature, light, motion).
  • Output: monitor, printer, speakers, actuators (motors, LEDs).
  • Devices may be digital (already binary) or analogue (require analog‑to‑digital conversion).

2.4 Storage Technologies

  • Magnetic HDD – rotating platters, magnetic heads; inexpensive, slower.
  • Solid‑State Drive (SSD) – flash memory; faster, more durable.
  • Optical media – CDs, DVDs, Blu‑ray; use laser to read/write pits.
  • Cloud storage – remote servers accessed via the internet; important for data backup.

3. Computer Systems – Software & Data

3.1 Software Types

  • System software – operating system (OS), device drivers; manages hardware resources.
  • Application software – word processors, browsers, games; performs user‑oriented tasks.
  • Utility software – antivirus, backup tools, file compressors.

3.2 Data Types & Representation

  • Primitive types: int (binary integer), float (IEEE‑754), char (ASCII/Unicode), bool (0/1).
  • Composite types: arrays, records/structures, strings.
  • Text encoding: ASCII (7‑bit, 0‑127) and Unicode (UTF‑8, UTF‑16) – essential for multilingual support.

3.3 Text – ASCII & Unicode Example

Character “A” → ASCII 65₁₀ → binary 01000001₂ → hexadecimal 41₁₆.

4. Computer Systems – Internet & Communication

4.1 Basic Internet Concepts

  • Client‑server model – clients request services, servers provide them.
  • IP address – 32‑bit (IPv4) or 128‑bit (IPv6) identifier for a network interface.
  • Domain Name System (DNS) – translates human‑readable domain names to IP addresses.
  • Protocols – TCP (reliable, connection‑oriented), UDP (unreliable, connection‑less), HTTP/HTTPS (web), FTP (file transfer).

4.2 Data Transmission Basics

  • Bandwidth – maximum data rate (bits per second, bps).
  • Latency – time for a single bit to travel from source to destination.
  • Packet structure (simplified) – Header | Payload | Trailer | Checksum.
  • Error detection: parity bits, checksums, CRC.

5. Computer Systems – Emerging Technologies

  • Internet of Things (IoT) – networked sensors & actuators, often low‑power microcontrollers.
  • Artificial Intelligence (AI) – machine learning models, neural networks, natural language processing.
  • Cloud Computing – on‑demand resources, virtualization, SaaS/PaaS/IaaS models.
  • Cyber‑security – encryption, authentication, firewalls, ethical hacking.

6. Algorithms & Programming

6.1 Algorithm Fundamentals

  • Definition: a step‑by‑step procedure for solving a problem.
  • Characteristics: finite, unambiguous, effective.
  • Common structures: sequence, selection (if‑else), iteration (loops).
  • Complexity: time (how many steps) and space (memory used).

6.2 Pseudocode Conventions (Cambridge style)

DECLARE counter, total AS INTEGER
SET counter ← 1
SET total   ← 0
WHILE counter ≤ 10 DO
    SET total ← total + counter
    SET counter ← counter + 1
END WHILE
OUTPUT total

6.3 Flowchart Symbols

SymbolNamePurpose
ProcessAssignment, calculation
DecisionTrue/False test (if‑else)
▶︎Input/OutputRead or display data
ConnectorLinking flow lines
Start/StopBegin or end of algorithm

6.4 Programming Concepts (Python‑style examples)

Variables & Data Types
age = 15                # integer
price = 3.99            # float
name = "Alice"          # string
is_valid = True         # boolean
Control Structures
# Selection
if score >= 50:
    result = "Pass"
else:
    result = "Fail"

# Iteration (for loop)
total = 0
for i in range(1, 11):      # 1 to 10 inclusive
    total = total + i
Functions (modular programming)
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

6.5 Problem Solving Strategies

  1. Understand the problem – read the question carefully.
  2. Identify inputs, required outputs and constraints.
  3. Design an algorithm – use pseudocode or a flowchart.
  4. Implement the algorithm in a programming language.
  5. Test with a range of data, including edge cases.
  6. Analyse efficiency (big‑O notation) if required.

7. Logic & Boolean Algebra

7.1 Logic Gates

GateSymbolTruth Table
AND1 & 1 → 1; otherwise 0
OR0 ∨ 0 → 0; otherwise 1
NOT¬¬0 → 1, ¬1 → 0
NANDinverse of AND
NORinverse of OR
XOR1 ⊕ 0 → 1; 0 ⊕ 1 → 1; otherwise 0

7.2 Boolean Expressions & Simplification

  • Use identities: A ∧ (A ∨ B) = A, A ∨ (A ∧ B) = A, ¬(A ∧ B) = ¬A ∨ ¬B (De Morgan).
  • Convert truth tables to expressions (sum‑of‑products) and simplify.

7.3 Logic Circuits – Example

Design a circuit that outputs 1 when exactly two of three switches (A, B, C) are ON.

Expression: (A ∧ B ∧ ¬C) ∨ (A ∧ ¬B ∧ C) ∨ (¬A ∧ B ∧ C)

Implement with AND, OR, NOT gates as shown in the accompanying diagram (exam‑style).

8. Revision Checklist

  • Convert between denary, binary and hexadecimal (both directions) – be able to do it by hand.
  • Explain overflow and two’s‑complement with examples.
  • Describe the CPU cycle, registers, cache and main memory.
  • Identify input/output device categories and give real‑world examples.
  • Calculate file sizes for audio, images and text using the appropriate formulas.
  • Write clear pseudocode/flowcharts for simple algorithms (e.g., sum of numbers, factorial).
  • Construct and simplify Boolean expressions; recognise basic logic gates.
  • Understand basic networking concepts: IP, DNS, TCP/UDP, bandwidth vs latency.
  • Know emerging tech keywords (IoT, AI, cloud, cyber‑security) for short‑answer questions.

Create an account or Login to take a Quiz

44 views
0 improvement suggestions

Log in to suggest improvements to this note.