Practice problems
Binary and hex practice problems
Binary writes every number with just two digits, 0 and 1, because a wire can be only off or on. These ten problems read binary as decimal, write decimal as binary, find how far n bits can count, and finish with hexadecimal, the shorthand programmers use. Type your answer to check it, and open the working whenever you want it.
The method
Each bit is worth twice the one to its right. Add the place values that have a 1:
- Decimal to binary: take the biggest place value that fits, write a 1, subtract, and move down a place
- n bits make 2n values, from 0 to 2n − 1
- Hexadecimal: each digit is worth 16 times the one to its right, with A–F standing for 10–15
The problems
Type your answer and tap Check. Every one has the working, step by step.
Problem 1 of 10
What is binary 1110 in decimal?
Show the working
- Write the place values 8, 4, 2 and 1 above the bits, then add the ones that have a 1 under them.
- 1110 = 8 + 4 + 2 + 0 = 14
Answer: 14
Problem 2 of 10
What is binary 10110 in decimal?
Show the working
- Five bits have place values 16, 8, 4, 2 and 1.
- 10110 = 16 + 0 + 4 + 2 + 0 = 22
Answer: 22
Problem 3 of 10
What is the byte 11001010 in decimal?
Show the working
- Eight bits have place values 128, 64, 32, 16, 8, 4, 2 and 1.
- The 1s sit under 128, 64, 8 and 2.
- 128 + 64 + 8 + 2 = 202
Answer: 202
Problem 4 of 10
Write decimal 12 in binary. Type the binary digits, like 101.
Show the working
- Take the biggest place value that fits and subtract: 8 fits, leaving 4. Then 4 fits, leaving 0.
- That's a 1 under 8 and 4 and a 0 under 2 and 1: 1100
Answer: 1100
Problem 5 of 10
Write decimal 37 in binary. Type the binary digits.
Show the working
- 32 fits, leaving 5. 16 and 8 don't fit. 4 fits, leaving 1. 2 doesn't fit. 1 fits, leaving 0.
- So the 1s go under 32, 4 and 1: 100101
Answer: 100101
Problem 6 of 10
Write decimal 200 in binary, as a full byte. Type the binary digits.
Show the working
- 128 fits, leaving 72. 64 fits, leaving 8. 32 and 16 don't fit. 8 fits, leaving 0.
- The 1s go under 128, 64 and 8, and the other places are 0: 11001000
Answer: 11001000
Problem 7 of 10
What is the largest number 6 bits can hold?
Show the working
- n bits make 2ⁿ values, and one of them is 0, so the largest is 2ⁿ − 1.
- 2⁶ − 1 = 64 − 1 = 63. As a check, 111111 = 32 + 16 + 8 + 4 + 2 + 1 = 63.
Answer: 63
Problem 8 of 10
A counter must count from 0 up to 500. What is the fewest bits it needs?
Show the working
- Find the smallest n where 2ⁿ − 1 reaches 500.
- 8 bits reach only 2⁸ − 1 = 255. 9 bits reach 2⁹ − 1 = 511, which is enough: 9 bits.
Answer: 9
Problem 9 of 10
What is hexadecimal 3C in decimal?
Show the working
- Each hex digit is worth 16 times the one to its right, and A–F stand for 10–15. So C is 12.
- 3C = 3 × 16 + 12 = 48 + 12 = 60
Answer: 60
Problem 10 of 10
Stretch: what is hexadecimal 1A4 in decimal?
Show the working
- Three hex digits have place values 256, 16 and 1. A is 10.
- 1A4 = 1 × 256 + 10 × 16 + 4 × 1
- 256 + 160 + 4 = 420
Answer: 420
“Binary and logic levels” is lesson 1 of 6 in Logic Grid, Electronics World 7. Free with an account. Lessons unlock in order, so you’ll do the 42 before it first.
Free lesson
Now build it yourself
Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.
“Binary and logic levels” is lesson 1 of 6 in Logic Grid, Electronics World 7. Free with an account. Lessons unlock in order, so you’ll do the 42 before it first.
Or start from the very first lesson, no account neededCheck it with a calculator
The ideas behind it
- Binary numbers explainedPlaces worth 1, 2, 4 and 8: add up the bits that are on, and four wires count to 15.
- Logic levels: what voltage is a 1, and what is a 0?Two wide bands of voltage, a gap between them, and why that makes digital signals shrug off noise.
- How to add binary numbersColumn by column, right to left, carrying when two 1s meet: the same sum every adder chip does.
Questions people ask
How do I convert binary to decimal?
Write the place values above the bits, starting with 1 on the right and doubling each step left: 1, 2, 4, 8, 16 and so on. Add the place values that have a 1 under them. So 1010 is 8 + 2 = 10.
How do I convert decimal to binary?
Take the biggest place value that fits, write a 1 there and subtract it. Move to the next place value down: a 1 if it fits into what's left, a 0 if not. Repeat until you reach the 1s place. So 9 is 8 + 1, which is 1001.
Why is the largest 8-bit number 255 and not 256?
8 bits make 2⁸ = 256 different values, but one of them is 0. So they count from 0 to 255. In general, n bits hold 0 to 2ⁿ − 1.
What is hexadecimal for?
Each hex digit stands for exactly four bits, using 0–9 then A–F for 10–15. That makes long binary numbers short and easy to read: the byte 1111 1111 is just FF, which is 255.
More practice
- Ohm's law practice problemsFind V, I or R, then the power, with the working for each.
- Units and prefixes practice problemsConvert mA, kΩ, µF, nF, pF, ms and mV, with the working for each.
- LED resistor practice problemsSize the resistor for one LED or a string, round to a standard value, check the power.
- Electrical power practice problemsPower three ways, energy in kWh, battery life and running costs, all worked.
- Series and parallel resistors practice problemsTotals in series and parallel, mixed networks and branch currents, all worked.
- Kirchhoff's laws practice problemsBalance currents at a junction and voltages round a loop, with the working for each.
- Voltage divider practice problemsFind Vout, pick R2 for a target and work out loading, with the working for each.
- Capacitor practice problemsCharge, capacitance, series and parallel, and stored energy, with the working.
- RC time constant practice problemsτ = R × C, the 63% rule, charging and discharging, with the working.
- AC voltage and transformer practice problemsPeak, RMS, period, AC power and transformer turns ratios, with the working.
- Capacitive and inductive reactance practice problemsCapacitor and coil reactance, AC current and impedance, with the working.
- RC filter practice problemsCutoff frequency, choosing R or C, and the output either side of the cutoff, with the working.
- Decibel practice problemsRatios to dB and back, for power and voltage, gains that add and the −3 dB point.
- Zener diode practice problemsSize a Zener regulator's resistor, split its current and check the Zener's power.
- Transistor switch practice problemsBase current, base resistor and load current for a BJT switch, then a MOSFET.
- Op-amp gain practice problemsInverting and non-inverting gain, the output, the resistor to pick and when it clips.