PYQ Vault

NDA Maths · Binary Numbers

Binary ↔ Decimal Conversion

Base 2 writes every number with just the digits 0 and 1, where each place is worth a power of 2. Converting between binary and decimal is the single skill that unlocks the whole chapter — almost every PYQ starts with it.

Why this matters

This subtopic is the chapter's foundation. The NDA almost never asks you to do clever things IN binary — it asks you to convert, do ordinary decimal arithmetic, and (sometimes) convert back. Three direct PYQs live here, but the conversion skill is used in every other question in the chapter. Get decimal ↔ binary fluent first and the rest becomes easy.

Concept 1 of 3: What Base 2 Means — Place Values Are Powers of 2

In ordinary decimal (base 10) each place is worth a power of 10: ones, tens, hundreds. Binary (base 2) is the same idea with only two digits, 0 and 1, and each place worth a power of 2: ones, twos, fours, eights. A binary digit is called a bit, and it can only be 0 or 1 — there is no digit '2' in base 2.

Definition

A binary number is written using only the bits 0 and 1, in base 2. Reading from the right, the place values are

20=1,  21=2,  22=4,  23=8,  24=16,  25=32,  …2^0 = 1,\ \ 2^1 = 2,\ \ 2^2 = 4,\ \ 2^3 = 8,\ \ 2^4 = 16,\ \ 2^5 = 32,\ \ \ldots
A binary string (bnbn−1…b1b0)2(b_n b_{n-1}\ldots b_1 b_0)_2 means the weighted sum
(bnbn−1…b1b0)2=bn 2n+bn−1 2n−1+⋯+b1 21+b0 20,(b_n b_{n-1}\ldots b_1 b_0)_2 = b_n\,2^n + b_{n-1}\,2^{n-1} + \cdots + b_1\,2^1 + b_0\,2^0,
where each bit bi∈{0,1}b_i \in \{0, 1\}. The little subscript 22 is what marks a number as binary; with no subscript a number is assumed decimal (base 10).

  • The rightmost bit (b0b_0, worth 20=12^0 = 1) is the least significant bit.
  • The leftmost bit is the most significant bit.
  • A handy fact: a string of nn ones, (11…1⏟n)2(\underbrace{11\ldots1}_{n})_2, equals 2n−12^n - 1 (e.g. (11111)2=25−1=31(11111)_2 = 2^5 - 1 = 31).

Powers of 2 (place values)

2n29282726252423222120value5122561286432168421\begin{array}{c|ccccccccc} 2^n & 2^9 & 2^8 & 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ \hline \text{value} & 512 & 256 & 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \end{array}

Worked example

What place values do the bits of (1011)2(1011)_2 carry, and what number is it?
Practice this concept4 quick reps

Place values grow leftward, from 2⁰ on the RIGHT

The rightmost bit is the 20=12^0 = 1 place, not the 212^1 place. Counting the powers from the left, or starting at 212^1, shifts every weight and is the most common conversion slip.

No subscript means DECIMAL, not binary

A string like 10111011 written with no base subscript is the decimal number one thousand eleven — only (1011)2(1011)_2 is binary (which equals 111011_{10}). When a question gives a plain number to convert TO binary, read it as base 10; don't treat its digits as bits.

Concept 2 of 3: Converting Binary to Decimal

To turn a binary number into decimal, just add up the place values wherever a bit is 1 — ignore every position holding a 0. That is the whole method; everything else in the chapter leans on it.

Definition

To convert (bn…b1b0)2(b_n\ldots b_1 b_0)_2 to decimal, sum the powers of 2 at the positions where the bit is 1:

decimal=∑i: bi=12i.\text{decimal} = \sum_{i:\,b_i = 1} 2^i.

  • Line the bits up under their place values …,8,4,2,1\ldots, 8, 4, 2, 1 and add the ones that are switched on.
  • A symbolic binary like (cdc…)2(cdc\ldots)_2 with a stated order such as c>dc > d is still binary: the only digits available are 0 and 1, so c=1c = 1 and d=0d = 0. Substitute and convert as usual.

Binary → decimal

(bn…b1b0)2=∑i=0nbi 2i(b_n\ldots b_1 b_0)_2 = \sum_{i=0}^{n} b_i\, 2^i

Worked example

Convert (110101)2(110101)_2 to decimal.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Sep 2019 · Q40Moderate

Example 2 · Binary Numbers · Binary to Decimal Conversion

A binary number is represented by (cdccddcccddd)2(cdccddcccddd)_{2}, where c>dc > d. What is its decimal equivalent ?

A 0 bit contributes nothing — don't add its place value

Only positions holding a 1 are summed. The fastest error is to add every place value you wrote down. Cross out the 0-bit places before adding so only the active weights remain.

Concept 3 of 3: Converting Decimal to Binary

Going the other way, you peel off powers of 2 from largest to smallest, or — more mechanically — repeatedly divide by 2 and read the remainders bottom-up. Both give the same bits; pick whichever you find faster.

Definition

Two equivalent methods to convert a decimal number to binary:

  • Subtract powers of 2 (greedy): find the largest power of 2 not exceeding the number, put a 1 in that place, subtract it, and repeat with the remainder; every skipped place gets a 0.
  • Repeated division by 2: divide the number by 2, record the remainder (0 or 1), divide the quotient by 2 again, and so on until the quotient is 0. Read the remainders from bottom to top — that is the binary number.

Useful checkpoints: a value of the form 2n−12^n - 1 is nn ones (so 31=25−1=(11111)231 = 2^5 - 1 = (11111)_2), and a single power 2n2^n is a 1 followed by nn zeros.

Repeated division by 2

N→÷2(q1,r1)→÷2(q2,r2)→⋯→0;N=( rk…r2 r1)2N \xrightarrow{\div 2} (q_1, r_1) \xrightarrow{\div 2} (q_2, r_2) \to \cdots \to 0;\quad N = (\,r_k \ldots r_2\, r_1)_2

Worked example

Convert 451045_{10} to binary by repeated division.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

NDA · Apr 2018 · Q17Easy

Example 3 · Binary Numbers · Binary to Decimal Conversion

The binary number expression of the decimal number 31 is

Read the division remainders from the BOTTOM up

Repeated division produces the least significant bit first. Reading the remainders top-to-bottom reverses the number. The first remainder you write is the rightmost bit of the answer.

Keep a 0 in every skipped power — don't drop empty places

With the greedy method, every power of 2 you pass over still needs a 0 in its column. Writing only the powers you used (e.g. 20=16+420 = 16 + 4 as 1111 instead of (10100)2(10100)_2) silently deletes the empty 88, 22 and 11 places and gives the wrong number.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (3)

  • What Base 2 Means — Place Values Are Powers of 2

    Powers of 2 (place values)

    2n29282726252423222120value5122561286432168421\begin{array}{c|ccccccccc} 2^n & 2^9 & 2^8 & 2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0 \\ \hline \text{value} & 512 & 256 & 128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \end{array}
  • Converting Binary to Decimal

    Binary → decimal

    (bn…b1b0)2=∑i=0nbi 2i(b_n\ldots b_1 b_0)_2 = \sum_{i=0}^{n} b_i\, 2^i
  • Converting Decimal to Binary

    Repeated division by 2

    N→÷2(q1,r1)→÷2(q2,r2)→⋯→0;N=( rk…r2 r1)2N \xrightarrow{\div 2} (q_1, r_1) \xrightarrow{\div 2} (q_2, r_2) \to \cdots \to 0;\quad N = (\,r_k \ldots r_2\, r_1)_2

Watch out for (5)

Test yourself on a real paper

Sit a past NDA paper, timed and marked the way the exam marks it. You see your score and every answer the moment you finish. Free to start.