1. LPU MCA Semester 1
  2. CAP7001
  3. Unit 1

CAP7001 · Unit 1: Network basics

TCP/IP protocol suite and addressing in layers

13 practice questions · in the MTE and ETE syllabus

Key points

  • MAC 48 bits (data link), IP 32 bits (network), port 16 bits (transport)
  • TCP/IP application layer = OSI session + presentation + application
  • MAC changes per hop; IP stays end to end
  • IPv4 octets range 0 to 255

The TCP/IP suite is organised (in Forouzan) into five layers: physical, data link, network, transport and application. Its application layer covers the OSI session, presentation and application layers.

Four levels of address are used:

AddressSizeLayerIdentifies
Physical (MAC)48 bitsData linkA NIC on one link
Logical (IP)32 bits (IPv4)NetworkA host on the internet
Port16 bitsTransportA process on a host
Specific (URL, e-mail)TextApplicationA user-level resource

Worked example: a packet from host A crosses three routers to host B, so four links carry four frames. The destination MAC differs on each link (router 1, router 2, router 3, B) while the destination IP stays B's throughout.

Exam pitfall: MAC addresses change at every hop; IP addresses stay the same end to end (without NAT). A valid dotted-decimal IPv4 address has four bytes, each from 0 to 255.

Try two questions

Question 1 · Tier 4, Analyse

Host H has two browser tabs open to the same web server S on port 80. Tab 1 uses source port 50001 and tab 2 uses source port 50002. A segment from S arrives at H with destination port 50002. What does the transport layer of H do?

  1. It delivers the data to the process of tab 1, because that tab connected to S first
  2. It delivers the data to the process of tab 2, the one using that number
  3. It uses the destination IP address to pick the tab, since each tab has its own IP address
  4. It sends the segment to the network layer so the MAC address can select the tab
Show the answer

B. Port numbers identify the process at each host, so destination port 50002 selects tab 2. Both tabs share one IP address and one MAC address, so neither can tell them apart.

Why not A: Arrival order does not decide delivery; the destination port does.

Why not C: Both tabs share the single IP address of host H, so it cannot separate them.

Why not D: The MAC address identifies the network card and the data link layer sits below the transport layer.

Question 2 · Tier 3, Apply

Port numbers are 16-bit values from 0 to 65535, and ports 0 to 1023 are the well-known ports. How many port numbers lie in the range 1024 to 65535?

  1. 64511 ports
  2. 65536 ports
  3. 64513 ports
  4. 64512 ports
Show the answer

D. The range 1024 to 65535 is inclusive, so it holds 65535 - 1024 + 1 = 64512 ports. Off-by-one errors on an inclusive range are the usual trap.

Why not A: That subtracts without adding 1 for the inclusive end point.

Why not B: That is the total number of ports, including the well-known ones.

Why not C: That adds 1 twice, as if both ends were counted separately.