Computer Networks: cram pack

Formula sheets, the key method steps for every topic and 6 practice problems, with full solutions at the back.

New problemsBack to the course

In the print window, choose “Save as PDF” to keep a copy on your device.

1Formulas and methods

IPv4 subnetting

Hosts per subnet
2(32 − prefix) − 2 (/31: 2, /32: 1)
Block size
256 − (mask octet)
Network address
IP AND mask
Broadcast address
IP OR (NOT mask): all host bits set to 1
Subnets from n borrowed bits
2n

Number systems

Place values
binary 2k, octal 8k, hex 16k
To decimal
Σ dk·bk
From decimal
divide by the base, read the remainders bottom-up
Hex ↔ binary
one hex digit = 4 bits
Two’s complement
invert the bits and add 1

2Practice problems

1.IPv4 subnettingMedium
/16 → /1811111111111111111100000000000000network bitshost bits

The network 172.19.0.0/16 is divided into equal subnets with prefix /18. How many subnets N are there?

172.19.0.0/16/18
N =
2.IPv4 subnettingHard
last octet = 93012816403211618140211networkhost

A host has the address 10.20.198.93/27. What is the fourth octet x of its network address?

10.20.198.93/27
x =
3.Computer networksMedium

Which medium access method did classic shared (half-duplex) Ethernet use?

  1. ACSMA/CA
  2. BCSMA/CD
  3. CTDMA
  4. DToken passing
4.Computer networksHard

With sliding-window protocols, how does Go-Back-N differ from Selective Repeat after one frame is lost?

  1. ABoth resend the whole window from the start
  2. BGo-Back-N resends only the lost frame; Selective Repeat resends that frame and all later ones
  3. CGo-Back-N resends the lost frame and all later ones; Selective Repeat only the lost one
  4. DNeither ever resends lost frames
5.Number systemsMedium
8-bit two's complement0−12806403201608040201

Set the bits so they store −64 in 8-bit two's complement. Read as an unsigned number, what is the pattern's value U?

N = −648 bit
U =
6.Number systemsHard
click the bits to set them012806403201608040201

Set the bits to the 8-bit result of 0001 1110 OR 0101 0100. What is the result's value R in decimal?

0001 1110OR0101 0100
R =

3Solutions

1.IPv4 subnetting

Answer: N = 4

IPv4 subnetting: an address has 32 bits. The prefix /p says how many leading bits identify the network; the remaining 32 − p bits number the hosts. A subnet has 2³²⁻ᵖ addresses, but the first (network address) and last (broadcast address) cannot be given to hosts, so 2³²⁻ᵖ − 2 hosts fit. Exceptions: a /31 (point-to-point link, RFC 3021) uses both of its 2 addresses for hosts, and a /32 is one single address (a single host or a loopback).

Borrowed bits

18 − 16 = 2

Number of subnets

N = 22 = 4

Answer

N = 4

Each /18 subnet has 214 − 2 = 16382 usable hosts.

2.IPv4 subnetting

Answer: x = 64

IPv4 subnetting: an address has 32 bits. The prefix /p says how many leading bits identify the network; the remaining 32 − p bits number the hosts. A subnet has 2³²⁻ᵖ addresses, but the first (network address) and last (broadcast address) cannot be given to hosts, so 2³²⁻ᵖ − 2 hosts fit. Exceptions: a /31 (point-to-point link, RFC 3021) uses both of its 2 addresses for hosts, and a /32 is one single address (a single host or a loopback).

Block size

25 = 32

Subnet of this host

network: ⌊93/32⌋·32 = 64
broadcast: 64 + 32 − 1 = 95
usable hosts: 65 … 94

Answer

x = 64
3.Computer networks

Answer: B · CSMA/CD

Why this is the answer

Carrier sense multiple access with collision detection: stations stop when they detect a collision and retry after a random backoff. Full-duplex switched Ethernet has no collisions.

Answer

B · CSMA/CD
4.Computer networks

Answer: C · Go-Back-N resends the lost frame and all later ones; Selective Repeat only the lost one

Why this is the answer

A Go-Back-N receiver discards out-of-order frames, so the sender must repeat everything after the loss. Selective Repeat buffers them and asks only for the missing one.

Answer

C · Go-Back-N resends the lost frame and all later ones; Selective Repeat only the lost one
5.Number systems

Answer: U = 192

Setting bits: each bit is worth a power of two (128, 64, …, 1). One hex digit is exactly four bits, and in 8-bit two's complement the leftmost bit is worth −128. Bitwise operations work on each bit position separately.

Invert and add one

64 = 0100 0000
inverted: 1011 1111
+1 → 1100 0000

Read it as unsigned

1100 0000₂ = 256 − 64 = 192

Answer

U = 192
6.Number systems

Answer: R = 94

Setting bits: each bit is worth a power of two (128, 64, …, 1). One hex digit is exactly four bits, and in 8-bit two's complement the leftmost bit is worth −128. Bitwise operations work on each bit position separately.

Bit by bit

OR gives 1 where at least one bit is 1.

0001 1110
OR 0101 0100
= 0101 1110

Value of the result

0101 1110₂ = 94

Answer

R = 94

ExamProblems · examproblems.com/courses/computer-networks