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
/24 → /2911111111111111111111111111111000network bitshost bits

The network 192.168.60.0/24 is divided into /29 subnets, numbered 1, 2, 3, … from the lowest address (subnet 1 starts at .0). What is the fourth octet x of the network address of subnet 7?

192.168.60.0/24/29subnet 7 (subnet 1 starts at .0)
x =
2.IPv4 subnettingHard
third octet = 254112816413211618141201networkhost

A host has the address 172.20.254.155/23. What is the third octet x of its subnet's broadcast address?

172.20.254.155/23
x =
3.Computer networksMedium

Which range of TCP/UDP port numbers is reserved as "well-known" ports?

  1. A0–65535
  2. B49152–65535
  3. C0–1023
  4. D1024–49151
4.Computer networksHard

Which routing protocol is a link-state protocol?

  1. AARP
  2. BRIP
  3. COSPF
  4. DBGP
5.Number systemsMedium
8-bit two's complement0−12806403201608040201

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

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

Set the bits to the 8-bit result of 0010 0110 OR 1111 0001. What is the result's value R in decimal?

0010 0110OR1111 0001
R =

3Solutions

1.IPv4 subnetting

Answer: x = 48

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

23 = 8

Subnet number 7

network: (7 − 1)·8 = 48
broadcast: 48 + 8 − 1 = 55

Answer

x = 48
2.IPv4 subnetting

Answer: x = 255

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 in the third octet

21 = 2

Subnet of this host

network: 172.20.254.0
broadcast: 172.20.255.255

Answer

x = 255
3.Computer networks

Answer: C · 0–1023

Why this is the answer

Ports 0–1023 are well-known ports for standard services. 1024–49151 are registered ports and 49152–65535 are dynamic or private ports.

Answer

C · 0–1023
4.Computer networks

Answer: C · OSPF

Why this is the answer

OSPF routers build a full map of the area and compute shortest paths with Dijkstra's algorithm. RIP is distance-vector; BGP is path-vector.

Answer

C · OSPF
5.Number systems

Answer: U = 154

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

102 = 0110 0110
inverted: 1001 1001
+1 → 1001 1010

Read it as unsigned

1001 1010₂ = 256 − 102 = 154

Answer

U = 154
6.Number systems

Answer: R = 247

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.

0010 0110
OR 1111 0001
= 1111 0111

Value of the result

1111 0111₂ = 247

Answer

R = 247

ExamProblems · examproblems.com/courses/computer-networks