Data Representation and Data Processing
Data
Data Representation and Data Processing
Syllabus tag: KASNEB CPA | Foundation Level | CA16 Information Communication Technology | Topic 3 Data Representation and Data Processing
Lesson objectives
By the end of this topic, you will be able to:
- Convert between binary, decimal and hexadecimal
- Explain how characters are represented
- Describe the data processing cycle
- Compare batch, online and real-time processing
- Explain file organisation and access methods
Why this matters
Computers store everything as numbers in base two. Understanding that explains storage sizes, why some values overflow, and why a system that processes overnight cannot answer a question at three in the afternoon.
Number systems
| System | Base | Digits |
|---|---|---|
| Binary | 2 | 0, 1 |
| Decimal | 10 | 0–9 |
| Hexadecimal | 16 | 0–9 then A–F |
Binary to decimal. Each position is a power of two, read right to left:
1011 = (1×8) + (0×4) + (1×2) + (1×1) = 11 11010 = 16 + 8 + 0 + 2 + 0 = 26
Decimal to binary. Divide repeatedly by 2, then read the remainders upwards:
45 → 101101, and checking: 32 + 8 + 4 + 1 = 45 ✓ 200 → 11001000
Always check by converting back. It takes seconds and catches the error.
Hexadecimal is shorthand for binary, since one hex digit represents exactly four bits. A is 10, B is 11, through to F which is 15.
2F = (2×16) + 15 = 47 A7 = (10×16) + 7 = 167 255 in hex = FF
Hex appears in colour codes, memory addresses and error messages for one reason: it is far shorter than binary and converts to it without arithmetic.
What a given number of bits holds
n bits give 2ⁿ different values, from 0 to 2ⁿ − 1.
| Bits | Values | Maximum |
|---|---|---|
| 8 | 256 | 255 |
| 16 | 65,536 | 65,535 |
| 32 | over 4 billion | 4,294,967,295 |
This is where overflow comes from. A field allowed 8 bits cannot hold 300, and a system that silently wraps to 44 instead of refusing the entry produces a figure no reconciliation will explain. Field size is a design decision with accounting consequences.
Character representation
ASCII uses 7 or 8 bits per character, giving 128 or 256 characters — enough for English and little else.
Unicode uses more, covering every writing system in use. It is why a system can hold Kiswahili, Arabic and Chinese text in the same field, and why older systems sometimes display names with question marks where the character set could not represent them.
The data processing cycle
Collection → Input → Processing → Storage → Output → Feedback
Two related principles govern the whole cycle:
Garbage in, garbage out. No amount of processing corrects data entered wrongly. This is why validation at input carries more weight than any later check.
Errors cost more the later they are found — the same principle the systems development topic applies to requirements.
Processing methods
| Method | How it works | Suits |
|---|---|---|
| Batch | Transactions accumulated and processed as a group | Payroll, billing, month-end |
| Online / interactive | Each transaction processed as entered | Order entry, banking |
| Real-time | Processed immediately, and the result affects what happens next | Airline booking, process control |
| Distributed | Processing shared across several locations | Multi-site organisations |
| Time-sharing | One system serves many users in turn | Shared services |
Batch and real-time differ in what the answer is for. Batch is efficient — one run, one set of controls, predictable resource use — and the data is out of date between runs. Real-time is current and costs more in infrastructure.
Payroll is the classic batch application: nobody needs a running total of wages at eleven in the morning. Seat reservation must be real-time: two people cannot be sold the same seat because the file updates overnight.
:::checkpoint A company processes customer payments in a nightly batch. A customer telephones at 2 pm asking whether their morning payment cleared their account. Explain what the clerk will see and why. :::
File organisation and access
| Organisation | Access | Characteristics |
|---|---|---|
| Serial | Sequential only | Records in arrival order; used for transaction logs |
| Sequential | Sequential only | Records sorted by key; efficient for whole-file processing |
| Indexed sequential | Sequential or direct | An index permits both; the usual choice for master files |
| Random / direct | Direct only | Address computed from the key; fastest single-record retrieval |
Indexed sequential is the practical compromise. A customer master file must support both looking up one account instantly and running the whole file at month end, and only an indexed structure does both.
Master and transaction files
A master file holds relatively permanent data — customer details, balances, product records. A transaction file holds the movements of one period.
Updating applies the transaction file to the master file, producing a new master. Keeping the previous generations is the grandfather-father-son principle: if the current master is corrupted, it can be recreated by rerunning the transactions against the previous one.
That is a backup strategy expressed in file terms, and it is why transaction files are retained after the update has run.
:::checkpoint A master file is found to be corrupted three days after an update. Explain how the grandfather-father-son principle would recover it, and what would have to have been retained. :::