Web System and Technologies, Past Papers

Web System and Technologies Past Paper 2020 | MSc IT UOS

Web System and Technologies Past Paper 2020 MSc IT University of Sargodha

University: University of Sargodha (UOS)
Program: MSc IT (3rd Term)
Subject: Web System and Technologies (3548)
Year: 2020
Time Allowed: 2 Hours 30 Minutes
Maximum Marks: 80

Web System and Technologies is an important subject for MSc IT students. You can also download the complete PDF of this paper here for offline study and practice.


Why Use This Past Paper?

This past paper helps you understand the question pattern, common theory concepts in web system topics, and how short questions are framed. It’s useful for exam revision and skill-building.

  • Practice core web technologies questions
  • Review key definitions and concepts
  • Prepare for subjective answers
  • Strengthen your understanding of client-server basics

Web System and Technologies Past Paper 2020 (Complete)

Below is the complete text from the exam paper:

University of Sargodha
MSc IT 3rd Term Exam 2020

Subject: IT
Paper: Web System and Technologies (3548)
Time Allowed: 2:30 Hours
Maximum Marks: 80

Note: Objective part is compulsory. Attempt any three questions from the subjective part.


Objective Part (Compulsory)

Q.1 Write short answers of the following questions (2×16=32):

  1. What is a markup language?
  2. Differentiate between <tr> and <td>.
  3. What is the purpose of the method attribute in HTML form?
  4. Write CSS rule to convert an inline element to block element.
  5. What is AJAX?
  6. What is Web Server?
  7. What is purpose of <header> and <nav>?
  8. What are background styles in CSS?
  9. How can one include JavaScript in a webpage?
  10. What is client-side validation?
  11. What are cookies?
  12. What is purpose of session_destroy() in PHP?
  13. What is confirm box in JavaScript?
  14. What is meant by XML?
  15. What is HTTP?
  16. What is Browser?

Subjective Part (Attempt any Three)

Q.2 Design login form with username and password and submit securely to login.php.

Q.3 Write JavaScript function to validate a registration form with fields: Username, Password, Re-Type Password, Email.

Q.4 Write different ways to maintain state for a HTTP request.

Q.5 Write a PHP function to login existing users (include DB tables and PHP code).

Q.6 Write a note on font-styles available in CSS3.


Solved Short Questions (Objective Section)

1. What is a markup language?

A markup language is a system for annotating text to define structure and presentation, such as HTML which defines web page elements.

Reference: W3C HTML Standards

2. Differentiate between <tr> and <td>

<tr> defines a table row, while <td> defines a table data cell inside a row.

Reference: W3Schools – HTML Tables

3. Purpose of method attribute in HTML form

The method attribute specifies how form data is sent to the server: GET sends via URL, POST sends in the request body.

Reference: MDN – HTML Form

4. CSS rule to convert inline to block

Use display: block; to convert an inline element to a block-level element.

Reference: MDN – CSS Display

5. What is AJAX?

AJAX (Asynchronous JavaScript and XML) allows client-side updates without full page reloads.

Reference: MDN – AJAX

6. What is Web Server?

A web server is software/hardware that serves content like HTML over HTTP to clients (browsers).

Reference: Cloudflare – Web Server

7. Purpose of <header> and <nav>

<header> represents introductory content; <nav> defines a set of navigation links.

Reference: MDN – HTML Elements

8. Background styles in CSS

Background styles include background-color, background-image, background-repeat, etc.

Reference: MDN – CSS Backgrounds

9. How to include JavaScript in a webpage?

Use the <script> tag with either inline JavaScript or a linked file using the src attribute.

Reference: MDN – Script Tag

10. What is client-side validation?

Client-side validation checks user input in the browser before submitting it to the server, helping reduce server load and improve user experience.

Reference: MDN – Form Validation

11. What are cookies?

Cookies are small pieces of data sent by a server and stored in the user’s browser to maintain state and track user sessions.

Reference: MDN – Cookies

12. Purpose of session_destroy() in PHP

session_destroy() terminates the current session and deletes all data associated with that session.

Reference: PHP.net – session_destroy()

13. What is confirm box in JavaScript?

A confirm box displays an OK and Cancel dialog to the user and returns true or false based on the user’s selection.

Reference: W3Schools – JavaScript Popup Boxes

14. What is XML?

XML (eXtensible Markup Language) is a markup language used to store and transport data in a structured, human-readable format.

Reference: W3C – XML

15. What is HTTP?

HTTP (HyperText Transfer Protocol) is a communication protocol used to transfer data between clients and servers on the web.

Reference: MDN – HTTP Overview

16. What is a Browser?

A browser is software that retrieves, renders, and displays web content such as HTML, CSS, and JavaScript for users.

Reference: Mozilla – Web Browsers


Download PDF

Download Web System and Technologies Past Paper 2020 (PDF)


Related Past Papers

Parent Category: Past Papers Hub

Solved long questions

The short questions are solved above; here are the subjective questions with working code.

Q2 – Secure login form submitted to login.php

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Login</title>
  <style>
    form { width: 300px; margin: 40px auto; padding: 20px; border: 1px solid #ccc; border-radius: 6px; }
    label, input { display: block; width: 100%; margin-bottom: 10px; }
    button { padding: 8px 16px; }
  </style>
</head>
<body>
  <!-- the page should be served over HTTPS so data is encrypted -->
  <form action="login.php" method="post" autocomplete="off">
    <h2>Login</h2>
    <label for="username">Username</label>
    <input type="text" id="username" name="username" required maxlength="50">
    <label for="password">Password</label>
    <input type="password" id="password" name="password" required minlength="8">
    <!-- CSRF token generated by the server and checked in login.php -->
    <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
    <button type="submit">Login</button>
  </form>
</body>
</html>

Security points: method=”post” (credentials not shown in the URL or browser history), type=”password” (masked input), HTTPS for encryption, required/minlength validation, a CSRF token, and on the server: prepared statements and password_verify() (see Q5).

Q3 – JavaScript validation of a registration form

<form name="regForm" action="register.php" method="post" onsubmit="return validateForm()">
  Username: <input type="text" name="username"><br>
  Password: <input type="password" name="password"><br>
  Re-type Password: <input type="password" name="repassword"><br>
  Email: <input type="text" name="email"><br>
  <p id="msg" style="color:red"></p>
  <input type="submit" value="Register">
</form>

<script>
function validateForm() {
  var f = document.forms["regForm"];
  var user  = f["username"].value.trim();
  var pass  = f["password"].value;
  var pass2 = f["repassword"].value;
  var email = f["email"].value.trim();
  var msg   = document.getElementById("msg");

  if (user === "" || pass === "" || pass2 === "" || email === "") {
    msg.innerHTML = "All fields are required.";
    return false;
  }
  if (!/^[A-Za-z0-9_]{4,20}$/.test(user)) {
    msg.innerHTML = "Username must be 4-20 letters, digits or _.";
    return false;
  }
  if (pass.length < 8) {
    msg.innerHTML = "Password must be at least 8 characters.";
    return false;
  }
  if (pass !== pass2) {
    msg.innerHTML = "Passwords do not match.";
    return false;
  }
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
    msg.innerHTML = "Please enter a valid email address.";
    return false;
  }
  return true;   // all checks passed: form is submitted
}
</script>

Q4 – Ways to maintain state for HTTP requests

HTTP is stateless – each request is independent – so web applications use these techniques to remember users between requests:

  • Cookies: small name–value data stored in the browser and sent with every request to the same site (setcookie("user","ali",time()+3600); read with $_COOKIE). Can be persistent or session cookies; should use Secure/HttpOnly flags.
  • Sessions: data stored on the server; the browser keeps only a session ID (usually in a cookie). PHP: session_start(); $_SESSION['user'] = 'ali';. More secure for login state.
  • URL rewriting / query strings: state is added to the URL (page.php?id=5&step=2) – works without cookies but is visible and limited in length.
  • Hidden form fields: <input type="hidden" name="step" value="2"> carry data from one form to the next.
  • Web storage: HTML5 localStorage (permanent) and sessionStorage (per tab) keep data on the client for JavaScript.
  • Tokens: e.g. JWT sent in the Authorization header for APIs and single-page apps.
  • Server-side storage: saving state in a database keyed by user ID.

Q5 – PHP login for existing users (with database table)

-- Database table
CREATE TABLE users (
  id        INT AUTO_INCREMENT PRIMARY KEY,
  username  VARCHAR(50)  NOT NULL UNIQUE,
  password  VARCHAR(255) NOT NULL,          -- stores password_hash() output
  email     VARCHAR(100) NOT NULL
);
<?php
// login.php
session_start();

function loginUser(PDO $db, string $username, string $password): bool {
    $stmt = $db->prepare("SELECT id, username, password FROM users WHERE username = ?");
    $stmt->execute([$username]);
    $user = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($user && password_verify($password, $user['password'])) {
        session_regenerate_id(true);           // prevent session fixation
        $_SESSION['user_id']  = $user['id'];
        $_SESSION['username'] = $user['username'];
        return true;
    }
    return false;
}

$db = new PDO("mysql:host=localhost;dbname=webapp;charset=utf8mb4", "root", "",
              [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $username = trim($_POST['username'] ?? '');
    $password = $_POST['password'] ?? '';
    if (loginUser($db, $username, $password)) {
        header("Location: dashboard.php");
        exit;
    } else {
        $error = "Invalid username or password.";
    }
}
?>
<!-- show $error above the login form if set -->

Passwords are stored with password_hash($pass, PASSWORD_DEFAULT) at registration and checked with password_verify(); prepared statements prevent SQL injection.

Q6 – Font styles in CSS3

  • font-family: chooses the typeface with fallbacks – font-family: "Open Sans", Arial, sans-serif; (generic families: serif, sans-serif, monospace, cursive, fantasy).
  • font-size: px, em, rem, %, keywords (small, large) and viewport units – font-size: 1.2rem;
  • font-style: normal, italic, oblique.
  • font-weight: normal, bold, bolder, lighter, or 100–900.
  • font-variant: normal or small-caps (CSS3 adds font-variant-caps, -numeric, -ligatures).
  • font-stretch: condensed, normal, expanded (if the font supports it).
  • line-height and the shorthand font: font: italic bold 16px/1.5 Georgia, serif;
  • @font-face (CSS3): loads custom web fonts from files (WOFF/WOFF2/TTF) so designers are not limited to fonts installed on the user’s computer; also Google Fonts via <link>.
@font-face {
  font-family: "MyFont";
  src: url("fonts/myfont.woff2") format("woff2"),
       url("fonts/myfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
h1 { font-family: "MyFont", Arial, sans-serif; font-size: 2rem; font-weight: 700; }
p  { font: italic 400 16px/1.6 Georgia, serif; font-variant: small-caps; }

Related text styles: text-shadow, text-transform, letter-spacing, word-spacing and text-decoration.

Answers prepared by Shining Study for revision. Check them against your class notes and teacher’s guidance.

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.