Encoding and Modulation in Computer Networks: Worked Examples and GATE Traps

Separate encoding from modulation with a four-path map, then work through line coding, 8-PSK baud, PCM sampling, quantisation, AM and FM bandwidth.

KnowledgeGate Team

Exam prep & CS education

Updated 18 Nov 20266 min read
Encoding and Modulation in Computer Networks: Worked Examples and GATE Traps

Encoding and modulation are often presented as one long list of NRZ, Manchester, ASK, FSK, PSK, QAM and PCM, even though they solve different conversion problems. Line coding, digital modulation, digitisation and analog modulation are the four source-to-signal cases. The same distinctions determine how 10110010 is line coded, how a 12-bit stream becomes four 8-PSK symbols at 24 kb/s, how a 4 kHz source is digitised, and why AM and FM require different bandwidth formulas.

Encoding changes representation; modulation changes a carrier

Encoding maps data into signal elements or codewords suitable for a medium. Modulation varies a sinusoidal carrier's amplitude, frequency, phase, or a combination of these. Baseband sends the encoded signal directly; passband places it on a carrier.

Source data

Transmitted signal

Operation

Schemes

Typical exam quantity

Digital

Digital

Line coding

NRZ, Manchester, AMI

Transition pattern

Digital

Analog

Digital modulation

ASK, FSK, PSK, QAM

Bit rate versus baud

Analog

Digital

Digitisation

Sampling, quantisation, PCM

Sampling and quantisation rate

Analog

Analog

Analog modulation

AM, FM, PM

Transmission bandwidth

Here, analog signal means a continuous-time passband waveform, even for digital source data. Keep the layers separate: signal representation belongs to the physical layer, while IP Addressing and Subnetting Explained belongs to the network layer.

Line coding schemes differ in levels, transitions and clock recovery

NRZ-L uses 1 = +V and 0 = -V. NRZ-I begins at -V and changes level at the start of every 1 bit. Manchester uses low-to-high for 1 and high-to-low for 0; Differential Manchester uses a mid-bit transition for clocking, with a boundary transition for 0 and no boundary transition for 1. AMI represents 0 as 0 V and alternates the sign of successive 1s, starting with +V here. A question-supplied convention always takes priority.

Scheme

What carries the bit

Mid-bit transition?

Long-run weakness

Convention warning

NRZ-L

Fixed level

No

Constant runs; possible DC

Level mapping may reverse

NRZ-I

Transition on 1

No

Long zero run

Initial level and transition rule matter

Manchester

Mid-bit direction

Yes

Higher bandwidth

Direction is not universal

Differential Manchester

Boundary transition or absence

Yes

Extra transitions

Boundary rule must be stated

AMI

Alternating non-zero marks

No

Long zero run

First mark polarity must be stated

Manchester and Differential Manchester guarantee a mid-bit clock transition, though the latter carries data at the boundary. NRZ can lose timing over constant runs and carry DC. AMI improves balance, but long zero runs provide no transitions.

Worked line-encoding example for 10110010

Split 1 0 1 1 0 0 1 0 into eight equal cells.

  • NRZ-L:+V, -V, +V, +V, -V, -V, +V, -V.

  • NRZ-I: starting at -V, the cell levels are +V, +V, -V, +V, +V, +V, -V, -V. Start transitions occur at positions 1, 3, 4, 7, exactly where the four 1 bits occur.

  • Manchester:LH | HL | LH | LH | HL | HL | LH | HL.

  • AMI: with the first mark positive, +V, 0, -V, +V, 0, 0, -V, 0. The four marks alternate +, -, +, -.

Three checks catch most errors: NRZ-L follows the bit value, NRZ-I follows transitions on 1, and AMI alternates only non-zero marks. Reverse only the Manchester convention and every half-cell direction flips, but every bit still has a mid-bit transition.

Four waveform rows for the bit string 1 0 1 1 0 0 1 0, drawn in NRZ-L, NRZ-I, Manchester and AMI over the same eight bit cells.

Digital modulation maps bit groups onto carrier states

ASK changes amplitude, FSK changes frequency, PSK changes phase, and QAM changes both amplitude and phase. An M-ary scheme has M distinct symbols. When M is a power of two, each symbol carries k = log2(M) bits.

R_b counts bits per second; R_s counts symbols per second, or baud. For an uncoded fixed-length mapping, R_s = R_b / log2(M). At 24 kb/s, binary PSK needs 24 kbaud, QPSK 12 kbaud, and 8-PSK 8 kbaud. Lower symbol rate does not guarantee lower error probability or the same SNR because larger constellations pack states more closely.

Worked 8-PSK example: map 12 bits and calculate baud

Use this Gray-labelled constellation: 000 -> 0 degrees, 001 -> 45 degrees, 011 -> 90 degrees, 010 -> 135 degrees, 110 -> 180 degrees, 111 -> 225 degrees, 101 -> 270 degrees, 100 -> 315 degrees.

The stream 111010101000 splits into 111 | 010 | 101 | 000, giving phases 225, 135, 270, 0 degrees. Since k = log2(8) = 3 bits/symbol,

R_s = 24,000 / 3 = 8,000 symbols/s = 8 kbaud

and T_s = 1/8000 s = 125 microseconds. Four symbols carry 4 x 3 = 12 bits and take 4 x 125 = 500 microseconds = 0.5 ms. Independently, 12 / 24,000 s = 0.5 ms. Never infer a phase without the labelling table the question states. A different Gray rotation changes the phase sequence, not the baud.

Gray-labelled 8-PSK constellation with points every 45 degrees, marking the symbols 111, 010, 101 and 000 at 225, 135, 270 and 0 degrees.

PCM digitises an analog source; AM, FM and PM keep it analog

For an ideal band-limited source with f_m = 4 kHz, the Nyquist minimum is f_s = 2f_m = 8 ksample/s. With L = 256 levels, n = log2(256) = 8 bits/sample. Therefore R_b = f_s x n = 8000 x 8 = 64 kb/s. In 1 ms, the encoder produces 8 samples x 8 bits = 64 bits.

The range -1 V to +1 V spans 2 V, so Delta = 2/256 = 0.0078125 V = 7.8125 mV. Maximum ideal rounding-error magnitude is Delta/2 = 3.90625 mV. Inputs outside the range clip. Endpoint representation depends on the quantiser definition, so state the step-size model.

Analog modulation uses different bandwidth rules. A 5 kHz message in conventional double-sideband AM occupies 2 x 5 = 10 kHz. With FM peak deviation Delta f = 25 kHz, Carson's rule estimates 2(Delta f + f_m) = 2(25 + 5) = 60 kHz. The AM formula cannot be reused for FM.

How exams test encoding and modulation, and where marks are lost

Questions ask you to classify a conversion path, draw or decode a stated line code, count transitions, convert bit rate to baud, map a given constellation, calculate PCM quantities, or compare AM and FM bandwidth. Mixed practice should alternate one waveform or constellation problem with one rate or bandwidth calculation so that convention errors do not hide behind formula recall. The CS Fundamentals route places the topic among related subjects.

Use this five-step routine:

  1. Write the source-data and transmitted-signal types.

  2. Copy the exact coding or constellation convention.

  3. Mark bit-cell boundaries.

  4. Calculate log2(M) before converting bit rate to baud.

  5. Keep sampling rate, levels, bits per sample, and transmission bit rate separate.

Classic traps follow directly. Baud is not always bit/s. NRZ-I uses transitions, Manchester follows the declared direction, and AMI alternates marks, not cells. PCM is analog-to-digital conversion, not analog modulation. The expression 2f_m is the Nyquist sampling minimum and, under a different formula, conventional AM bandwidth, so label the context before substituting values.

Encoding and modulation in the short version

Remember four paths: digital-to-digital is line coding, digital-to-analog is ASK, FSK, PSK or QAM, analog-to-digital is PCM, and analog-to-analog is AM, FM or PM. With the declared initial level, NRZ-I maps 10110010 to +V, +V, -V, +V, +V, +V, -V, -V. At 24 kb/s, 8-PSK sends three bits per symbol at 8 kbaud; a 4 kHz, 256-level PCM source sampled at the Nyquist minimum produces 64 kb/s.

Retrieval drill: at 24 kb/s, what changes with 16-QAM? Since k = 4 bits/symbol, R_s = 6 kbaud and T_s = 1/6000 s, approximately 166.67 microseconds. If the PCM quantiser changes to 1024 levels while f_s remains 8 ksample/s, it needs 10 bits/sample and 80 kb/s.

For your next step, choose Zero to Hero: Complete CS Course for a broader semester and fundamentals path, or CS Fundamentals for Placements by Sanchit Sir for placement-oriented revision that includes Computer Networks.