Number System Conversions and Binary Arithmetic: Solved MCQs

Conversion sums are the most common calculation in computer papers, from ICS and ECAT to PPSC, FPSC and bank IT exams. They are quick marks if the method is automatic and lost marks if place values or groupings slip. This lesson builds on the basics of number systems and practises the conversions, binary arithmetic, signed numbers and character codes that examiners ask most often, all with fresh worked numbers.

Asked in: PPSC, FPSC, NTS, ETEA, KPPSC, SSC, IBPS and ICS/ECAT computer

Place values to remember

Every conversion rests on the place values of each base. Binary place values double: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Octal place values are powers of 8: 1, 8, 64, 512. Hexadecimal place values are powers of 16: 1, 16, 256, 4096. Hex digits A to F stand for 10 to 15.

To convert any base to decimal, multiply each digit by its place value and add. For example (346)₈ = 3 × 64 + 4 × 8 + 6 = 230. To convert a decimal number to another base, divide by the base again and again, then read the remainders from the last to the first. For binary, it is often quicker to subtract the largest place value that fits: 58 = 32 + 16 + 8 + 2, so 58 = (111010)₂.

Shortcuts between binary, octal and hex

Each octal digit is exactly 3 bits and each hex digit is exactly 4 bits. So binary to octal means grouping bits in threes from the right; binary to hex means grouping in fours from the right; and the reverse means writing each digit as 3 or 4 bits. Octal and hex are never converted to each other directly in exams: go through binary.

Example: (725)₈ → 7 = 111, 2 = 010, 5 = 101, giving 111010101. Regroup in fours from the right: 1 | 1101 | 0101 = 1, D, 5, so (725)₈ = (1D5)₁₆. Pad the leftmost group with zeros when it is short.

Binary fractions

Digits after the binary point have place values ½, ¼, ⅛, 1/16 and so on, which are 0.5, 0.25, 0.125 and 0.0625. So (101.11)₂ = 4 + 1 + 0.5 + 0.25 = 5.75.

To change a decimal fraction to binary, multiply the fraction by 2 repeatedly. Each time, the whole-number part (0 or 1) is the next bit, and only the fraction part is carried forward. For 0.625: 0.625 × 2 = 1.25 (bit 1), 0.25 × 2 = 0.5 (bit 0), 0.5 × 2 = 1.0 (bit 1), stop. Read the bits from the first to the last: 0.101. Some fractions, such as 0.1, never end in binary, which is why computers store them only approximately.

Binary addition and subtraction

Addition rules: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1. Subtraction rules: 0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0, and 0 − 1 = 1 with a borrow of 1 from the next column (the borrowed 1 is worth 2 in the current column). Always check the result by converting to decimal.

Computers subtract by adding the 2’s complement. To find A − B with n bits: take the 2’s complement of B (invert every bit, then add 1), add it to A, and discard the final carry out of the leftmost bit. With 5 bits, 11010 − 01011: the 2’s complement of 01011 is 10101; 11010 + 10101 = 101111; discarding the carry leaves 01111 = 15, and indeed 26 − 11 = 15.

Signed numbers: sign-magnitude, 1’s and 2’s complement

In sign-magnitude form the leftmost bit is the sign (0 positive, 1 negative) and the rest is the size, so it has two zeros (+0 and −0). In 1’s complement a negative number is formed by inverting all bits of the positive number, and it also has two zeros. In 2’s complement a negative number is the 1’s complement plus 1. It has only one zero, and addition works without special rules, so all modern computers use it.

To write −37 in 8 bits: 37 = 00100101, invert to 11011010, add 1 to get 11011011. To read an 8-bit 2’s complement number that starts with 1, subtract 256 from its unsigned value: 11110010 is 242 unsigned, so it means 242 − 256 = −14. With n bits the range is −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1; for 8 bits, −128 to 127.

BCD and ASCII codes

Binary Coded Decimal (BCD, also called 8421 code) writes each decimal digit separately as 4 bits. So 59 in BCD is 0101 1001, while 59 in pure binary is 111011. Only the patterns 0000 to 1001 are valid BCD digits; 1010 to 1111 are unused. BCD is used where numbers must be shown as decimal digits, such as calculators and digital clocks.

ASCII (American Standard Code for Information Interchange) is a 7-bit code with 128 characters; extended 8-bit versions have 256. Useful codes: space = 32, digit 0 = 48 (so digit 5 = 53), capital A = 65 (so capital Z = 90) and small a = 97. A small letter’s code is always 32 more than its capital letter’s code. Unicode extends the idea to cover the scripts of the world, including Urdu and Hindi, and its first 128 codes match ASCII.

Solved examples

  1. Convert (58)₁₀ to binary.
    1. Largest place value not more than 58 is 32: 58 − 32 = 26.
    2. 26 − 16 = 10, 10 − 8 = 2, 2 − 2 = 0. Place values used: 32, 16, 8, 2.
    3. Write 1 under 32, 16, 8 and 2 and 0 under 4 and 1: 111010.
    Answer: (111010)₂
  2. Convert (300)₁₀ to octal and to hexadecimal.
    1. Octal: 300 ÷ 8 = 37 remainder 4; 37 ÷ 8 = 4 remainder 5; 4 ÷ 8 = 0 remainder 4. Read upwards: 454.
    2. Hex: 300 ÷ 16 = 18 remainder 12 (C); 18 ÷ 16 = 1 remainder 2; 1 ÷ 16 = 0 remainder 1. Read upwards: 12C.
    3. Check: 4 × 64 + 5 × 8 + 4 = 300 and 1 × 256 + 2 × 16 + 12 = 300.
    Answer: (454)₈ and (12C)₁₆
  3. Convert (725)₈ to hexadecimal.
    1. Write each octal digit as 3 bits: 7 = 111, 2 = 010, 5 = 101, giving 111010101.
    2. Group in fours from the right: 0001 | 1101 | 0101.
    3. Each group as a hex digit: 1, D, 5.
    Answer: (1D5)₁₆
  4. Find the decimal value of (101.11)₂ and the binary form of (0.625)₁₀.
    1. Whole part 101 = 4 + 1 = 5. Fraction .11 = 0.5 + 0.25 = 0.75. So the value is 5.75.
    2. 0.625 × 2 = 1.25 → bit 1; 0.25 × 2 = 0.5 → bit 0; 0.5 × 2 = 1.0 → bit 1; fraction is now 0, so stop.
    3. Read the bits in the order found: 0.101.
    Answer: 5.75 and (0.101)₂
  5. Subtract (1011)₂ from (11010)₂, first directly and then by the 2’s complement method using 5 bits.
    1. Directly, column by column with borrows, 11010 − 01011 = 01111; check: 26 − 11 = 15 = 1111.
    2. 2’s complement method: 01011 inverted is 10100; add 1 → 10101.
    3. 11010 + 10101 = 101111. Discard the carry out of the fifth bit: 01111.
    Answer: (1111)₂, which is 15
  6. Write −37 in 8-bit 2’s complement, and find the value of the 8-bit 2’s complement number 11110010.
    1. 37 = 32 + 4 + 1 = 00100101.
    2. Invert every bit: 11011010. Add 1: 11011011.
    3. 11110010 starts with 1, so it is negative. Its unsigned value is 128 + 64 + 32 + 16 + 2 = 242, and 242 − 256 = −14.
    4. Check: 14 = 00001110, inverted 11110001, plus 1 = 11110010.
    Answer: −37 = 11011011; 11110010 = −14

Exam shortcuts

Common mistakes

Practice MCQs

  1. What is the binary form of decimal 23?
    A) 11011
    B) 10011
    C) 10111
    D) 11101
    Answer: C) 10111 — 23 = 16 + 4 + 2 + 1, so the bits under 16, 4, 2 and 1 are 1: 10111. The other patterns are 27, 19 and 29.
  2. What is the decimal value of (1100100)₂?
    A) 100
    B) 68
    C) 98
    D) 196
    Answer: A) 100 — The 1s stand under 64, 32 and 4, and 64 + 32 + 4 = 100. 68 leaves out the 32, 98 adds a 2 that is not there, and 196 is too large for a 7-bit number, whose maximum is 127.
  3. What is decimal 172 in hexadecimal?
    A) CA
    B) AC
    C) AB
    D) BC
    Answer: B) AC — 172 ÷ 16 = 10 remainder 12, so the digits are A (10) and C (12): AC. CA reverses the digits (202), AB is 171 and BC is 188.
  4. What is (B3)₁₆ in binary?
    A) 10110110
    B) 11010011
    C) 10010011
    D) 10110011
    Answer: D) 10110011 — B = 1011 and 3 = 0011, giving 10110011. The other patterns change one of the two 4-bit groups, which gives B6, D3 and 93 in hex.
  5. What is the decimal value of (346)₈?
    A) 230
    B) 346
    C) 214
    D) 238
    Answer: A) 230 — 3 × 64 + 4 × 8 + 6 = 192 + 32 + 6 = 230. 346 is just the digits read as decimal, 214 uses 4 × 4 instead of 4 × 8, and 238 adds 8 too many.
  6. Add the binary numbers 11011 and 1110.
    A) 100101
    B) 110001
    C) 101001
    D) 101101
    Answer: C) 101001 — 11011 is 27 and 1110 is 14; 27 + 14 = 41 = 32 + 8 + 1 = 101001. The other answers are 37, 49 and 45, which come from slips in the carries.
  7. What is (10100)₂ − (111)₂?
    A) 1011
    B) 1111
    C) 1110
    D) 1101
    Answer: D) 1101 — 10100 is 20 and 111 is 7, so the difference is 13 = 8 + 4 + 1 = 1101. 1011 is 11, 1111 is 15 and 1110 is 14.
  8. Add the hexadecimal numbers (9F)₁₆ and (2C)₁₆.
    A) CB
    B) BB
    C) CA
    D) B11
    Answer: A) CB — F + C = 15 + 12 = 27 = 16 + 11, so write B and carry 1; 9 + 2 + 1 = 12 = C. The sum is CB (159 + 44 = 203). BB forgets the carry, CA mis-adds the units, and B11 writes 27 as two digits instead of carrying.
  9. What is decimal 93 in BCD (8421 code)?
    A) 1011101
    B) 1001 0011
    C) 0011 1001
    D) 1001 0010
    Answer: B) 1001 0011 — BCD codes each digit separately: 9 = 1001 and 3 = 0011. 1011101 is the pure binary form of 93, 0011 1001 is the BCD of 39, and 1001 0010 is the BCD of 92.
  10. The BCD code 0110 1000 represents which decimal number?
    A) 104
    B) 86
    C) 610
    D) 68
    Answer: D) 68 — Each 4-bit group is one digit: 0110 = 6 and 1000 = 8, so the number is 68. 104 is what the 8 bits mean as pure binary, 86 swaps the digits, and 610 wrongly treats 1000 as 10.
  11. The ASCII code of the capital letter D is 68. What is the ASCII code of the small letter d?
    A) 69
    B) 100
    C) 36
    D) 132
    Answer: B) 100 — In ASCII a small letter is always 32 more than its capital, so d = 68 + 32 = 100. 69 is the code of E, 36 subtracts 32 instead of adding, and 132 is outside standard 7-bit ASCII.
  12. How many bits does standard ASCII use for each character, and how many characters does it define?
    A) 8 bits, 256 characters
    B) 7 bits, 256 characters
    C) 7 bits, 128 characters
    D) 16 bits, 65,536 characters
    Answer: C) 7 bits, 128 characters — Standard ASCII is a 7-bit code, and 2⁷ = 128 characters. 8 bits with 256 characters describes extended ASCII, 7 bits cannot give 256 codes, and 16 bits with 65,536 describes the original Unicode range.
  13. What is −52 in 8-bit 2’s complement form?
    A) 11001100
    B) 11001011
    C) 10110100
    D) 00110100
    Answer: A) 11001100 — 52 = 00110100; inverting gives 11001011 (the 1’s complement) and adding 1 gives 11001100. 10110100 is the sign-magnitude form, and 00110100 is +52.
  14. An 8-bit register holds 10101010 as a 2’s complement number. What is its decimal value?
    A) 170
    B) −86
    C) −42
    D) −85
    Answer: B) −86 — Its unsigned value is 128 + 32 + 8 + 2 = 170, and since it starts with 1 its value is 170 − 256 = −86. 170 ignores the sign, −42 is the sign-magnitude reading, and −85 is the 1’s complement reading.
  15. What is the decimal value of the binary fraction (0.1101)₂?
    A) 0.75
    B) 0.875
    C) 0.8125
    D) 0.13
    Answer: C) 0.8125 — The bits are worth 0.5 + 0.25 + 0 + 0.0625 = 0.8125. 0.75 drops the last 1, 0.875 puts a 1 in the third place instead of the fourth, and 0.13 wrongly reads 1101 as decimal 13.

Questions

Why do computers use 2’s complement for negative numbers?

It has a single representation for zero and lets the same adder circuit handle both addition and subtraction, so no separate subtraction hardware or sign checks are needed.

Is BCD the same as binary?

No. Binary converts the whole number at once, while BCD converts each decimal digit separately into 4 bits. BCD needs more bits but is easy to display as decimal digits.

Which ASCII codes are worth memorising?

Space 32, digit 0 at 48, capital A at 65 and small a at 97. Other letters and digits follow in order, and small letters are 32 more than capitals.