Networks · GCSE · OCR J277 1.3.1, Edexcel 1CP2 4.1.3 · about 20 min
The internet and the web, DNS, web servers and hosting, and the cloud.
[1 mark]What does DNS do?
[1 mark]Put the steps in order.
Number the lines 1 to 4 to put them in the right order.
The user types a URL into the browserThe browser asks a DNS server for the IP addressThe DNS server returns the IP addressThe browser requests the page from the web server[1 mark]What is the difference between the internet and the World Wide Web?
[1 mark]What is web hosting?
[1 mark]Which is a disadvantage of the cloud?
Two robots are on the mat: scout.bot and rover.bot. Look up scout.bot with the DNS robot, then take the IP address from its reply. Send to <address>: where and the Scout answers at <x>,<y>. Drive to about 13 cm in front of it, into the green square, without touching anything. The helpers ask, numbers_in, go_to and near are ready to use.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
import math
def ask(question, seconds=1.0):
# send a question and return the first reply that arrives within `seconds`, or None
send(question)
for tick in range(int(seconds * 10)):
wait(0.1)
for sender, text in messages():
return text
return None
def numbers_in(text):
# every number in a message, as floats: "at 25,55" -> [25.0, 55.0]
out = []
for word in text.replace(",", " ").split():
try:
out.append(float(word))
except ValueError:
pass
return out
def wrapped(h):
return (h + 180) % 360 - 180
def go_to(x, y, speed=60):
# one step of driving towards (x, y), measured from the start; call it in a loop
px, py = position()
a = math.radians(wrapped(math.degrees(math.atan2(x - px, y - py)) - heading()))
drive(speed * math.cos(a), speed * math.sin(a), wrapped(0 - heading()) * 3)
def near(x, y, cm=4):
px, py = position()
return math.hypot(x - px, y - py) < cmPlan your program here, then type it in and press Run.
rover.bot too, and print both robots' positions.