BSc CSIT (TU) Science Web Technology (BSc CSIT, CSC318) Question Paper 2078 Nepal
This is the official BSc CSIT (TU) (Science stream) Web Technology (BSc CSIT, CSC318) question paper for 2078, as set in the regular annual examination. It carries 60 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Web Technology (BSc CSIT, CSC318) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) exam or solving previous years' question papers, this 2078 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
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:
| Layer | Meaning |
|---|---|
| Content | The actual text/image (width, height). |
| Padding | Transparent space between content and border. |
| Border | Line surrounding the padding. |
| Margin | Transparent 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.
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
- Request line — HTTP method, the target resource (URI), and the protocol version.
- Headers — key:value metadata (
Host,Accept,Content-Type,Authorization, etc.). - 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
- Status line — version, status code, reason phrase.
- Headers —
Content-Type,Content-Length,Set-Cookie, etc. - Blank line then the body (the requested resource).
Common HTTP Methods
| Method | Purpose |
|---|---|
| GET | Retrieve a resource (safe, idempotent). |
| POST | Submit data to create a resource. |
| PUT | Create/replace a resource (idempotent). |
| DELETE | Remove a resource. |
| HEAD | Like GET but returns headers only. |
| PATCH | Apply a partial update. |
Common Status Codes
| Class | Code | Meaning |
|---|---|---|
| 1xx Informational | 100 | Continue |
| 2xx Success | 200 OK, 201 Created | Request succeeded |
| 3xx Redirection | 301 Moved Permanently, 302 Found, 304 Not Modified | Further action / cache |
| 4xx Client error | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found | Client fault |
| 5xx Server error | 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable | Server fault |
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:
| Feature | DTD (Document Type Definition) | XSD (XML Schema Definition) |
|---|---|---|
| Syntax | Uses its own non-XML grammar | Written in XML itself |
| Data types | No built-in data types (everything is text/CDATA) | Rich built-in types: string, integer, date, decimal, plus custom types |
| Namespaces | Not supported | Fully supported |
| Cardinality / occurrence | Limited (?, *, +) | Precise via minOccurs / maxOccurs |
| Extensibility | Not easily extensible | Supports inheritance, restriction, extension |
| Parsing | Parsed differently from XML | Parsed 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.
Section B: Short Answer Questions
Attempt any EIGHT questions.
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.
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).
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
| Part | Example | Role |
|---|---|---|
| Scheme/Protocol | https | Protocol to use (http, https, ftp). |
| Host/Domain | www.example.com | Server name (resolved by DNS). |
| Port | 443 | Port number (optional; defaults per scheme). |
| Path | /products/index.php | Location of the resource on the server. |
| Query string | ?id=10&cat=web | Parameters as key=value pairs. |
| Fragment | #reviews | Anchor 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:
- The browser checks its local/OS cache for the name.
- If not found, it queries the configured DNS resolver (usually the ISP's).
- The resolver queries the root name server, which directs it to the TLD server (e.g.
.com). - The TLD server points to the domain's authoritative name server.
- The authoritative server returns the IP address, which is cached and returned to the browser.
- 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.
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:
| Aspect | GET | POST |
|---|---|---|
| Data location | Appended to the URL as a query string (?name=value) | Sent in the HTTP request body |
| Visibility | Visible in the address bar, browser history, server logs | Not shown in the URL |
| Data size limit | Limited by URL length (~2 KB) | Practically unlimited (large data, file uploads) |
| Security | Less secure for sensitive data | More secure (data not in URL), still needs HTTPS |
| Caching / bookmarking | Can be cached and bookmarked | Not cached or bookmarked by default |
| Idempotency | Idempotent and safe (only retrieves) | Not idempotent (may change server state) |
| Typical use | Search queries, filters, retrieving data | Login 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.
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
- An event occurs (e.g. button click) and JavaScript creates an
XMLHttpRequest(or callsfetch). - The request is sent to the server asynchronously — the browser does not freeze and the user can keep interacting.
- The server processes the request and returns a response (JSON/XML/HTML/text).
- 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.
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
| Aspect | Static Web Page | Dynamic Web Page |
|---|---|---|
| Content | Fixed, same for every user | Generated on the fly, can differ per user/request |
| Technology | HTML, CSS only | Server-side scripting (PHP, ASP, Node) + database |
| Server processing | File sent as-is | Page built at request time |
| Updating | Edit the file manually | Content changes via code/database |
| Speed | Faster to serve | Slower (extra processing) |
| Example | A simple "About Us" page | A 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.
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
| Aspect | JSON | XML |
|---|---|---|
| Syntax | Key–value pairs, braces/brackets | Nested tags with opening/closing |
| Verbosity | Compact, less data | More verbose (repeated tags) |
| Data types | Native types (number, boolean, null) | Everything is text |
| Parsing | Easy/fast, native in JavaScript (JSON.parse) | Needs a DOM/SAX parser |
| Arrays | Built-in array support | No native array concept |
| Attributes / namespaces | Not supported | Supported |
| Readability | Simple, human-readable | Readable but heavier |
| Typical use | Web APIs, AJAX, config | Documents, 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.
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.
Differentiate between the Internet and the World Wide Web. Explain the client-server architecture of the web.
Internet vs World Wide Web
| Aspect | Internet | World Wide Web (WWW) |
|---|---|---|
| Definition | A global network of interconnected computers/networks | A service/information system that runs on the Internet |
| Nature | Hardware + networking infrastructure | Collection of linked web pages and resources |
| Protocols | TCP/IP, plus many (HTTP, FTP, SMTP, etc.) | Mainly HTTP/HTTPS |
| Scope | Broader — supports web, email, FTP, VoIP, etc. | A subset that deals with hypertext documents |
| Accessed via | Network connection | Web browser using URLs |
| Invented | 1960s–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:
- The user enters a URL; DNS resolves the domain to an IP address.
- The browser opens a TCP connection and sends an HTTP request to the server.
- The server processes the request (serving a static file or running server-side code, often querying a database).
- The server returns an HTTP response with a status code and the content.
- 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.
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.