BSc CSIT (TU) Science Web Technology (BSc CSIT, CSC318) Question Paper 2079 Nepal
This is the official BSc CSIT (TU) (Science stream) Web Technology (BSc CSIT, CSC318) question paper for 2079, 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 2079 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt any TWO questions.
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 an application-layer, request–response protocol used by the World Wide Web to transfer hypertext documents and other resources between a client (browser) and a web server. It runs on top of TCP (default port 80, or 443 for HTTPS) and is stateless — each request is independent and the server keeps no memory of previous requests (state is added via cookies/sessions).
Structure of an HTTP Request
An HTTP request has four parts:
- Request line —
METHOD Request-URI HTTP-Version - Header fields — name: value pairs giving metadata
- Blank line — separates headers from body
- Message body (optional) — data sent to the server (e.g. form data)
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
Connection: keep-alive
Structure of an HTTP Response
- Status line —
HTTP-Version Status-Code Reason-Phrase - Header fields — metadata about the response
- Blank line
- Message body — the requested resource (HTML, image, JSON, etc.)
HTTP/1.1 200 OK
Date: Mon, 01 Jan 2024 12:00:00 GMT
Server: Apache/2.4
Content-Type: text/html; charset=UTF-8
Content-Length: 1024
<html>...</html>
Common HTTP Methods
| Method | Purpose |
|---|---|
| GET | Retrieve a resource; parameters appended to URL; safe & idempotent |
| POST | Submit data to the server (create); body carries data |
| PUT | Create or fully replace a resource; idempotent |
| DELETE | Remove a resource |
| HEAD | Like GET but returns only headers, no body |
| PATCH | Partially update a resource |
| OPTIONS | Query the methods supported by a resource |
Common Status Codes
| Class | Code | Meaning |
|---|---|---|
| 1xx Informational | 100 | Continue |
| 2xx Success | 200 OK, 201 Created, 204 No Content | |
| 3xx Redirection | 301 Moved Permanently, 302 Found, 304 Not Modified | |
| 4xx Client Error | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found | |
| 5xx Server Error | 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable |
Differentiate between DTD and XSD. Write an XSD schema for an XML document describing a list of books.
DTD vs XSD
Both DTD (Document Type Definition) and XSD (XML Schema Definition) define the structure, content and legal elements of an XML document, but XSD is more powerful and modern.
| Feature | DTD | XSD |
|---|---|---|
| Syntax | Non-XML (its own syntax) | Written in XML itself |
| Data types | No built-in data types (everything is text) | Rich built-in types (string, int, date, decimal, …) and user-defined types |
| Namespaces | Not supported | Fully supports namespaces |
| Cardinality | Limited (?, *, +) | Precise control with minOccurs / maxOccurs |
| Extensibility | Not extensible | Supports inheritance, restriction, extension |
| Parsing | Needs a separate DTD parser | Parsed as normal XML |
Conclusion: XSD supersedes DTD because it is namespace-aware, data-type-aware and itself well-formed XML.
XSD Schema for a List of Books
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="bookstore">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="year" type="xs:gYear"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
A valid XML instance:
<bookstore>
<book isbn="978-1">
<title>Web Technology</title>
<author>R. Sharma</author>
<year>2021</year>
<price>450.00</price>
</book>
</bookstore>
Explain cookies and sessions in PHP. Write a PHP script that uses sessions to manage user login state.
Cookies and Sessions in PHP
Cookies are small text files (key–value pairs) that the server asks the browser to store on the client machine. They are sent back with every subsequent request to the same domain, letting the server remember the client. In PHP a cookie is set with setcookie() and read from the $_COOKIE superglobal. They have limited size (~4 KB), can be tampered with, and can be disabled by the user.
Sessions store user data on the server; only a small session ID is kept on the client (usually as a cookie named PHPSESSID). Sessions are more secure for sensitive data (login state), are larger in capacity, and are accessed through the $_SESSION superglobal after calling session_start().
| Aspect | Cookie | Session |
|---|---|---|
| Stored on | Client (browser) | Server |
| Security | Less secure | More secure |
| Capacity | ~4 KB | Server limited (large) |
| Lifetime | Until expiry set | Until browser closes / timeout |
PHP Script Using Sessions to Manage Login State
login.php
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user = $_POST['username'];
$pass = $_POST['password'];
// (In practice, verify against a database with hashed passwords)
if ($user === 'admin' && $pass === '1234') {
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $user;
header('Location: welcome.php');
exit;
} else {
echo 'Invalid credentials';
}
}
?>
<form method="post" action="login.php">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
welcome.php
<?php
session_start();
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header('Location: login.php');
exit;
}
echo 'Welcome, ' . htmlspecialchars($_SESSION['username']);
echo '<br><a href="logout.php">Logout</a>';
?>
logout.php
<?php
session_start();
session_unset(); // remove all session variables
session_destroy(); // destroy the session
header('Location: login.php');
?>
Section B: Short Answer Questions
Attempt any EIGHT questions.
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 that uniquely identifies a resource on the web. Its general form is:
scheme://host:port/path?query#fragment
Example: https://www.example.com:443/products/item?id=10#reviews
- scheme — protocol used (
http,https,ftp) - host — domain name or IP of the server (
www.example.com) - port — TCP port (default 80 for HTTP, 443 for HTTPS)
- path — location of the resource on the server (
/products/item) - query string — parameters after
?(id=10) - fragment — anchor within the page after
#(reviews)
Role of DNS
The Domain Name System (DNS) is the distributed "phonebook" of the Internet that resolves human-readable domain names into machine IP addresses. When a user enters a URL:
- The browser checks its cache, then asks a DNS resolver (usually the ISP).
- The resolver queries the root server, then the TLD server (e.g.
.com), then the authoritative name server for the domain. - The authoritative server returns the IP address (e.g.
93.184.216.34). - The browser then opens a TCP connection to that IP and sends the HTTP request.
Thus DNS lets users use easy names instead of remembering numeric IP addresses.
Differentiate between the GET and POST methods of submitting form data.
GET vs POST
Both GET and POST are HTTP methods used to submit HTML form data, set via the method attribute of <form>.
| Feature | GET | POST |
|---|---|---|
| Data location | Appended to URL as a query string (?name=value) | Sent in the HTTP request body |
| Visibility | Visible in the address bar / browser history | Not visible in the URL |
| Data size | Limited (URL length ~2048 chars) | Practically unlimited |
| Bookmark/Cache | Can be bookmarked and cached | Cannot be bookmarked or cached |
| Security | Less secure (data exposed) | More secure (data hidden, but still needs HTTPS) |
| Idempotency | Safe & idempotent (only retrieves data) | Not idempotent (may change server state) |
| Typical use | Search queries, fetching data | Login forms, file uploads, submitting sensitive data |
Summary: Use GET when retrieving data that can be bookmarked and is non-sensitive; use POST when sending large or sensitive data or modifying 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 send and receive data from a server asynchronously, in the background, without reloading the whole page. It is not a single technology but a combination of HTML/CSS, the DOM, JavaScript, and the XMLHttpRequest object (or the modern fetch() API), with data usually exchanged as JSON or XML.
How AJAX Enables Asynchronous Communication
- An event occurs in the browser (e.g. a button click).
- JavaScript creates an
XMLHttpRequest(orfetch) object and sends an HTTP request to the server in the background. - Because the call is asynchronous, the browser does not freeze — the user can keep interacting with the page while waiting.
- The server processes the request and returns only the needed data (often JSON), not a whole new page.
- A callback function 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 UIs, reduced bandwidth and server load, and a smoother user experience (e.g. live search, auto-complete, form validation).
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 listens for HTTP/HTTPS requests from clients (browsers), then processes and responds with the requested resources (HTML pages, images, files) or with output generated by server-side programs. Examples: Apache, Nginx, IIS.
Key roles:
- Accept and parse incoming HTTP requests.
- Locate or generate the requested resource.
- Execute server-side scripts (PHP, Python, etc.) for dynamic content.
- Return an HTTP response with appropriate status code and content.
- Handle security (HTTPS), logging, and concurrent connections.
Static vs Dynamic Web Pages
| Feature | 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, JSP) + database |
| Server processing | None — file is served as-is | Server runs code to build the page |
| Update | Must edit the file manually | Updates automatically from data/database |
| Speed | Faster to serve | Slower (processing overhead) |
| Example | A company "About Us" page | A logged-in dashboard, search results |
What is JSON? Differentiate between JSON and XML for data exchange.
JSON
JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent data-interchange format. It represents data as key–value pairs (objects {}) and ordered lists (arrays []), and is easy for humans to read and for machines to parse. It is the most common format for web APIs.
{
"name": "Ram",
"age": 21,
"courses": ["Web", "DBMS"],
"active": true
}
JSON vs XML
| Feature | JSON | XML |
|---|---|---|
| Syntax | Key–value pairs, braces/brackets | Nested tags (<tag>...</tag>) |
| Verbosity | Compact, less text | Verbose (opening + closing tags) |
| Data types | Native: string, number, boolean, array, null | Everything is text |
| Parsing | Fast; native in JavaScript (JSON.parse) | Needs a DOM/XML parser |
| Arrays | Built-in support | No native array concept |
| Attributes/Namespaces | Not supported | Supported |
| Readability | High | Moderate |
Summary: JSON is lighter, faster and ideal for web APIs and JavaScript; XML is more verbose but richer (attributes, namespaces, schema/validation) and suited to document-centric data.
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 on the client machine and sends back with every subsequent request to the same domain. Cookies let an otherwise stateless HTTP connection "remember" the user — for sessions, preferences, shopping carts, and tracking. They are limited to about 4 KB and have attributes like expires, path, domain, Secure and HttpOnly.
Creating and Reading Cookies
Creating (PHP) — must be set before any HTML output:
<?php
// setcookie(name, value, expiry, path)
setcookie('username', 'Ram', time() + 3600, '/'); // expires in 1 hour
?>
Reading (PHP) — available on the next request via $_COOKIE:
<?php
if (isset($_COOKIE['username'])) {
echo 'Welcome back, ' . htmlspecialchars($_COOKIE['username']);
}
?>
Creating / reading in JavaScript:
document.cookie = "username=Ram; max-age=3600; path=/"; // create
console.log(document.cookie); // read
When the cookie is set, the server sends a Set-Cookie response header; the browser then automatically includes a Cookie request header on later requests to that site.
Differentiate between the Internet and the World Wide Web. Explain the client-server architecture of the web.
Internet vs World Wide Web
| Feature | Internet | World Wide Web (WWW) |
|---|---|---|
| Definition | A global network of interconnected computers | A service running on the Internet — a system of linked hypertext documents |
| Nature | Hardware + infrastructure (cables, routers, IPs) | Software/information layer (web pages, websites) |
| Protocols | TCP/IP, and many others (FTP, SMTP, HTTP) | Mainly HTTP/HTTPS |
| Scope | Broader — supports email, FTP, streaming, the Web | A subset — just web resources accessed via browsers |
| Invented | 1960s–70s (ARPANET) | 1989–91 by Tim Berners-Lee |
In short: the Internet is the infrastructure; the Web is one application that runs over it.
Client–Server Architecture of the Web
The web follows a client–server model:
- The client (a web browser) sends an HTTP request for a resource (URL).
- The server (web server) receives the request, processes it (possibly running server-side scripts and querying a database), and returns an HTTP response containing the resource.
- The connection is stateless — each request is independent — and communication uses the request–response cycle over TCP/IP.
[Browser/Client] --- HTTP Request ---> [Web Server]
[Browser/Client] <-- HTTP Response --- [Web Server]
Many clients can simultaneously connect to one server, which centralizes resources and processing.
Explain HTML tables and forms with examples of the common form elements.
HTML Tables
HTML tables display data in rows and columns using these tags:
<table>— the table container<tr>— a table row<th>— a header cell (bold, centred)<td>— a data cell<caption>— table title;<thead>,<tbody>,<tfoot>group sections- Attributes:
colspan,rowspan,border
<table border="1">
<caption>Student Marks</caption>
<tr><th>Name</th><th>Marks</th></tr>
<tr><td>Ram</td><td>85</td></tr>
<tr><td>Sita</td><td>90</td></tr>
</table>
HTML Forms
A form collects user input and submits it to a server. It is defined with <form action="url" method="get|post"> and contains form controls.
Common Form Elements
<form action="submit.php" method="post">
Name: <input type="text" name="name"><br>
Password:<input type="password" name="pwd"><br>
Gender: <input type="radio" name="g" value="M"> Male
<input type="radio" name="g" value="F"> Female<br>
Hobbies: <input type="checkbox" name="h" value="music"> Music<br>
Country: <select name="country">
<option>Nepal</option><option>India</option>
</select><br>
About: <textarea name="about"></textarea><br>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>
| Element | Purpose |
|---|---|
<input type="text"> | Single-line text |
<input type="password"> | Masked text |
<input type="radio"> | Choose one option |
<input type="checkbox"> | Choose multiple options |
<select>/<option> | Drop-down list |
<textarea> | Multi-line text |
<input type="submit"> | Submit the form |
Explain different types of CSS selectors with examples.
CSS Selectors
A CSS selector is a pattern used to target HTML elements so that styles can be applied to them. The main types are:
1. Universal Selector (*)
Selects all elements.
* { margin: 0; padding: 0; }
2. Element (Type) Selector
Selects all elements of a given tag.
p { color: blue; }
3. Class Selector (.)
Selects all elements with a given class attribute.
.note { background: yellow; } /* <p class="note"> */
4. ID Selector (#)
Selects the single element with a given id (must be unique).
#header { height: 80px; } /* <div id="header"> */
5. Group Selector (,)
Applies the same style to several selectors.
h1, h2, p { font-family: Arial; }
6. Descendant Selector (space)
Selects elements nested inside another element.
div p { color: green; } /* every <p> inside a <div> */
7. Child Selector (>)
Selects direct children only.
ul > li { list-style: square; }
8. Attribute Selector
Selects elements by attribute/value.
input[type="text"] { border: 1px solid gray; }
9. Pseudo-class Selector
Selects elements in a special state.
a:hover { color: red; }
Specificity order (low → high): element < class/attribute/pseudo-class < ID < inline style.
Frequently asked questions
- Where can I find the BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) question paper 2079?
- The full BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) 2079 (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) 2079 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) 2079 paper?
- The BSc CSIT (TU) Web Technology (BSc CSIT, CSC318) 2079 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.