These nine questions mix number systems, file size, error checking, logic, algorithms, testing and databases. Do them in order, on paper, and open each answer only after you have written your own.
The original mixed-practice builder can assemble longer sessions from a reviewed bank. Use this page for a first set, and keep your mistakes in the mistake log.
How to use this set
- Attempt the question with a pen. Write the working, not just the answer.
- Open the answer and compare step by step.
- If you were wrong, note the cause: slip, misreading, gap or term.
- Retest the same skill with a new question two days later.
Questions
Q1. Binary to denary. Convert 10110 to denary.
Show answer
The place values from the left are 16, 8, 4, 2, 1, so the bits 1, 0, 1, 1, 0 select 16, 4 and 2.
16 + 4 + 2 = 22.
Q2. Denary to binary. Convert 45 to binary.
Show answer
45 = 32 + 13. 13 = 8 + 4 + 1. So the 32, 8, 4 and 1 places are 1.
Places 32, 16, 8, 4, 2, 1 give 1, 0, 1, 1, 0, 1, so the answer is 101101. Check: 32 + 8 + 4 + 1 = 45. ✓
Q3. Hexadecimal. Convert hexadecimal 2F to denary.
Show answer
The 2 is in the sixteens place and F is 15. So 2 × 16 + 15 = 32 + 15 = 47.
Q4. Image size. An image is 8 pixels wide and 8 pixels high. Each pixel can be one of 16 colours, stored with the smallest whole number of bits. Find the file size in bytes, ignoring any extra data.
Show answer
16 colours need 4 bits, because 2⁴ = 16. There are 8 × 8 = 64 pixels.
64 × 4 = 256 bits. 256 ÷ 8 = 32 bytes.
Q5. Parity. Seven data bits 1011001 are sent with an even parity bit. What is the parity bit?
Show answer
Count the 1s: 1, 0, 1, 1, 0, 0, 1 has four 1s. Four is already even, so the parity bit is 0.
Q6. Logic. For inputs A = 1 and B = 0, what is the output of NOT (A AND B)? What changes if B = 1?
Show answer
With A = 1 and B = 0: A AND B = 0, and NOT 0 = 1.
With B = 1: A AND B = 1, and NOT 1 = 0.
Q7. Trace table. Trace this algorithm and state the output.
X ← 3
Y ← 0
WHILE X > 0
Y ← Y + X
X ← X - 1
ENDWHILE
OUTPUT Y
Show answer
| Pass | X at start | Y after adding | X after |
|---|---|---|---|
| 1 | 3 | 3 | 2 |
| 2 | 2 | 5 | 1 |
| 3 | 1 | 6 | 0 |
Now X = 0, so the loop stops. The output is 6. Check: 3 + 2 + 1 = 6. ✓
Q8. Test data. A program accepts ages from 13 to 18 inclusive. Give one normal value, the boundary values to test and two values that should be rejected.
Show answer
Normal: 15. Boundaries: 13 and 18, which must be accepted.
Rejected: 12 and 19, just outside the edges, plus abnormal input such as “abc”. A good set has normal, boundary and abnormal data.
Q9. SQL conditions. Use this table, Members.
| Name | Year | Club |
|---|---|---|
| Aina | 10 | Chess |
| Ben | 10 | Drama |
| Chen | 11 | Chess |
| Dev | 11 | Drama |
Which names does WHERE Year = 10 AND Club = "Chess" return? Which does WHERE Year = 10 OR Club = "Chess" return?
Show answer
AND needs both true: only Aina (Year 10 and Chess). Answer: Aina.
OR needs either true: Aina (both), Ben (Year 10), Chen (Chess). Dev is neither. Answer: Aina, Ben, Chen.
If you got these wrong
| Where you slipped | What to read |
|---|---|
| Q1 to Q3, conversions | Representing numbers and text |
| Q4, file size | Images, sound and storage |
| Q5, parity | Data transmission and checking |
| Q6, logic | Boolean logic |
| Q7, tracing | Repetition and arrays and the loop help page |
| Q8, test data | Validation, verification and testing and the boundary help page |
| Q9, SQL | Databases and query reasoning |
If you confused terms rather than methods, see the terminology guide. The learning guide has the full module map.
When practice alone is not enough
If you can follow every answer but cannot produce the working yourself, the gap is usually in the first step of reasoning. That is a good reason to talk it through with someone who can watch you. Online one-to-one Computer Science tuition starts with a paid one-hour trial at the assigned teacher’s confirmed rate, from RM80.