0% found this document useful (0 votes)
54 views19 pages

21.2 Web Answers

This document contains details of an online examination for a Web Application Development module taken by a student named A.C.J. De Silva. The student declares that the work submitted is their original work and certifies the accuracy of the student details provided. The examination contains two parts - multiple choice questions in Part A and longer answer questions in Part B.

Uploaded by

minhaaz mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views19 pages

21.2 Web Answers

This document contains details of an online examination for a Web Application Development module taken by a student named A.C.J. De Silva. The student declares that the work submitted is their original work and certifies the accuracy of the student details provided. The examination contains two parts - multiple choice questions in Part A and longer answer questions in Part B.

Uploaded by

minhaaz mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Faculty of Computing , Online Examinations 2022

STUDENT NAME A.C.J. De Silva

INDEX NUMBER 22795 YEAR OF STUDY AND 1st year 2nd semester
(NSBM) SEMESTER

MODULE NAME Web Application Development


(As per the paper)

MODULE CODE SE 102.3

MODULE LECTURER Chaminda Wijesinghe DATE SUBMITTED 2022/08/13

For office purpose only:

GRADE/MARK

COMMENTS

Declaration

PLEASE TICK TO INDICATE THAT YOU HAVE SATISFIED THESE REQUIREMENTS

✓ I have carefully read the instructions provided by the Faculty


✓ I understand what plagiarism is and I am aware of the University’s policy in this regard.
✓ I declare that the work hereby submitted is my own original work. Other people’s work has been
used (either from a printed source, Internet or any other source), has been properly
acknowledged and referenced in accordance with the NSBM’s requirements.
✓ I have not used work previously produced by another student(s) or any other person to hand in as
my own.
✓ I have not allowed, and will not allow, anyone to copy my work with the intention of passing it
off as his or her own work.
✓ I hereby certify that the individual detail information given (name, index number and module
details) in the cover page are thoroughly checked and are true and accurate.

I hereby certify that the statements I have attested to above have been made in good faith and are true
and correct. I also certify that this is my own work and I have not plagiarized the work of others and
not participated in collusion.

Date: …2022/08/13………… **E- Signature:


**Please attach a photo/image of your signature in the space provided
Part A

01. a

02. d

03. a

04. d

05. c

06. b

07. c

08. b

09. d

10. a

11. a

12. c

13. d

14. b

15. c
Part B
Question 01)

a)

Login.html

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" type="text/css" href="style.css">

<title></title>

</head>

<body>

<!-- login form -->

<form action="#" method="post" name="loginform" class="login-form">

<div class="header">
<h2>Login</h2>

<p>See whats going on in your college today</p>

</div>

<div class="container">

<label for="text"><b>Login as</b></label>

<select class="dropdown" id="access" name="access" required>

<option value="student">Student</option>

<option value="staff">Staff</option>

</select><br>

<label for="text"><b>USN</b></label>

<input type="text" placeholder="USN" name="" id="usn" required>

<label for="psw"><b>Password</b></label>

<input type="password" placeholder="Password" name="psw" id="psw"


required>

<button type="submit" onclick="validateform()">Login</button>

<span class="psw">Forgot <a href="new.html">Password?</a></span>

</div>

</form>

</body>

</html>
style.css

*{

margin: 0;

padding: 0;

body{

font-family: 'Trebuchet MS', sans-serif;

input[type=text], input[type=password]{

width: 100%;

padding: 10px 17px;

margin: 8px 0;

display: inline-block;

border: 1px solid #ccc;

box-sizing: border-box;

button {

background-color: #4fb33b;

color: white;

padding: 10px 15px;


margin: 8px 0;

border: none;

cursor: pointer;

width: 100%;

.dropdown{

width: 100%;

padding: 10px 17px;

margin: 8px 0;

display: inline-block;

border: 1px solid #ccc;

box-sizing: border-box;

.header{

background-color: #04AA6D;

height: 120px;

h2{

padding-top: 30px;

padding-left: 20px;

color: #fff;

p{
padding-top: 3px;

padding-left: 20px;

color: #fff;

.login-form{

border: 3px solid #f1f1f1;

margin: 10px auto;

width: 50%;

background-color: #f0f5f5;

.cancelbtn {

width: auto;

padding: 10px 18px;

background-color: #f44336;

.container {

padding: 16px;

margin: 15px auto;

span.psw {

float: right;

padding-top: 2px;

}
b)

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

</head>

<body>

<p onmouseover="document.body.style.backgroundColor ='yellow';"


onmouseout="document.body.style.backgroundColor ='red';">Lorem ipsum dolor sit
amet, consectetur adipiscing elit. Sed finibus nisl eu massa mollis porttitor. Aliquam
blandit purus ac augue elementum, at hendrerit magna efficitur. Vestibulum ante
ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Cras ut sodales
purus. Fusce a metus sit amet nisl placerat interdum. Duis auctor tincidunt nulla, ac
vestibulum lacus fermentum id. Integer cursus eu velit vel sollicitudin. Proin
vestibulum semper massa vel interdum. Duis mollis gravida ligula. Quisque luctus
convallis facilisis. Cras pellentesque nulla non sem commodo varius.</p>

</body>

</html>
c)

i. ,ii. , iii.

<script>

function validateform() {

var pw = document.getElementById("psw").value;

if(pw == "") {

document.getElementById("message").innerHTML = "Please Enter your


password..!";

return false;

if(pw.length < 6)

document.getElementById("message").innerHTML = "Password length


must be atleast 8 characters..!";

return false;

else

alert("Password is correct");

}
if(document.loginform.Login.value == "")

window.alert("Please select Student or Staff..!");

</script>
Question 02)

a)

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Question 02</title>

</head>

<body>

<style type="text/css">

div {

width: 50%;

padding: 10px;

border: 5px solid gray;

margin: 0;

h1{

text-align: center;

font-weight: bold;

text-decoration-line: underline;

p{

text-align: justify;

font-family: Garamond;

}
h4{

color: blue;

font-family: Arial;

</style>

<div>

<h1>Vacncies at our Marketing Department</h1>

<p>If you are interested, please forward your CV to Mr. Yashoda


Asst.Manager Hr & Admin. <b>hr@nsbm.lk</b></p>

<p>For future informtion call on:</p>

<h4>0115445000</h4>

</div>

</body>

</html>
b)

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

</head>

<body>

<button onclick="myFunction()">Button</button>

<script>

function myFunction() {

alert("This is a alert!");

</script>

</body>

</html>
c)

<!DOCTYPE html>

<html>

<head>

<title> </title>

</head>

<body>

<button onclick="myFunction()">Button</button>

<p id="answer"></p>

<script>

function myFunction() {

let arae;

let height = prompt("Please enter height:");

let width = prompt("Please enter width:");

area = height*width;

document.getElementById("answer").innerHTML = "Rectangle area is = "+ area;

</script>

</body>

</html>
Question 03)

a)b)c)

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

</head>

<body>

<form action="site.php" method="GET">

<table>

<tr>

<td>Name</td>

<td><input type="text" name="name"></td>

</tr>

<tr>

<td>Sex</td>

<td>Male <input type="radio" name="male"> Female <input type="radio"


name="female"></td>

</tr>

<tr>

<td>Address</td>

<td><input type="text" name="address"></td>

</tr>

<tr>

<td>Age</td>

<td><input type="text" name="age"></td>


</tr>

<tr>

<td><button type="submit">Ok</button></td>

<td><button type="reset">Cancel</button></td>

</tr>

</table>

</form>

<?php

$name = $_GET["name"];

$male = $_GET["male"];

$female = $_GET["female"];

$address = $_GET["address"];

$age = $_GET["age"];

echo "name: $name";

if (sex_1=="male"){

echo "Gender: $male";

else{

echo "Gender: $female";

echo "Address: $address";

echo "Age: $age";

?>

</body>

</html>
b.

<html>

<body>

<form action="site.php" method="POST">

<table>

<tr>

<td>Employee Number</td>

<td><input type="text" name="emp_num"></td>

</tr>

<tr>

<td>New Salary</td>

<td><input type="text" name="new_sal"></td>

</tr>

<tr>

<td><button type="submit">Update Salary</button></td>

<td><button type="reset">Cancel</button></td>

</tr>

</table>

</form>

<?php

$emp_num=_name = $_POST["emp_name"];

$new_sal = $_POST["new_sal"];

$user = 'root';

$pass = '';

$db = 'Employee';
$connection = new $mysqli('localhost', $user, $pass, $db);

$query = "UPDATE Salary set Salary=$new_sal where Emp_no=$emp_num";

$run = $mysqli_query($connection, $query) or die("Error");

?>

</body>

</html>

c.

<button onclick="window.location.href='results.php'">Click to view the


results</button>

<!-- results.php -->

<?php

$user = 'root';

$pass = '';

$db = 'Employee';

$connection = new $mysqli('localhost', $user, $pass, $db);

$query = "SELECT * FROM Salary";

$result_Emp = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {

while($row = mysqli_fetch_assoc($result_Emp)) {

echo "Employee Number: " . $row["Emp_no"]. " --- Salary: " . $row["Salary"].
" <br/>";

}
}

else {

echo "Table is empty";

mysqli_close($connection);

?>

You might also like