Blog
Web Systems Technologies Past Paper 2025 BSCS UOS
Download and read Web Systems Technologies Past Paper 2025 BSCS UOS
Web Systems Technologies Past Paper 2025 (text version)
University of Sargodha – BS 5th Semester Examination 2025
Subject: Computer Science · Paper: Web Systems Technologies (CSEC-301) · Time: 2:30 hours · Maximum marks: 60
Objective part is compulsory. Attempt any three questions from the subjective part.
Q.1 Short answers (2 × 12)
- Differentiate between <div> and <span>.
- Differentiate between <th> and <td>.
- Differentiate between GET and POST.
- Differentiate between inline and block in CSS.
- How do you differentiate the role of HTML and CSS?
- Differentiate between client-side scripting and server-side scripting.
- Differentiate between cookies and sessions.
- Differentiate between HTML and HTML5.
- Differentiate between CSS and CSS3.
- What is a viewport?
- What are meta tags?
- What is the DOM?
Subjective part (3 × 12)
- Q.2 Write a JavaScript function that changes the style and content of all spans having id “term” to bold text. Apply the function on page load.
- Q.3 Write a PHP function to log in existing users (make the database tables and write the PHP code).
- Q.4 What are padding, margin and border in CSS? What is the box model and why is it important?
- Q.5 Write a note on sessions in PHP and discuss the functions available for session maintenance.
- Q.6 Create the given table using HTML and CSS (Sr #, Category, Name, Price – Car Equipment: Brakes 1150, Light bulb 450; Services: Tuning 900, Car wash 400; Grand Total 2900/-).
Short questions solved
- <div> is a block container (starts on a new line, full width); <span> is an inline container for part of a line of text.
- <th> is a table header cell (bold and centred by default); <td> is a normal data cell.
- GET sends data in the URL (visible, length-limited, can be bookmarked) – for fetching data. POST sends data in the request body (not shown in the URL, no practical size limit) – for submitting forms and changing data.
- Block elements start on a new line and take full width (div, p, h1); inline elements flow within a line and take only the width they need (span, a, strong).
- HTML defines the structure and content of a page; CSS controls its presentation – colours, fonts, layout.
- Client-side scripts (JavaScript) run in the browser for interactivity; server-side scripts (PHP, Node.js) run on the server to access databases and generate pages.
- Cookies are stored in the user’s browser (small, can persist, less secure); sessions are stored on the server, identified by a session ID cookie (more secure, end when the session expires).
- HTML5 is the latest HTML standard: it adds semantic tags (header, nav, article, footer), native <audio>/<video>, <canvas>, new form inputs and local storage, with a simple <!DOCTYPE html>.
- CSS3 is the modular latest version of CSS, adding rounded corners, shadows, gradients, transitions/animations, flexbox, grid and media queries.
- Viewport: the visible area of a web page on a device; set with <meta name=”viewport” content=”width=device-width, initial-scale=1″> for responsive design.
- Meta tags: tags in the <head> that give information about the page – charset, description, keywords, author, viewport – used by browsers and search engines.
- DOM (Document Object Model): a tree representation of an HTML document that JavaScript can use to read and change elements, attributes and content.
Solved subjective questions
Q.2 An id should be unique on a page, but if several spans share id=”term”, select them all with a CSS selector:
<script>
function makeTermsBold() {
const spans = document.querySelectorAll('span#term'); // all spans with id="term"
spans.forEach(function (s) {
s.style.fontWeight = 'bold';
s.innerHTML = '<b>' + s.textContent + '</b>'; // change content to bold text
});
}
window.onload = makeTermsBold; // apply on page load
</script>(Better practice is to use a class, e.g. class=”term” with document.getElementsByClassName(‘term’).)
Q.3 Table and login function
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password_hash VARCHAR(255) NOT NULL
);<?php
session_start();
function loginUser(mysqli $conn, string $username, string $password): bool {
$stmt = $conn->prepare("SELECT id, password_hash FROM users WHERE username = ?");
$stmt->bind_param("s", $username); // prepared statement stops SQL injection
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
if (password_verify($password, $row['password_hash'])) {
$_SESSION['user_id'] = $row['id'];
$_SESSION['username'] = $username;
return true;
}
}
return false;
}
$conn = new mysqli("localhost", "root", "", "mydb");
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (loginUser($conn, $_POST['username'], $_POST['password'])) {
header("Location: dashboard.php");
exit;
}
echo "Invalid username or password";
}
?>Passwords are stored with password_hash() at registration and checked with password_verify().
Q.4 Box model: every element is a box made of content → padding (space inside the border, around the content) → border (line around the padding) → margin (space outside the border, separating elements). Total width = content + left/right padding + borders + margins (unless box-sizing: border-box is used). It matters because it controls spacing, layout and the actual size of elements.
Q.5 Sessions in PHP keep data about a user across pages on the server. A session ID is stored in a cookie (PHPSESSID) and data lives in $_SESSION. Functions: session_start() (start/resume), $_SESSION['key'] = value (store), session_id() (get/set ID), session_regenerate_id() (new ID, prevents fixation), unset($_SESSION['key']) (remove one value), session_unset() (clear all values) and session_destroy() (end the session, e.g. on logout).
Q.6 Table
<style>
table { border-collapse: collapse; }
th, td { border: 1px solid #000; padding: 4px 12px; text-align: center; }
</style>
<table>
<tr><th>Sr #</th><th>Category</th><th>Name</th><th>Price</th></tr>
<tr><td>1</td><td rowspan="2">Car Equipment</td><td>Brakes</td><td>1150</td></tr>
<tr><td>2</td><td>Light bulb</td><td>450</td></tr>
<tr><td>3</td><td rowspan="2">Services</td><td>Tuning</td><td>900</td></tr>
<tr><td>4</td><td>Car wash</td><td>400</td></tr>
<tr><td colspan="2">Grand Total</td><td colspan="2">2900/-</td></tr>
</table>Answers prepared by Shining Study for revision. Check them against your class notes and teacher’s guidance.
