How unit 2 is examined
Covers HTML markup, forms, lists, XHTML, frames, HTML5 WebSockets, cookies and browser basics; marks sit in forms, HTML vs XHTML, lists, frames, WebSockets and short notes (HTML5, cookies, DTD, tags).
Basics of HTML
Not asked since 2022
Definition. HTML (HyperText Markup Language) is the standard markup language that describes the structure of a web page using tags interpreted by the browser.
Key points.
- A tag is written in angle brackets, usually as an opening and closing pair such as
<p>...</p>; empty tags like<br>have no closing tag. - Attributes give extra information inside the opening tag, as in
<a href="x.html">. - Every page has
<!DOCTYPE html>,<html>,<head>(title, meta) and<body>(visible content). - The DOCTYPE declaration tells the browser which HTML version rules to follow.
<!DOCTYPE html>
<html><head><title>Demo</title></head>
<body><h1>Hello</h1><p>Text</p></body></html>
Asked: [14 marks] (Nov 2023) Short notes: HTML Tags, DTD (any two of HTML5, Session tracking and Cookies, DTD, HTML Tags)
Formatting and fonts
Not asked since 2022
Definition. Formatting tags change how text looks: bold, italic, size and font.
Key points.
<b>/<strong>give bold,<i>/<em>italic,<u>underline,<sub>/<sup>subscript and superscript.- Headings
<h1>to<h6>go from largest to smallest;<p>makes a paragraph and<br>a line break. <font face="Arial" size="4" color="red">set the font in old HTML; HTML5 uses CSS instead.<pre>keeps spaces and line breaks as typed.
Commenting code
Not asked since 2022
Definition. A comment is text in the source that the browser ignores, written <!-- comment -->.
Key points.
- Comments explain the code to developers and do not appear on the page.
- They can hide a block of markup temporarily while testing.
- Comments can span several lines but cannot be nested.
Color
Not asked since 2022
Definition. Colors are given by name, hex code or RGB value.
Key points.
- A hex code is
#RRGGBB, two hexadecimal digits each for red, green, blue:#FF0000is red,#000000black,#FFFFFFwhite. rgb(0,128,0)gives each channel from 0 to 255; there are also 140 named colors such asblue.- Old attributes were
bgcolorandtext; todaystyle="color:red"is used.
Hyperlink
Not asked since 2022
Definition. A hyperlink is a clickable link to another page or place, made with the anchor tag <a href="url">text</a>.
Key points.
hrefholds the destination; it may be an absolute URL or a relative path.target="_blank"opens the link in a new window.- A bookmark link uses
id="top"on the target andhref="#top"on the anchor. mailto:in href opens the mail client, as in<a href="mailto:[email protected]">.
Lists
Low weight
Definition. HTML list tags group items: <ul> unordered (bullets), <ol> ordered (numbers), <dl> definition list with <dt> term and <dd> description; <li> marks each item of ul and ol.
Key points.
<ol type="A|a|I|i|1" start="3">changes numbering style and start;<ul type="disc|circle|square">changes the bullet.- Lists can be nested by placing a list inside an
<li>.
<ul><li>Tea</li><li>Coffee</li></ul>
<ol type="I"><li>HTML</li><li>CSS</li></ol>
<dl><dt>HTML</dt><dd>Markup language</dd></dl>
Output: two bullets; a list numbered I, II; the term HTML with its indented description.
Asked: [7 marks] (Nov 2023) Define HTML List tags. Write the HTML program that describes various types of lists with suitable example.
Tables
Not asked since 2022
Definition. A table arranges data in rows and columns using <table>, <tr> (row), <th> (heading cell) and <td> (data cell).
Key points.
border="1"draws borders;cellpaddingandcellspacingset space inside and between cells.colspanmerges cells across columns androwspanacross rows.<caption>gives the table a title.
Images
Not asked since 2022
Definition. The <img> tag embeds an image: <img src="a.jpg" alt="text" width="100" height="80">.
Key points.
srcis the file path andaltis the text shown if the image fails to load and read by screen readers.widthandheightset the display size.<img>is an empty tag; an image wrapped in<a>becomes a link.
Forms
Medium weight
Definition. An HTML form, made with <form>, collects user input through fields and sends it to a server for processing.
Key points.
<form action="url" method="get|post">:actionis the server program that receives the data;methodis how it is sent.- GET appends data to the URL (visible, limited size); POST sends it in the request body (hidden, for passwords and large data).
<input type="text">takes one line of text andtype="password"hides the characters typed.type="radio"(samename) lets one choice be selected;type="checkbox"allows several.<textarea>takes multi-line text and<select><option>gives a drop-down list.type="submit"sends the form,type="reset"clears it, andtype="button"runs a script.nameidentifies each field's value on the server, and<label>describes a field.
A form is a set of input fields inside the form tag whose action attribute names the server program and whose method attribute (GET or POST) says how the data is sent.
<html><body>
<form action="save.php" method="post">
<label>Name: </label><input type="text" name="uname"><br>
<label>Phone: </label><input type="text" name="phone"><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form></body></html>
Answer frame. Open with the definition; explain form, action and method first; then develop text, password, radio, checkbox, textarea/select, buttons each with a one-line tag example; close with the note that name attributes carry values to the server. For the program, write the full html-body-form skeleton with two labelled inputs (name, phone) and submit and reset buttons.
Asked: [7 marks] (Nov 2022) What are FORMS? Explain different FORM fields. Asked: [7 marks] (Nov 2022) Write an HTML document to provide a form that collect name (hammer) and phone numbers.
XHTML
Low weight
Definition. XHTML (Extensible HyperText Markup Language) is HTML rewritten to follow strict XML syntax; a document must be well-formed and is checked against a DTD (Document Type Definition) for validity.
| Point | HTML | XHTML |
|---|---|---|
| Closing tags | Some optional (<p>, <li>) |
All mandatory; empty tags <br /> |
| Case | Not case-sensitive | Tags and attributes lowercase |
| Nesting | Loose, errors tolerated | Properly nested |
| Attribute values | Quotes optional | Always quoted |
| Attribute minimising | <input checked> |
checked="checked" |
| Root and DOCTYPE | Optional <html> |
Root <html> with xmlns, DOCTYPE required |
| Errors | Browser forgives | Parser stops on error |
A DTD lists the elements and attributes allowed in a document; XHTML has Strict, Transitional and Frameset DTDs.
Asked: [7 marks] (Nov 2022) Discuss the difference between HTML and XHTML with respect to elements. Asked: [14 marks] (Nov 2023) Short note on DTD.
Meta tags
Not asked since 2022
Definition. Meta tags, placed in <head>, give information about the page to browsers and search engines.
Key points.
<meta name="description" content="...">andname="keywords"help search engine results.<meta charset="UTF-8">sets the character encoding.<meta http-equiv="refresh" content="5;url=x.html">redirects after 5 seconds.name="viewport"makes the page fit mobile screens.
Character entities
Not asked since 2022
Definition. A character entity is a code beginning with & and ending with ; that displays a reserved or special character.
Key points.
<shows <,>shows >,&shows &,"shows a quote. is a non-breaking space and©shows the copyright sign.- Entities are needed because < and > would otherwise start a tag; numeric forms like
©also work.
Frames and frame sets
Low weight
Definition. Frames divide the browser window into independent parts, each showing a separate HTML file; <frameset> defines the layout and <frame> each part. They are obsolete in HTML5.
Key points.
<frameset cols="30%,70%">makes vertical columns androws="..."makes horizontal rows; the frameset replaces<body>.<frame src="file.html" name="f1">loads a page;noresizeandscrollingcontrol behaviour.- A link with
target="f2"opens its page in the named frame.
<frameset cols="25%,75%">
<frame src="menu.html" name="left">
<frame src="main.html" name="right">
</frameset>
Output: the window shows the menu page in a left column (25%) and the main page on the right (75%). The HTML vs XHTML difference is in the XHTML table above.
Asked: [7 marks] (Nov 2023) Differentiate HTML and XHTML. Write the HTML program that includes HTML frames and frame set.
Browser architecture and Web site structure
Not asked since 2022
Definition. A browser is software that requests, receives and displays web pages; a web site is a collection of linked pages under one domain.
Key points.
- Browser parts are the user interface, browser engine, rendering engine, networking, JavaScript interpreter and data storage.
- Site structures are linear, hierarchical (tree from a home page) and web (freely linked).
- Good structure keeps navigation within a few clicks of the home page.
Web Sockets: Overview and features of HTML5
Low weight
Definition. A WebSocket is a persistent, full-duplex TCP connection between browser and server, opened by an HTTP handshake, over which both sides send messages at any time. HTML5 is the latest HTML version.
| Point | HTTP | WebSocket |
|---|---|---|
| Connection | Short-lived, new per request | One persistent connection |
| Communication | Request-response, client starts | Full-duplex, either side sends |
| State | Stateless | Stays open |
| Overhead | Headers on every request | Small frames after handshake |
| Use | Web pages, APIs | Chat, live scores, games |
| URL | http:// or https:// | ws:// or wss:// |
HTML5 features. New semantic tags (<header>, <nav>, <section>, <footer>), <audio> and <video> without plug-ins, <canvas> drawing, new form inputs (date, email), local storage and geolocation.
Answer frame. Open with the definition; draw the handshake; give the table; close with use cases.
A WebSocket keeps one persistent full-duplex connection open after an HTTP upgrade handshake, unlike HTTP's short-lived, stateless request-response.
Asked: [7 marks] (Nov 2023) Discuss how web socket connection is different from http connection in detail? Asked: [14 marks] (Nov 2023) Short note on HTML5 (any two of four).
MIME type and content encoding
Not asked since 2022
Definition. A MIME type (Multipurpose Internet Mail Extensions) names the kind of content sent, in the form type/subtype, given in the Content-Type header.
Key points.
- Examples:
text/html,image/png,application/json,video/mp4. - The browser uses MIME type to decide how to display or handle the file.
- Content encoding, e.g.
Content-Encoding: gzip, compresses the body to save bandwidth.
Session tracking and Cookies
Not asked since 2022
Definition. Session tracking keeps user identity across requests, since HTTP is stateless; a cookie is a small text file the server stores in the browser and sends back with each request.
Key points.
- A server sets a cookie with the
Set-Cookieheader; the browser returns it in theCookieheader. - Cookies hold a name, value, expiry, domain and path; limit is about 4 KB.
- Other methods: hidden form fields, URL rewriting and server-side sessions using a session ID.
- Cookies can be blocked by users and raise privacy concerns.
Asked: [14 marks] (Nov 2023) Short note on Session tracking and Cookies (any two of four).
Browser: Working of a Browser, Plug-ins; Search Engines
Not asked since 2022
Definition. A browser fetches a URL, parses the HTML into a DOM tree, applies CSS, lays out and paints the page.
Key points.
- Steps: DNS lookup, HTTP request, response, parse HTML, build render tree, layout, paint.
- A plug-in is add-on software (Flash, PDF reader) that lets the browser handle extra content types.
- A search engine (Google) crawls pages, indexes them and ranks results for a query.
Client Side Programming: Java Script, JavaScript Regular expressions, web servers
Not asked since 2022
Definition. JavaScript is a scripting language run by the browser to make pages interactive, embedded in the page with the script element.
Key points.
- It validates forms, handles events and changes the page through the DOM without contacting the server.
- A regular expression is a pattern for matching text, written
/^[0-9]{10}$/and tested with.test(str). - A web server (Apache, IIS) stores pages and answers HTTP requests from browsers.
Last-minute revision
- HTML is a markup language; tags are
<tag>pairs with attributes. - Form:
action= server program,method= GET (in URL) or POST (in body). - Input types: text, password, radio, checkbox, submit, reset.
- Lists:
ulbullets,olnumbers,dlwithdtanddd,liitems. - XHTML = HTML with XML rules: lowercase, closed, quoted, nested, well-formed.
- Frameset replaces body;
colsandrowssplit the window. - WebSocket: full-duplex, persistent, ws://, started by HTTP Upgrade.
- HTML5 adds semantic tags, audio, video, canvas, local storage.
- Cookie: small text stored in browser, sent via Cookie header.
- MIME type is
type/subtypein Content-Type. - Hex color is
#RRGGBB.
Memory hooks
- GET shows in the URL, POST hides in the body.
- XHTML = "X-treme strict": every tag closed, lowercase, quoted.
- ul = Unordered dots, ol = Ordered numbers, dl = Dictionary.
- WebSocket = telephone call; HTTP = letters.
- Entities: & then name then ; (
<).
Coverage checklist
- Basics of HTML: tags, DTD short note (Nov 2023)
- formatting and fonts
- commenting code
- color
- hyperlink
- lists: Nov 2023 list program
- tables
- images
- forms: Nov 2022 (explain fields; program)
- XHTML: Nov 2022 comparison; DTD note
- Meta tags
- Character entities
- frames and frame sets: Nov 2023 program and HTML vs XHTML
- Browser architecture and Web site structure
- Web Sockets: Overview and features of HTML5: Nov 2023 WebSocket vs HTTP; HTML5 note
- MIME type and content encoding
- Session tracking and Cookies: Nov 2023 short note
- Browser: Working of a Browser, Plug-ins; Search Engines
- Client Side Programming: Java Script, JavaScript Regular expressions, web servers