Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

Explain the structure of an HTML5 document. Discuss the different ways of applying CSS (inline, internal, external) with examples and explain the CSS box model.

Structure of an HTML5 Document

Every HTML5 page begins with the <!DOCTYPE html> declaration and consists of a root <html> element containing a <head> (metadata) and a <body> (visible content).

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Page</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header>...</header>
  <nav>...</nav>
  <main>
    <article>...</article>
    <section>...</section>
  </main>
  <footer>...</footer>
</body>
</html>
  • <!DOCTYPE html> tells the browser to render in standards mode.
  • <head> holds metadata: character set, viewport, title, links to CSS/JS.
  • <body> holds the content. HTML5 introduced semantic elements (<header>, <nav>, <main>, <article>, <section>, <aside>, <footer>) that describe the meaning of regions, improving accessibility and SEO.

Ways of Applying CSS

1. Inline CSS — using the style attribute on a single element. Highest specificity, but not reusable.

<p style="color:red; font-size:18px;">Hello</p>

2. Internal (embedded) CSS — inside a <style> block in <head>. Applies to one document only.

<head>
  <style>
    p { color: blue; margin: 10px; }
  </style>
</head>

3. External CSS — a separate .css file linked with <link>. Best practice: reusable across many pages and cacheable.

<link rel="stylesheet" href="style.css">
/* style.css */
p { color: green; }

Cascade order when rules conflict: inline > internal/external (by specificity and source order), with !important overriding the rest.

CSS Box Model

Every element is rendered as a rectangular box made of four nested areas, from inside out:

LayerMeaning
ContentThe actual text/image (width, height).
PaddingTransparent space between content and border.
BorderLine surrounding the padding.
MarginTransparent space outside the border, separating boxes.
+-----------------------------+   <- margin
|   +---------------------+   |
|   |     border          |   |
|   |  +--------------+    |   |
|   |  |  padding     |    |   |
|   |  |  +--------+  |    |   |
|   |  |  |content |  |    |   |
|   |  |  +--------+  |    |   |
|   |  +--------------+    |   |
|   +---------------------+   |
+-----------------------------+

With the default box-sizing: content-box, total rendered width = width + 2*padding + 2*border + 2*margin. Setting box-sizing: border-box makes width/height include padding and border, which simplifies layout calculations.

htmlcss
2long10 marks

Explain the HTTP protocol. Describe the structure of an HTTP request and HTTP response message with the common HTTP methods and status codes.

HTTP Protocol

HTTP (HyperText Transfer Protocol) is the application-layer, request–response protocol used by the World Wide Web for transferring hypermedia (HTML pages, images, JSON, etc.). It runs over TCP (default port 80; HTTPS over TLS uses port 443) and is stateless — each request is independent, so state is maintained externally using cookies, sessions, or tokens.

Structure of an HTTP Request

An HTTP request has three parts:

GET /index.html HTTP/1.1          <- Request line (method, URI, version)
Host: www.example.com             <- Headers
User-Agent: Mozilla/5.0
Accept: text/html
                                  <- Blank line
(body, e.g. form data for POST)   <- Optional message body
  1. Request line — HTTP method, the target resource (URI), and the protocol version.
  2. Headers — key:value metadata (Host, Accept, Content-Type, Authorization, etc.).
  3. Blank line then an optional body (used by POST/PUT to carry data).

Structure of an HTTP Response

HTTP/1.1 200 OK                   <- Status line (version, code, reason phrase)
Content-Type: text/html           <- Headers
Content-Length: 1024
Date: Mon, 04 Jun 2026 10:00:00 GMT
                                  <- Blank line
<html>...</html>                  <- Message body
  1. Status line — version, status code, reason phrase.
  2. HeadersContent-Type, Content-Length, Set-Cookie, etc.
  3. Blank line then the body (the requested resource).

Common HTTP Methods

MethodPurpose
GETRetrieve a resource (safe, idempotent).
POSTSubmit data to create a resource.
PUTCreate/replace a resource (idempotent).
DELETERemove a resource.
HEADLike GET but returns headers only.
PATCHApply a partial update.

Common Status Codes

ClassCodeMeaning
1xx Informational100Continue
2xx Success200 OK, 201 CreatedRequest succeeded
3xx Redirection301 Moved Permanently, 302 Found, 304 Not ModifiedFurther action / cache
4xx Client error400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not FoundClient fault
5xx Server error500 Internal Server Error, 502 Bad Gateway, 503 Service UnavailableServer fault
http
3long10 marks

Differentiate between DTD and XSD. Write an XSD schema for an XML document describing a list of books.

DTD vs XSD

Both define the legal structure of an XML document, but they differ significantly:

FeatureDTD (Document Type Definition)XSD (XML Schema Definition)
SyntaxUses its own non-XML grammarWritten in XML itself
Data typesNo built-in data types (everything is text/CDATA)Rich built-in types: string, integer, date, decimal, plus custom types
NamespacesNot supportedFully supported
Cardinality / occurrenceLimited (?, *, +)Precise via minOccurs / maxOccurs
ExtensibilityNot easily extensibleSupports inheritance, restriction, extension
ParsingParsed differently from XMLParsed by any XML parser

In short, XSD is more powerful, supports data typing and namespaces, and is itself valid XML, whereas DTD is simpler and older.

XSD Schema for a List of Books

Sample XML being described:

<books>
  <book>
    <title>Web Technology</title>
    <author>R. Sharma</author>
    <price>450.00</price>
    <year>2078</year>
  </book>
</books>

Corresponding XSD:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="books">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="book" maxOccurs="unbounded" minOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="title"  type="xs:string"/>
              <xs:element name="author" type="xs:string"/>
              <xs:element name="price"  type="xs:decimal"/>
              <xs:element name="year"   type="xs:gYear"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>

Here <books> is a complex element containing one or more <book> elements (maxOccurs="unbounded"), each with strongly-typed child elements.

xml-schema
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

Explain arrays in PHP. Differentiate between indexed, associative and multidimensional arrays with examples.

Arrays in PHP

A PHP array is an ordered map that associates keys with values; it can act as a list, dictionary, stack, or tree. Arrays are created with array() or the [] literal. PHP has three main kinds:

1. Indexed (numeric) array — keys are auto-assigned integers starting at 0.

$fruits = array("apple", "banana", "mango");
echo $fruits[1];   // banana

2. Associative array — uses named (string) keys instead of numeric indices.

$age = array("Ram" => 20, "Sita" => 22);
echo $age["Sita"];   // 22

3. Multidimensional array — an array whose elements are themselves arrays (array of arrays), used for tables/matrices.

$students = array(
  array("Ram", 20),
  array("Sita", 22)
);
echo $students[1][0];   // Sita

Difference summary: indexed arrays are accessed by integer position, associative arrays by meaningful string keys, and multidimensional arrays store nested arrays to represent multi-level/tabular data.

php-arrays
5short5 marks

Explain user-defined functions in PHP with examples of passing arguments by value and by reference.

User-Defined Functions in PHP

A user-defined function is a reusable named block of code declared with the function keyword. It may take parameters and may return a value, helping modularize a program and avoid repetition.

function greet($name) {
    return "Hello, " . $name;
}
echo greet("Ram");   // Hello, Ram

Passing Arguments by Value

By default arguments are passed by value — a copy is sent, so changes inside the function do not affect the original variable.

function addOne($n) {
    $n = $n + 1;
}
$x = 5;
addOne($x);
echo $x;   // 5  (unchanged)

Passing Arguments by Reference

Prefixing the parameter with & passes the variable by reference, so the function operates on the original and changes persist.

function addOne(&$n) {
    $n = $n + 1;
}
$x = 5;
addOne($x);
echo $x;   // 6  (modified)

Key difference: by value works on a copy (safe, original preserved); by reference works on the original variable (changes are reflected outside the function).

php-functions
6short5 marks

Explain the structure of a URL and the role of DNS in resolving domain names.

Structure of a URL

A URL (Uniform Resource Locator) is the address used to locate a resource on the web. Its general form is:

scheme://host:port/path?query#fragment
https://www.example.com:443/products/index.php?id=10&cat=web#reviews
PartExampleRole
Scheme/ProtocolhttpsProtocol to use (http, https, ftp).
Host/Domainwww.example.comServer name (resolved by DNS).
Port443Port number (optional; defaults per scheme).
Path/products/index.phpLocation of the resource on the server.
Query string?id=10&cat=webParameters as key=value pairs.
Fragment#reviewsAnchor to a section within the page.

Role of DNS in Resolving Domain Names

Computers communicate using IP addresses, but humans use domain names. DNS (Domain Name System) is a distributed, hierarchical database that translates a domain name into its IP address.

Resolution steps:

  1. The browser checks its local/OS cache for the name.
  2. If not found, it queries the configured DNS resolver (usually the ISP's).
  3. The resolver queries the root name server, which directs it to the TLD server (e.g. .com).
  4. The TLD server points to the domain's authoritative name server.
  5. The authoritative server returns the IP address, which is cached and returned to the browser.
  6. The browser then opens a connection to that IP to fetch the page.

Thus DNS acts as the "phonebook of the Internet," letting users type readable names instead of numeric IP addresses.

url-dns
7short5 marks

Differentiate between the GET and POST methods of submitting form data.

GET vs POST

Both are HTTP methods used to submit HTML form data, but they differ:

AspectGETPOST
Data locationAppended to the URL as a query string (?name=value)Sent in the HTTP request body
VisibilityVisible in the address bar, browser history, server logsNot shown in the URL
Data size limitLimited by URL length (~2 KB)Practically unlimited (large data, file uploads)
SecurityLess secure for sensitive dataMore secure (data not in URL), still needs HTTPS
Caching / bookmarkingCan be cached and bookmarkedNot cached or bookmarked by default
IdempotencyIdempotent and safe (only retrieves)Not idempotent (may change server state)
Typical useSearch queries, filters, retrieving dataLogin forms, registration, posting/saving data

Example:

<form method="get"  action="search.php">  <!-- ...?q=php -->
<form method="post" action="login.php">   <!-- data in body -->

In PHP, GET data is read via $_GET and POST data via $_POST. Use GET for harmless retrieval and POST for submitting sensitive or large data that changes server state.

get-post
8short5 marks

What is AJAX? Explain how AJAX enables asynchronous communication between the client and the server.

AJAX

AJAX (Asynchronous JavaScript And XML) is a web development technique that allows a web page to exchange data with the server in the background and update parts of the page without reloading the whole page. Despite the name, it commonly uses JSON rather than XML today. It combines JavaScript, the DOM, and the XMLHttpRequest object (or the modern fetch() API).

How AJAX Enables Asynchronous Communication

  1. An event occurs (e.g. button click) and JavaScript creates an XMLHttpRequest (or calls fetch).
  2. The request is sent to the server asynchronously — the browser does not freeze and the user can keep interacting.
  3. The server processes the request and returns a response (JSON/XML/HTML/text).
  4. A callback (or promise) fires when the response arrives, and JavaScript uses the DOM to update only the relevant part of the page.
const xhr = new XMLHttpRequest();
xhr.open("GET", "data.php", true);   // true = asynchronous
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4 && xhr.status === 200) {
    document.getElementById("result").innerHTML = xhr.responseText;
  }
};
xhr.send();

Benefits: faster, more responsive user experience; reduced bandwidth (only needed data is fetched); partial page updates. Examples include live search suggestions, form validation, and infinite scrolling.

ajax
9short5 marks

Explain the role of a web server. Differentiate between static and dynamic web pages.

Role of a Web Server

A web server is software (and the host machine) that stores website files and responds to HTTP/HTTPS requests from clients (browsers). Its main roles are:

  • Listen for incoming HTTP requests on a port (80/443).
  • Locate and serve the requested resource (HTML, CSS, JS, images).
  • For dynamic requests, pass them to an application/scripting engine (e.g. PHP) and return the generated output.
  • Send back the HTTP response with appropriate status codes and headers.
  • Handle security (TLS), logging, authentication, and concurrent connections.

Examples: Apache HTTP Server, Nginx, Microsoft IIS.

Static vs Dynamic Web Pages

AspectStatic Web PageDynamic Web Page
ContentFixed, same for every userGenerated on the fly, can differ per user/request
TechnologyHTML, CSS onlyServer-side scripting (PHP, ASP, Node) + database
Server processingFile sent as-isPage built at request time
UpdatingEdit the file manuallyContent changes via code/database
SpeedFaster to serveSlower (extra processing)
ExampleA simple "About Us" pageA user dashboard, search results, news feed

In short, a static page is delivered exactly as stored, while a dynamic page is produced by server-side code (often using a database) for each request.

web-servers
10short5 marks

What is JSON? Differentiate between JSON and XML for data exchange.

JSON

JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent format for storing and exchanging data. It represents data as key–value pairs (objects) and ordered lists (arrays), and is widely used in REST APIs and AJAX.

{
  "name": "Ram",
  "age": 20,
  "courses": ["Web", "DBMS"],
  "active": true
}

Supported value types: string, number, boolean, null, object, and array.

JSON vs XML for Data Exchange

AspectJSONXML
SyntaxKey–value pairs, braces/bracketsNested tags with opening/closing
VerbosityCompact, less dataMore verbose (repeated tags)
Data typesNative types (number, boolean, null)Everything is text
ParsingEasy/fast, native in JavaScript (JSON.parse)Needs a DOM/SAX parser
ArraysBuilt-in array supportNo native array concept
Attributes / namespacesNot supportedSupported
ReadabilitySimple, human-readableReadable but heavier
Typical useWeb APIs, AJAX, configDocuments, SOAP, complex schemas

Example (same data in XML):

<student>
  <name>Ram</name>
  <age>20</age>
</student>

JSON is generally preferred for modern web data exchange because it is lighter and natively parsed by JavaScript, whereas XML offers richer features like attributes, namespaces, and schema validation.

json
11short5 marks

What are cookies? Explain how cookies are created and read in a web application.

Cookies

A cookie is a small piece of data (a name–value pair) that a web server sends to the browser, which the browser stores and sends back with every subsequent request to that site. Because HTTP is stateless, cookies are used to maintain state — e.g. remembering logins, user preferences, shopping carts, and tracking sessions. Each cookie can have attributes such as expiry time, path, domain, Secure, and HttpOnly.

Creating and Reading Cookies

In PHP — created with setcookie() (must be called before any output) and read from the $_COOKIE superglobal:

// Create / set a cookie that expires in 1 hour
setcookie("user", "Ram", time() + 3600, "/");

// Read the cookie (on a later request)
if (isset($_COOKIE["user"])) {
    echo "Welcome " . $_COOKIE["user"];
}

In JavaScript — using document.cookie:

// Create
document.cookie = "user=Ram; expires=Fri, 31 Dec 2026 23:59:59 GMT; path=/";
// Read (returns all cookies as one string)
console.log(document.cookie);

Under the hood the server sends a Set-Cookie response header to create the cookie, and the browser returns it in the Cookie request header on later visits. A cookie without an expiry is a session cookie (deleted when the browser closes); one with a future expiry is a persistent cookie.

cookies
12short5 marks

Differentiate between the Internet and the World Wide Web. Explain the client-server architecture of the web.

Internet vs World Wide Web

AspectInternetWorld Wide Web (WWW)
DefinitionA global network of interconnected computers/networksA service/information system that runs on the Internet
NatureHardware + networking infrastructureCollection of linked web pages and resources
ProtocolsTCP/IP, plus many (HTTP, FTP, SMTP, etc.)Mainly HTTP/HTTPS
ScopeBroader — supports web, email, FTP, VoIP, etc.A subset that deals with hypertext documents
Accessed viaNetwork connectionWeb browser using URLs
Invented1960s–70s (ARPANET origins)1989–91 by Tim Berners-Lee

In short, the Internet is the underlying global network of networks, while the WWW is just one of the many services that operate over it.

Client–Server Architecture of the Web

The web follows a client–server model:

  • Client — the user's web browser. It requests resources by sending HTTP requests (identified by a URL).
  • Server — a web server that stores resources and responds with HTTP responses (HTML, images, JSON, etc.).

Typical request–response flow:

  1. The user enters a URL; DNS resolves the domain to an IP address.
  2. The browser opens a TCP connection and sends an HTTP request to the server.
  3. The server processes the request (serving a static file or running server-side code, often querying a database).
  4. The server returns an HTTP response with a status code and the content.
  5. The browser renders the page and may make further requests for embedded resources.
[Browser/Client]  --- HTTP request --->  [Web Server]  <---> [Database]
[Browser/Client]  <-- HTTP response ---   [Web Server]

This architecture separates concerns (presentation on the client, processing/data on the server) and lets one server serve many clients concurrently.

wwwinternet

Frequently asked questions

Where can I find the BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) question paper 2078?
The full BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) 2078 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Web Technology (BSc CSIT, CSC318) 2078 paper come with solutions?
Yes. Every question on this Web Technology (BSc CSIT, CSC318) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) 2078 paper?
The BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) 2078 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Web Technology (BSc CSIT, CSC318) past paper free?
Yes — reading and attempting this Web Technology (BSc CSIT, CSC318) past paper on Kekkei is completely free.