BSc CSIT (TU) Science BIT Web Technology I (BIT251) – 4th Semester (Model) Question Paper 2079 Nepal
This is the official BSc CSIT (TU) (Science stream) BIT Web Technology I (BIT251) – 4th Semester (Model) question paper for 2079, as set in the model model examination. It carries 60 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this BIT Web Technology I (BIT251) – 4th Semester (Model) 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) BIT Web Technology I (BIT251) – 4th Semester (Model) exam or solving previous years' question papers, this 2079 paper is a great way to practise under real exam conditions.
Section A
Attempt any two questions. (2 × 10 = 20)
Write HTML script to generate following output.
Create a table like below. Set link to www.facebook.com in the text “Null”. The title of your HTML page should be “Test”. The table should be in a div having id dv1.
| Title | Page | Price |
|---|---|---|
| Test | 200 | 140 |
| Hello | 100 | 300 |
| Null |
The above table is about the;
a. Use of rows and columns b. Use of rows c. Xy
Below is an HTML page with title “Test”, a table placed inside a div with id="dv1", and the text “Null” linked to www.facebook.com.
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="dv1">
<table border="1">
<tr>
<th>Title</th>
<th>Page</th>
<th>Price</th>
</tr>
<tr>
<td>Test</td>
<td>200</td>
<td>140</td>
</tr>
<tr>
<td>Hello</td>
<td>100</td>
<td>300</td>
</tr>
<tr>
<td></td>
<td></td>
<td><a href="https://www.facebook.com">Null</a></td>
</tr>
</table>
</div>
</body>
</html>
Explanation of key elements:
<title>Test</title>sets the page title shown on the browser tab.<div id="dv1">wraps the table so it can be styled/selected by its id.<table border="1">draws the grid;<th>defines header cells (Title, Page, Price) and<td>defines data cells.- The anchor
<a href="https://www.facebook.com">Null</a>turns the text “Null” into a hyperlink to Facebook.
Sub-question (the above table is about the):
The correct option is (a) Use of rows and columns, because an HTML table is constructed using rows (<tr>) that contain cells arranged into columns (<td>/<th>), so it demonstrates the use of both rows and columns.
What is the use of CSS? Describe various methods of inserting CSS in HTML. [2+8] Give proper examples.
What is CSS and its use?
CSS (Cascading Style Sheets) is a style sheet language used to describe the presentation (look and formatting) of an HTML document. Its main uses are:
- Controlling layout, colors, fonts, spacing and overall visual appearance.
- Separating content (HTML) from presentation (CSS), which makes code cleaner and easier to maintain.
- Reusing styles across many pages, ensuring a consistent design.
- Supporting responsive design for different screen sizes.
Methods of inserting CSS in HTML
There are three ways to apply CSS:
1. Inline CSS – styles are written directly inside an element using the style attribute. It applies only to that single element.
<p style="color: red; font-size: 16px;">This is inline styled text.</p>
2. Internal (Embedded) CSS – styles are written inside a <style> block in the <head> of the document. They apply to the whole page.
<head>
<style>
p { color: green; font-size: 14px; }
h1 { text-align: center; }
</style>
</head>
3. External CSS – styles are written in a separate .css file and linked using the <link> tag. The same file can be reused by many HTML pages.
<head>
<link rel="stylesheet" href="style.css">
</head>
style.css:
body { background-color: #f0f0f0; }
p { color: blue; }
Order of precedence (cascade): Inline CSS has the highest priority, followed by internal CSS, then external CSS, and finally the browser default. External CSS is preferred for large projects because it promotes reusability and separation of concerns.
Create a HTML form with fields like username, password, email, country. The username should be textbox, password and email should be the password and email fields. The country should be drop down. Now write JavaScript function for form validation. Your function should validate the username to be of length 5, password should start with digit and should be alphanumeric. The email should be valid. The country field should be selected.
Below is an HTML form with the required fields and a JavaScript validation function that runs on submit.
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<form name="regForm" onsubmit="return validateForm()">
Username: <input type="text" id="username"><br><br>
Password: <input type="password" id="password"><br><br>
Email: <input type="email" id="email"><br><br>
Country:
<select id="country">
<option value="">--Select--</option>
<option value="Nepal">Nepal</option>
<option value="India">India</option>
<option value="USA">USA</option>
</select><br><br>
<input type="submit" value="Submit">
</form>
<script>
function validateForm() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var email = document.getElementById("email").value;
var country = document.getElementById("country").value;
// 1. Username must be exactly length 5
if (username.length !== 5) {
alert("Username must be exactly 5 characters long.");
return false;
}
// 2. Password must start with a digit and be alphanumeric
var passPattern = /^[0-9][a-zA-Z0-9]*$/;
if (!passPattern.test(password)) {
alert("Password must start with a digit and contain only alphanumeric characters.");
return false;
}
// 3. Email must be valid
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
alert("Please enter a valid email address.");
return false;
}
// 4. Country must be selected
if (country === "") {
alert("Please select a country.");
return false;
}
alert("Form submitted successfully!");
return true;
}
</script>
</body>
</html>
Explanation of validation rules:
- Username:
username.length !== 5ensures the value is exactly five characters. - Password: the regular expression
/^[0-9][a-zA-Z0-9]*$/forces the first character to be a digit and allows only letters and digits afterward (alphanumeric). - Email: the pattern
/^[^\s@]+@[^\s@]+\.[^\s@]+$/checks for a basic valid email format (text,@, domain, dot, extension). - Country: an empty value (the default option) means nothing was selected, so it is rejected.
Returning false from onsubmit stops form submission when validation fails.
Section B
Attempt any eight questions. (8 × 5 = 40)
Describe the client server architecture and its types.
Client–Server Architecture
Client–server architecture is a computing model in which tasks are divided between service requesters (clients) and service providers (servers). The client sends a request (e.g., a web page or data), and the server processes the request and returns a response. They communicate over a network using protocols such as HTTP/HTTPS.
- Client: the front-end machine/application (e.g., a web browser) that initiates requests and presents results to the user.
- Server: the back-end machine/program that stores data, applies business logic and responds to client requests.
Types of client–server architecture:
- 1-Tier (Single-tier): Presentation, application logic and data reside on the same machine. Simple but not scalable.
- 2-Tier: The client (presentation + some logic) communicates directly with a database server. Suitable for small applications but the client becomes “fat”.
- 3-Tier: Separated into presentation tier (client), application/logic tier (application server) and data tier (database server). More scalable, secure and maintainable; common in web applications.
- N-Tier (Multi-tier): Logic is further distributed across several layers/servers (e.g., web server, application server, database server, caching), used for large enterprise systems.
Write HTML script to show the use of Video and Canvas elements.
HTML5 <video> and <canvas> elements
The <video> element embeds a media player for video files, and the <canvas> element provides a drawing surface controlled by JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Video and Canvas Demo</title>
</head>
<body>
<!-- Video element -->
<h3>Video Example</h3>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<!-- Canvas element -->
<h3>Canvas Example</h3>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000;">
Your browser does not support the canvas element.
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "green";
ctx.fillRect(20, 20, 150, 60); // draw a filled rectangle
</script>
</body>
</html>
Explanation:
<video>uses thecontrolsattribute to show play/pause buttons and multiple<source>tags for browser compatibility.<canvas>is a blank rectangle; JavaScript obtains a 2D drawing context withgetContext("2d")and uses methods likefillRect()to draw shapes.
Describe the relative, float and absolute positioning with suitable examples.
CSS provides several ways to control where elements are placed on a page. Three common techniques are relative positioning, absolute positioning and floating.
1. Relative positioning (position: relative)
The element is positioned relative to its normal position. Offsets (top, left, etc.) shift it from where it would normally be, but the original space is still reserved.
.box {
position: relative;
top: 20px;
left: 30px;
}
2. Absolute positioning (position: absolute)
The element is removed from the normal flow and positioned relative to its nearest positioned ancestor (an ancestor with position other than static); if none exists, relative to the page (<html>).
.box {
position: absolute;
top: 50px;
left: 100px;
}
3. Float (float: left | right)
The element is taken partly out of the normal flow and pushed to the left or right, allowing following content (such as text) to wrap around it. Commonly used for images and multi-column layouts.
img {
float: left;
margin: 10px;
}
Summary: Relative keeps the element’s reserved space and offsets it; absolute removes it from flow and positions it against a positioned ancestor; float shifts it to one side and lets content flow around it.
Consider a HTML page contains two divisions and one paragraph tags. The divisions have id div1 and div2 respectively. The color of text in both of divisions should be red and background color of the divisions should be green. The font style in paragraph should be Arial and the size of font should be 14. Write necessary CSS for the given scenario.
We target the two divisions by their ids (#div1, #div2) and the paragraph by its p tag.
/* Both divisions: red text, green background */
#div1, #div2 {
color: red;
background-color: green;
}
/* Paragraph: Arial font, size 14px */
p {
font-family: Arial, sans-serif;
font-size: 14px;
}
Example HTML it applies to:
<div id="div1">First division text</div>
<div id="div2">Second division text</div>
<p>This is a paragraph.</p>
Explanation:
#div1, #div2is a grouped id selector that appliescolor: red(text) andbackground-color: greento both divisions.- The
pselector setsfont-family: Arialandfont-size: 14pxfor the paragraph.
How array is defined in JavaScript? Illustrate with example. [2+3]
Defining an array in JavaScript
An array is an ordered collection of values stored under a single variable name, accessed by zero-based index. In JavaScript an array can hold values of mixed types and has a dynamic size. It can be defined in two main ways:
- Array literal (recommended):
var fruits = ["Apple", "Banana", "Orange"];
- Using the
Arrayconstructor:
var numbers = new Array(10, 20, 30);
Illustration with example:
var fruits = ["Apple", "Banana", "Orange"];
console.log(fruits[0]); // Apple (access by index)
console.log(fruits.length); // 3 (number of elements)
fruits.push("Mango"); // add an element at the end
console.log(fruits); // ["Apple","Banana","Orange","Mango"]
// Looping through an array
for (var i = 0; i < fruits.length; i++) {
console.log(fruits[i]);
}
Here fruits[0] accesses the first element, length gives the count, push() adds an element, and the for loop iterates over all elements.
What is cookie? Write a JavaScript code to create cookie object. [2+3]
What is a cookie?
A cookie is a small piece of data (a name=value pair) stored by the web browser on the client’s computer. Cookies are used to remember information across requests/sessions, such as user preferences, login state, session IDs and tracking data. Each cookie can have attributes like an expiry date and a path. They are sent back to the server with subsequent HTTP requests.
JavaScript code to create a cookie
In JavaScript, cookies are created using the document.cookie property:
// Create a cookie named "username" with an expiry date and path
function setCookie(name, value, days) {
var d = new Date();
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
// Usage
setCookie("username", "Ram", 7); // stores username=Ram for 7 days
// Reading cookies
console.log(document.cookie);
Here document.cookie assigns the cookie string; the expires attribute sets how long it lives, and path=/ makes it available across the whole site. Reading document.cookie returns all cookies as a single semicolon-separated string.
What is the use of XML? Discuss the XML elements.
Use of XML
XML (eXtensible Markup Language) is a markup language designed to store and transport data in a platform-independent, self-descriptive way. Its main uses are:
- Storing and exchanging structured data between different systems and applications.
- Separating data from presentation (data is described, not formatted).
- Configuration files, web services (SOAP), RSS feeds and data interchange.
- Allowing users to define their own custom tags (it is extensible).
XML Elements
An XML element is everything from a start tag to an end tag, and it is the basic building block of an XML document.
<book>
<title>Web Technology</title>
<author>Ram Sharma</author>
<price currency="NPR">500</price>
</book>
Key points about elements:
- An element has a start tag (
<title>), content (Web Technology) and an end tag (</title>). - Elements can contain text, other elements (child/nested elements) or be empty (
<br/>). - Elements may have attributes that provide extra information (e.g.,
currency="NPR"). - Every XML document must have exactly one root element (here
<book>). - Element names are case-sensitive, must be properly nested and every opened tag must be closed (well-formed rule).
What is DTD? How can you use CDATA and PCDATA in DTD? [1+4]
What is DTD?
DTD (Document Type Definition) defines the legal structure, elements, attributes and rules of an XML document. It acts as a grammar that an XML document must follow so that it can be validated. A DTD can be internal (declared inside the XML file) or external (in a separate .dtd file).
<!DOCTYPE note [
<!ELEMENT note (to, from, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
PCDATA (Parsed Character Data)
- PCDATA is text that will be parsed by the XML parser. Markup (tags, entities) inside PCDATA is interpreted, and special characters such as
<,>and&must be escaped (<,>,&). - It is used in element declarations to indicate that an element contains parsed text:
<!ELEMENT message (#PCDATA)>
CDATA (Character Data)
- CDATA is text that will not be parsed by the parser; everything inside is treated as plain characters, so special symbols do not need escaping. In DTD,
CDATAis also used as an attribute type meaning the attribute value is plain text.
<!-- CDATA as attribute type in DTD -->
<!ATTLIST product code CDATA #REQUIRED>
In an XML document, a CDATA section keeps raw data unparsed:
<script><![CDATA[ if (a < b && b > c) { ... } ]]></script>
Summary: PCDATA is parsed text used for element content, while CDATA is unparsed character data used both as an attribute type in DTD and as CDATA sections to include special characters without escaping.
Given following XML, write its equivalent XSD.
<university>
<college name="pmc">
<program> BIT </program>
</college>
</university>
The equivalent XSD (XML Schema Definition) describes the structure: a root university containing a college element, where college has a child program (string) and a name attribute (string).
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="university">
<xs:complexType>
<xs:sequence>
<xs:element name="college">
<xs:complexType>
<xs:sequence>
<xs:element name="program" type="xs:string"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Explanation:
universityandcollegeare complex types because they contain child elements.<xs:sequence>enforces the order of child elements.programis a simple element of typexs:string.nameis declared as an attribute ofcollegewith typexs:string(matchingname="pmc"in the source XML).
Note: the original XML in the question has a typo (<university?); the well-formed root tag <university> is assumed.
Frequently asked questions
- Where can I find the BSc CSIT (TU) BIT Web Technology I (BIT251) – 4th Semester (Model) question paper 2079?
- The full BSc CSIT (TU) BIT Web Technology I (BIT251) – 4th Semester (Model) 2079 (model) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the BIT Web Technology I (BIT251) – 4th Semester (Model) 2079 paper come with solutions?
- Yes. Every question on this BIT Web Technology I (BIT251) – 4th Semester (Model) 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) BIT Web Technology I (BIT251) – 4th Semester (Model) 2079 paper?
- The BSc CSIT (TU) BIT Web Technology I (BIT251) – 4th Semester (Model) 2079 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
- Is practising this BIT Web Technology I (BIT251) – 4th Semester (Model) past paper free?
- Yes — reading and attempting this BIT Web Technology I (BIT251) – 4th Semester (Model) past paper on Kekkei is completely free.