KS5H446 1.3.3 and 1.3.4 36 min read 10 question quiz 24 exam marks

Networks and Web Technologies

The TCP/IP stack, packet switching, DNS, client server and peer to peer, HTML, CSS and JavaScript, search indexing and PageRank.

Networks and protocols

The TCP/IP stack

LayerResponsibilityProtocols
ApplicationProvides services to user software and formats dataHTTP, HTTPS, FTP, SMTP, IMAP, POP3, DNS
TransportSplits data into segments, adds port numbers, ensures reliable deliveryTCP, UDP
Network or InternetAdds source and destination IP addresses, routes packets across networksIP, ICMP
Link or Data linkHandles physical transmission on the local medium, adds MAC addressesEthernet, Wi-Fi

Data passes down the stack at the sender, gaining a header at each layer, and up the stack at the receiver, with each header removed by the corresponding layer. This is encapsulation.

Why layering: each layer can be developed, replaced or upgraded independently; hardware and software from different manufacturers interoperate provided they follow the rules of their layer; faults can be isolated to a single layer.

TCP against UDP. TCP is connection oriented, guaranteeing delivery, ordering and error checking, at the cost of overhead. UDP is connectionless with no guarantee of delivery or order, which makes it faster and therefore preferred for live video, voice and gaming, where a late packet is worse than a missing one.

Packet switching and circuit switching

Packet switching divides data into packets, each carrying source and destination addresses and a sequence number, routed independently and reassembled at the destination.

  • Efficient use of the network, since capacity is shared
  • Resilient, because packets route around failures
  • Variable delay, and packets may arrive out of order

Circuit switching establishes a dedicated path for the duration of the communication.

  • Consistent quality and guaranteed bandwidth
  • Wasteful, since the circuit is reserved even when nothing is being sent

DNS

The Domain Name System resolves human readable names to IP addresses through a hierarchy of servers: root servers, then top level domain servers such as .uk, then authoritative name servers for the specific domain. Results are cached at every level, which is why a repeated lookup is almost instant.

Network security and hardware

  • Firewalls filter traffic against rules. Packet filtering examines headers, while stateful inspection tracks whole connections and is more effective.
  • A proxy server sits between clients and the internet, hiding client addresses, caching frequently requested content, and filtering requests.
  • Network address translation allows many devices to share one public IP address.
  • Client server centralises resources, backup and control but creates a single point of failure and a potential bottleneck. Peer to peer distributes load with no single point of failure but has no central management or backup, and performance depends on which peers are online.
The four layer TCP/IP model and packet encapsulationThe four layer TCP/IP model, drawn top to bottom with the growing packet beside it. The application layer handles protocols such as HTTP, HTTPS, FTP, SMTP and IMAP, and produces the raw data. The transport layer, using TCP, splits that data into packets and adds a header carrying port numbers, so the packet is now a TCP header followed by data. The internet layer adds an IP header carrying the source and destination IP addresses, so the packet is an IP header, a TCP header and the data. The link layer, Ethernet or Wi-Fi, adds a frame header carrying MAC addresses and a frame end, giving frame header, IP header, TCP header, data, frame end. Each layer wraps the one above it in its own header, and the receiving computer unwraps the layers in reverse order.ApplicationHTTP, HTTPS, FTP, SMTP, IMAPTransportTCP splits data into packets, adds port numbersInternetIP adds source and destination IP addressesLinkEthernet or Wi-Fi, adds MAC addressessendingDataTCPDataIPTCPDataFrameIPTCPDataEndeach layer wraps the layer above in its own headerthe receiver unwraps them in the reverse order
Layers are independent. Changing from Wi-Fi to Ethernet swaps the link layer only, and nothing above it has to change.
The TCP/IP model: a message wrapped on the way down and unwrapped on the way upTwo stacks of four layers, the sender's on the left and the receiver's on the right, with the data between them. At the application layer, where HTTP, HTTPS, SMTP, IMAP and FTP live, the data is just the message. The transport layer splits it into segments and adds a TCP or UDP header carrying the port number. The internet layer wraps each segment in a packet and adds the source and destination IP addresses used for routing. The link layer wraps the packet in a frame carrying MAC addresses and a check value, and puts it on the cable or the wireless link. At the receiving computer the same four layers run in reverse: each strips off the wrapper it recognises and hands the rest up, so the application receives exactly the message that was sent. No layer needs to know how another layer does its job, which is the whole reason the model is split up this way.chatSenderchatReceiverWhat is on the wireApplicationHTTP · SMTP · DNSApplicationshows the pageDATAmessage80TransportTCP · UDP · ports80Transportputs the pieces in orderTCPDATAsegmentInternetIP · addressesInternetchecks it is for meIPTCPDATApacketLinkWi-Fi · Ethernet · MACLinkreads the frameMACIPTCPDATAFCSframecable or Wi-Fi: bits on the wire12345
  1. Your message starts at the top, in the application.
  2. Transport splits it into segments and adds a port number.
  3. Internet wraps each segment in a packet and adds IP addresses.
  4. Link turns the packet into a frame with MAC addresses, and it goes out.
  5. At the other end the same four layers run in reverse, unwrapping it.
Each layer wraps what the layer above handed it, and knows nothing about what is inside. That is why you can change the wifi for a cable without rewriting the web browser.

Web technologies

HTML, CSS and JavaScript

HTML defines structure and content. CSS defines presentation. JavaScript provides behaviour and runs in the browser.

HTML
<div id="quiz" class="panel">
  <h2>Question 1</h2>
  <button onclick="check()">Submit</button>
</div>
CSS
.panel { border: 1px solid #ccc; padding: 1rem; }
#quiz  { background: #f4f4f4; }
JAVASCRIPT
function check() {
  const panel = document.getElementById("quiz");
  panel.classList.add("answered");
}

Client side and server side processing

Client sideServer side
Runs onThe user's browserThe web server
SpeedImmediate, no round trip neededRequires a request and response
Server loadReducedIncreased
SecurityCan be viewed and altered by the user, so never trust it aloneCode and data are hidden from the user
Typical useForm validation for usability, interface effects, animationAuthentication, database access, payment, authoritative validation
The rule that matters

Client side validation improves the experience by giving immediate feedback. Server side validation provides the security, because a user can disable JavaScript or send a crafted request directly. Validate on both, and trust only the server.

Search engine indexing

A web crawler follows links from page to page, retrieving content. Each page is analysed and added to an index mapping words to the pages containing them, along with position and prominence information. When a query arrives, the index is consulted rather than the web itself, which is what makes results appear instantly rather than after a search of billions of pages.

robots.txt lets a site request that crawlers avoid particular paths.

PageRank

PageRank orders results by importance, estimated from the link structure of the web.

  • A link to a page counts as a vote for it
  • Votes from pages that are themselves important count for more
  • A page's outgoing votes are divided among the pages it links to, so a page linking to a thousand others confers little on each
  • A damping factor, typically 0.85, models a user eventually stopping following links, and keeps the calculation convergent

PR(A) = (1 - d) + d ( PR(T1)/C(T1) + ... + PR(Tn)/C(Tn) )

where d is the damping factor, T1 to Tn are pages linking to A, and C(T) is the number of outgoing links from T.

The calculation is iterative: every page starts with an equal rank and the formula is applied repeatedly until the values converge.

What happens between typing a web address and seeing the pageYou type a domain name, which is written for people to remember, but routers only understand IP addresses, so the browser first has to translate it. It asks a DNS server, which works like a phone book for the internet, and the DNS server returns the IP address that the name belongs to. The browser then sends an HTTP request to that address asking for the page. The web server answers with the files the page is made of: HTML, CSS, images and scripts. The browser puts them together and draws the page on the screen. DNS only tells the browser where to go; the browser makes the journey itself.www.example.comDNSthe internet's phone bookweb server93.184.216.34Where is example.com?It is 93.184.216.34GET /index.htmlHTMLCSSJSIMGthe files the page is made of12345
  1. You type an address. The browser needs the IP address behind the name.
  2. A DNS server looks up the name and returns the IP address.
  3. The browser sends an HTTP request to that address.
  4. The server sends back HTML, CSS, images and scripts.
  5. The browser renders them into the page you see.
DNS is a lookup, not a delivery. It tells the browser where to go, and the browser goes there itself.
Client side processing in the browser against server side processing on the serverWeb applications split their work between two places. On the client side, in the browser, HTML gives the structure, CSS the style and JavaScript the behaviour. It runs on the user's own device, so feedback is at once with no trip to the server, for example checking an email address as it is typed. On the server side, code in a language such as Python or PHP runs on the company's machine and talks to the database. Its code stays private, it shares data between users and it does the secure checks. The browser sends a request and the server sends back a response. Client side code can be seen and changed by the user, so it should never be trusted for security, while server side code cannot be seen.In the browser: client side1HTMLstructureCSSstyleJavaScriptbehaviourEmail: sam@typed so farruns on the user's devicefeedback at once: no trip to the serverOn the server: server side2databasePython or PHPruns on the company's machineprivate code, shared data, secure checksrequestresponseClient sideServer side3The user cansee and change itnot see itGood forinstant checks and animationpasswords and shared dataNever trust it forsecurityspeed of feedback
  1. Client side code runs in the browser: HTML for structure, CSS for style, JavaScript for behaviour. It gives instant feedback.
  2. Server side code runs on the server and uses the database. The user cannot see it, so it does the secure checks.
  3. The user can see and change client side code, so never trust it for security.
Validate on the client for a better experience, and validate again on the server for security.

Key terms you must be able to define

TCP/IP stack
A four layer model organising network protocols into application, transport, network and link layers.
Encapsulation
Adding a header at each layer as data passes down the stack, removed at the corresponding layer on receipt.
TCP
A connection oriented transport protocol guaranteeing delivery, ordering and error checking.
UDP
A connectionless transport protocol with no delivery guarantee, used where speed matters more than reliability.
Packet switching
Dividing data into independently routed packets reassembled at the destination.
Circuit switching
Establishing a dedicated path for the duration of a communication.
DNS
The hierarchical system resolving domain names into IP addresses.
Proxy server
A server sitting between clients and the internet, hiding addresses, caching and filtering.
Client side processing
Code executed in the user's browser, giving immediate response but no security.
Server side processing
Code executed on the web server, hidden from the user and therefore trustworthy.
Web crawler
A program following links to retrieve pages for indexing by a search engine.
PageRank
An algorithm ranking pages by importance derived from the link structure of the web.
Damping factor
A constant in PageRank modelling the probability that a user stops following links.

Flashcards

Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.

DefineTCP/IP stack
AnswerA four layer model organising network protocols into application, transport, network and link layers.
DefineEncapsulation
AnswerAdding a header at each layer as data passes down the stack, removed at the corresponding layer on receipt.
DefineTCP
AnswerA connection oriented transport protocol guaranteeing delivery, ordering and error checking.
DefineUDP
AnswerA connectionless transport protocol with no delivery guarantee, used where speed matters more than reliability.
DefinePacket switching
AnswerDividing data into independently routed packets reassembled at the destination.
DefineCircuit switching
AnswerEstablishing a dedicated path for the duration of a communication.
DefineDNS
AnswerThe hierarchical system resolving domain names into IP addresses.
DefineProxy server
AnswerA server sitting between clients and the internet, hiding addresses, caching and filtering.

Reach the top grade on this topic

  • Name all four TCP/IP layers with their protocols and describe encapsulation in both directions
  • Compare TCP and UDP and give a scenario where UDP is genuinely preferable
  • Explain why client side validation is never sufficient on its own
  • Explain PageRank as weighted votes divided by outgoing link count, not simply counting links
  • Explain the role of the damping factor rather than treating it as an arbitrary constant

Mistakes that cost marks here

Avoid these
  • Placing protocols at the wrong layer. HTTP is application, TCP is transport, IP is network.
  • Saying UDP is simply worse than TCP. For live video, a late packet is more damaging than a missing one.
  • Saying client side validation makes a form secure. It can be bypassed entirely.
  • Describing PageRank as counting inbound links. Votes are weighted and divided among outgoing links.
  • Confusing packet switching with circuit switching in a comparison question.
Fun fact

PageRank works by treating a link as a vote, but weights each vote by the importance of the page casting it. The mathematics is an eigenvector calculation on a matrix with billions of rows, and it made Google.

Knowledge check

0 of 10 answered
1At which layer of the TCP/IP stack does IP operate?
2What is encapsulation in networking?
3When is UDP preferable to TCP?
4What is the main advantage of packet switching over circuit switching?
5Why is client side validation not sufficient for security?
6In PageRank, why does a page linking to a thousand others confer little rank on each?
7What does the damping factor model in PageRank?
8What does a proxy server do?
9What does a web crawler do?
10Which is a disadvantage of the client server model?
Score 0 / 10

Exam-style questions

Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.

24 marks
1Describe the function of each layer of the TCP/IP stack.4 marks
Describe

Mark scheme0 / 4
  • LThe application layer provides services to user software and formats data
  • LThe transport layer splits data into segments and ensures reliable delivery
  • LThe network layer adds IP addresses and routes packets between networks
  • LThe link layer handles physical transmission and uses MAC addresses
Model answer

The application layer is where the protocols used directly by software operate, such as HTTP for web pages and SMTP for sending mail, and it is responsible for formatting the data appropriately for the service being used. The transport layer takes that data and divides it into segments, adding port numbers so the receiving machine knows which application the data belongs to, and where TCP is used it also numbers the segments and manages acknowledgements and retransmission to guarantee complete, correctly ordered delivery. The network layer, sometimes called the internet layer, attaches the source and destination IP addresses and is responsible for routing each packet across the intervening networks towards its destination. The link layer handles the actual transmission over the physical medium, adding MAC addresses so that frames reach the correct device on the local network, and it is where Ethernet and Wi-Fi operate.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
2Explain why a live video call would use UDP rather than TCP.4 marks
Explain

Mark scheme0 / 4
  • LUDP is connectionless and does not guarantee delivery or ordering
  • LThis reduces overhead so data arrives with lower latency
  • LIn a live call a retransmitted packet would arrive too late to be useful
  • LA small amount of lost data causes a brief glitch, which is preferable to delay
Model answer

UDP is connectionless: it sends datagrams without establishing a connection, without acknowledgements and without retransmitting anything that is lost, so it carries far less overhead than TCP and delivers data with noticeably lower latency. That matters enormously in a live call, where the total delay between speaking and being heard determines whether a conversation is usable at all. The decisive point is what would happen if TCP were used instead. If a packet carrying a fiftieth of a second of audio were lost, TCP would detect the gap and retransmit it, but by the time the replacement arrived that moment in the conversation would already have passed, so the retransmitted data is worthless while the stall waiting for it is very noticeable. With UDP the missing fragment simply produces a momentary glitch that the human ear largely ignores, and the call continues smoothly. In short, for live media a small amount of loss is far preferable to delay, which is precisely the trade UDP makes.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
3Explain the difference between client side and server side processing, and state why validation should be performed on both.5 marks
Explain

Mark scheme0 / 5
  • LClient side code runs in the user's browser
  • LServer side code runs on the web server
  • LClient side gives immediate feedback without a round trip to the server
  • LClient side code can be viewed, disabled or altered by the user
  • LServer side validation is authoritative because the user cannot bypass it
Model answer

Client side processing is code, usually JavaScript, that is downloaded and executed by the user's own browser, whereas server side processing runs on the web server and only the results are sent to the client. The advantage of client side processing is responsiveness: a form field can be checked the moment the user leaves it, with no request to the server and no waiting, which makes the interface feel immediate and reduces load on the server. The critical weakness is that anything running on the user's machine is entirely under their control. They can read the source, disable JavaScript altogether, modify the code with browser developer tools, or bypass the page completely and send a crafted request directly to the server. Client side validation therefore provides usability but no security whatsoever. Server side validation is authoritative because the user cannot alter or bypass it, and it is the only check that can be trusted to protect the database from invalid or malicious data. Both are used together: client side for a good experience, server side because it is the only one that actually enforces anything.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
4Explain how the PageRank algorithm determines the importance of a web page.5 marks
Explain

Mark scheme0 / 5
  • LA link from one page to another is treated as a vote for the target page
  • LVotes from pages that are themselves important carry more weight
  • LA page's vote is divided among all the pages it links to
  • LA damping factor models the probability that a user stops following links
  • LThe calculation is iterative, repeated until the values converge
Model answer

PageRank estimates the importance of a page from the structure of links pointing at it, treating each incoming link as a vote of confidence. Crucially the votes are not counted equally: a link from a page that is itself highly ranked contributes far more than a link from an obscure one, so the rank of a page depends recursively on the ranks of the pages linking to it. Each page's voting power is also divided among all the pages it links out to, so a page with a thousand outgoing links passes only a thousandth of its rank to each, which prevents importance being manufactured simply by linking to everything. A damping factor, conventionally 0.85, is applied to model the probability that a person following links eventually stops and starts somewhere new, and it also guarantees that the mathematics converges rather than concentrating all rank in a small group of pages. Because each page's rank depends on others which are themselves being calculated, the algorithm is iterative: every page begins with an equal rank, the formula is applied to every page, and this repeats until the values stop changing significantly.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
5Compare the client server and peer to peer network models.6 marks
Compare

Mark scheme0 / 6
  • LClient server has dedicated servers providing resources to clients
  • LPeer to peer has all machines acting as both client and server
  • LClient server allows central backup, security and account management
  • LClient server has a single point of failure and can become a bottleneck
  • LPeer to peer is cheaper with no dedicated server and distributes load
  • LPeer to peer has no central backup or management and depends on which peers are online
Model answer

In a client server network, dedicated server machines provide resources and services which client machines request, so files, authentication and applications are centralised. In a peer to peer network every machine is an equal that acts as both client and server, sharing its own resources directly with the others. The client server model's strength is control: data can be backed up centrally in one place, user accounts and permissions are administered from a single point, and software updates and security policies are applied consistently across the whole network, which is essential once an organisation grows beyond a handful of machines. Its weaknesses are cost and dependency, since server hardware and specialist staff are expensive, the server represents a single point of failure whose loss affects every user, and it can become a bottleneck if demand exceeds what it can serve. Peer to peer inverts this. It is cheap to set up because there is no server to buy, load is naturally distributed across the participants so it scales well as more peers join, and there is no single point of failure. In exchange it offers no central backup, so data protection depends on each user individually, no central management of security or updates, and availability depends entirely on which peers happen to be switched on, so a file may simply be unreachable. In practice client server suits organisations needing control and reliability, while peer to peer suits small informal networks and distributed content sharing.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.
Machine mark 0 / 24