Internet, HTML, CSS, JavaScript and server side
Topics: Internet history, ISPs and connectivity; WWW, browsers, URLs; HTML tags, forms, tables, CSS; JavaScript; server-side scripting; XML; search engines and security.
Internet, WWW and URLs
The web is documents and services on the internet reached by URLs: scheme://host:port/path?query#fragment. A browser looks up the host by DNS, sends an HTTP request and renders the response. Status codes: 200 OK, 301 moved permanently, 404 not found, 500 server error.
- URL: scheme, host, port, path, query
- DNS turns names into IP addresses
- 200, 301, 404, 500
Example: Name the parts of https://www.example.com:443/notes?page=2.
- Scheme https, host www.example.com, port 443.
- Path /notes, query page=2.
Answer: scheme, host, port, path, query
Example: What does status code 404 mean?
- The server was reached but the resource was not found.
- Not Found.
Answer: Not Found
HTML and CSS
HTML structures content with elements (headings, paragraphs, links, images, lists, tables, forms). CSS styles it; rules cascade, and more specific selectors win: inline > id > class > element. In the default content-box model, the total width = width + left and right padding + left and right border (+ margin outside).
- Specificity: inline > id > class > element
- Box: content + padding + border + margin
- <form>, <input>, <table>, <a href>
Example: A div has width 200px, padding 10px and a 2px border (content-box). How wide is it on screen?
- 200 + 2 × 10 + 2 × 2.
- = 224 px (plus any margin).
Answer: 224 px
Example: Which rule wins: #title { color: red } or .big { color: blue } on the same element?
- An id selector is more specific than a class.
- Red.
Answer: Red (#title)
JavaScript, server side and security
JavaScript runs in the browser (and on servers with Node.js). Its loose typing surprises: + joins strings, other arithmetic converts to numbers. Server-side code (PHP, Node.js, Python) builds pages and talks to databases. XML and JSON carry structured data. Security: HTTPS encrypts traffic; never build SQL from user text (use prepared statements); escape output to stop cross-site scripting.
- + with a string concatenates
- HTTPS encrypts
- Prepared statements and output escaping
Example: What are "5" + 3 and "5" − 3 in JavaScript?
- + with a string joins: "53".
- − converts to numbers: 2.
Answer: "53" and 2
Example: How do you prevent SQL injection in a login form?
- User input must never be pasted into the SQL text.
- Use parameterised (prepared) queries.
Answer: Prepared statements
The web runs on HTTP between browsers and servers; a URL has scheme, host, path and query. HTML structures pages with tags (h1, p, a, img, table, form), CSS styles them with selectors, and JavaScript adds client-side behaviour in the browser. A GET request sends data in the URL, while POST sends it in the body. Server-side languages such as PHP run before the page is sent. Cookies store small data on the client, and sessions on the server. XML has user-defined tags for data. HTTPS encrypts traffic with TLS.
- <a href> links; <img src> images; <ul>/<ol> lists.
- CSS id selector #x, class selector .x.
- JavaScript runs in the browser; PHP on the server.
- HTML form methods: GET, POST.
- Status: 200 OK, 404 Not Found, 500 Server Error.
Key formulas
- scheme://host:port/path?query
- color: red; (CSS rule)
Practice questions
The tag for a hyperlink is
- <a>
- <img>
- <link> only
- <p>
Show the answer
Answer: A. <a> Anchor.
CSS class selector begins with
- #
- .
- @
- $
Show the answer
Answer: B. . .class
CSS id selector begins with
- #
- .
- %
- &
Show the answer
Answer: A. # #id
JavaScript usually runs on the
- client
- printer
- DNS server
- router
Show the answer
Answer: A. client Browser.
PHP runs on the
- server
- mouse
- browser only
- printer
Show the answer
Answer: A. server Server-side.
HTTP 404 means
- OK
- not found
- server error
- redirect
Show the answer
Answer: B. not found Missing resource.
GET sends form data in the
- URL
- body only
- cookie only
- file
Show the answer
Answer: A. URL Query string.
XML tags are
- user-defined
- fixed like HTML
- only numbers
- binary
Show the answer
Answer: A. user-defined Extensible.
A cookie is stored on the
- client
- router
- DNS root
- keyboard
Show the answer
Answer: A. client Browser.
An ISP is
- an Internet service provider
- an image software pack
- an input signal port
- an index search page
Show the answer
Answer: A. an Internet service provider Access company.
The practice questions were written for this studio; they are not copied from ASTU papers. ASTU publishes no topic syllabus for these exams, so the topics are an informed guide based on diploma courses, not an official list.