WEB - Record - 6th Sem
WEB - Record - 6th Sem
WEB - Record - 6th Sem
WEB TECHNOLOGY
AND ITS APPLICATIONS
Practical Assessment Record
By
SOUMYA RANJAN DAS(1CR20CS188)
SECTION C
Dept. of CSE, CMRIT
1
WEB TECHNOLOGY Practical Assessment
EVALUATION
Course Duration: 20th March- 2023 to 10th July 2023
Signature of Faculty:
Faculty In charge:
Anil D,
Assistant Professor
Dept of CSE, CMRIT
Page 2 of 39
WEB TECHNOLOGY Practical Assessment
Page 3 of 39
WEB TECHNOLOGY Practical Assessment
10 23/06/23 Write a PHP program to sort the student records which are
stored in the database using selection sort.
Total: ____/150
Avg(20): _____/20
Program:
Page 4 of 39
WEB TECHNOLOGY Practical Assessment
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
</head>
<body>
<div class="calculator">
<div class="keypad">
<button onclick="appendToInput('1')">1</button>
<button onclick="appendToInput('2')">2</button>
<button onclick="appendToInput('3')">3</button>
<button onclick="appendToInput('+')">+</button>
<button onclick="appendToInput('4')">4</button>
<button onclick="appendToInput('5')">5</button>
<button onclick="appendToInput('6')">6</button>
<button onclick="appendToInput('-')">-</button>
<button onclick="appendToInput('7')">7</button>
<button onclick="appendToInput('8')">8</button>
Page 5 of 39
WEB TECHNOLOGY Practical Assessment
<button onclick="appendToInput('9')">9</button>
<button onclick="appendToInput('*')">×</button>
<button onclick="appendToInput('0')">0</button>
<button onclick="appendToInput('.')">.</button>
<button onclick="clearInput()">C</button>
<button onclick="calculate()">=</button>
<button onclick="appendToInput('/')">÷</button>
</div>
</div>
<script src="sam.js"></script></body>
</html>
JAVASCRIPT:
function appendToInput(value) {
input.value += value;
function clearInput() {
input.value = "";
function calculate() {
try {
Page 6 of 39
WEB TECHNOLOGY Practical Assessment
input.value = eval(input.value);
} catch (error) {
input.value = "Error";
CSS:
.calculator {
width: 200px;
margin: 0 auto;
text-align: center;
input {
width: 100%;
margin-bottom: 10px;
font-size: 24px;
text-align: right;
padding: 5px;
button {
width: 50px;
height: 50px;
Page 7 of 39
WEB TECHNOLOGY Practical Assessment
font-size: 24px;
border: none;
outline: none;
background-color: #eee;
margin: 5px;
cursor: pointer;
button:hover {
background-color: #ddd;
.keypad {
display: grid;
grid-gap: 5px;
h1 {text-align: center;
Output:
Page 8 of 39
WEB TECHNOLOGY Practical Assessment
Program 2: Write a JavaScript that calculates the squares and cubes of the numbers from 0 to
10 and outputs HTML text that displays the resulting values in an HTML table format.
Page 9 of 39
WEB TECHNOLOGY Practical Assessment
Program:
<script>
document.write( "<table><tr><th>Number</th><th>Square</th><th>Cube</th></tr>")
for(var i=0;i<=10;i++){
document.write("</table")
</script>
Output:
Page 10 of 39
WEB TECHNOLOGY Practical Assessment
reaches50pt it displays “TEXT-SHRINKING” in BLUE color. Then the font size decreases
to 5pt.
Program:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Text Animation</title>
</head>
<body>
<div id="text">TEXT-GROWING</div>
<script src="script.js"></script>
</body>
</html>
JAVASCRIPT:
function displayText() {
let fontSize = 1;
setInterval(() => {
if (growing) {
fontSize++;
Page 11 of 39
WEB TECHNOLOGY Practical Assessment
textElement.style.color = "red";
growing = false;
textElement.innerText = "TEXT-SHRINKING";
textElement.style.color = "blue";
} else {
fontSize--;
growing = true;
textElement.innerText = "TEXT-GROWING";
textElement.style.color = "red";
}, 100);
displayText()
Output:
Page 12 of 39
WEB TECHNOLOGY Practical Assessment
Page 13 of 39
WEB TECHNOLOGY Practical Assessment
Program 4: Develop and demonstrate a HTML5 file that includes JavaScript script that
uses functions for the following problems:
Parameter: A string
Page 14 of 39
WEB TECHNOLOGY Practical Assessment
Parameter: A number
Output: The number with its digits in the reverse order
Program:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Program 4</title>
<script>
function lmv(){
str=str.toUpperCase();
var i,ch="";
for(i=0;i<str.length;i++){
ch=str.charAt(i);
function rev_num(){
Page 15 of 39
WEB TECHNOLOGY Practical Assessment
var n=num;
var rev=0,rem;
while(n>0){
rem=n%10;
rev=rev*10+rem;
n=Math.floor(n/10);
</script>
</head>
</div>
</body>
</html>
Output:
Page 16 of 39
WEB TECHNOLOGY Practical Assessment
Page 17 of 39
WEB TECHNOLOGY Practical Assessment
Name of the College, Branch, Year of Joining, and email id. Makeup sample data for 3
students. Create a CSS style sheet and use it to display the document.
Program code:
<?xml version="1.0" encoding="UTF-8"?>
<studentdata>
<header>
<Usn>USN: 1CR20CS188</Usn>
</header>
<students>
<student1>
<h1>STUDENT1 DETAILS</h1>
<usn>USN: 1CR20CS188</usn>
<college>COLLEGE: CMRIT</college>
<email>EMAIL: [email protected]</email>
</student1>
<student2>
<h1>STUDENT2 DETAILS</h1>
<name>NAME: BHARATH</name>
<usn>USN: 1CR20CS201</usn>
<college>COLLEGE: CMRIT</college>
Page 18 of 39
WEB TECHNOLOGY Practical Assessment
<email>EMAIL: [email protected]</email>
</student2>
<student3>
<h1>STUDENT3 DETAILS</h1>
<usn>USN: 1CR20IS179</usn>
<college>COLLEGE: CMRIT</college>
<email>EMAIL: [email protected]</email>
</student3>
</students>
</studentdata>
CSS:
*{
display: block;
margin-top: 7px;
header {
font-size: 20px;
Page 19 of 39
WEB TECHNOLOGY Practical Assessment
color: brown;
padding-left: 30%;
font-weight: 600;
students {
padding-left: 20px;
font-size: 18px;
h1 {
color: #191f1d;
font-weight: bolder;
font-size: 110%;
padding-bottom: 3px;
padding-top: -10px;
student2 {
margin-top: 30px;
student3 {
margin-top: 30px;
name {
color: red;
Page 20 of 39
WEB TECHNOLOGY Practical Assessment
usn {
Output:
Program 6: Write a PHP program to keep track of the number of visitors visiting the web
page and to display this count of visitors, with proper headings.
Program:
<?php
Page 21 of 39
WEB TECHNOLOGY Practical Assessment
$counterFile = "visitor_count.txt";
updated count
function incrementVisitorCount($counterFile) {
$count++;
file_put_contents($counterFile, $count);
return $count;
$visitorCount = incrementVisitorCount($counterFile);
?>
<!DOCTYPE html>
<html>
<head>
<title>Visitor Count</title><style>
#visitor-count {
font-size: 24px;
text-align: center;
Page 22 of 39
WEB TECHNOLOGY Practical Assessment
</style>
</head>
<body>
<h1>Welcome to My Website</h1>
<div id="visitor-count">
<h2>Visitor Count:</h2>
</div>
</body>
</html>
OUTPUT:
Program 7: Write a PHP program to display a digital clock which displays the current time
of the server.
Program:
Page 23 of 39
WEB TECHNOLOGY Practical Assessment
<!DOCTYPE html>
<html>
<head>
<title>Digital Clock</title>
<script>
function updateClock() {
seconds;
document.getElementById("clock").innerHTML =
timeString;
setInterval(updateClock, 1000);
</script>
<style>
#clock {
font-size: 48px;
font-weight: bold;
Page 24 of 39
WEB TECHNOLOGY Practical Assessment
}</style>
</head>
<body>
<h1>Digital Clock</h1>
<div id="clock"></div>
</body>
</html>
OUTPUT:
Program 8:
Page 25 of 39
WEB TECHNOLOGY Practical Assessment
Program:
<!DOCTYPE html> <html>
<head>
</head>
<body>
<table>
autocomplete="off"/></td></tr>
autocomplete="off"/></td></tr>
<select name="op">
<option>Select Operation</option>
<option value="+">Addition</option>
<option value="-">Subtraction</option>
<option value="*">Multiplication</option>
<option value="/">Division</option>
<option value="%">Remainder</option>
</select>
Page 26 of 39
WEB TECHNOLOGY Practical Assessment
</td></tr>
</table>
</form>
<?php if(isset($_POST['pop'])) {
$result = 0;
switch($op) {
break;
break;
break;
break;
Page 27 of 39
WEB TECHNOLOGY Practical Assessment
break;
?>
</body>
</html>
Output:
Page 28 of 39
WEB TECHNOLOGY Practical Assessment
Program:
<?php
echo"1CR20CS188";
header('Content-Type: text/plain');
echo "\n\n\n";
echo "The order of the matrix A is:" . count($matrix1) . "x" . count($matrix1[0]); echo "\n";
echo "The order of the matrix B is:" . count($matrix2) . "x" . count($matrix2[0]); echo "\n";
$rowCount = count($matrix1);
$colCount = count($matrix1[0]);
for ($r = 0; $r < $rowCount; $r++) { for ($c = 0; $c < $colCount; $c++) {
echo "\n";
Page 29 of 39
WEB TECHNOLOGY Practical Assessment
echo "\n";
echo "\n";
$rowCount = count($matrix1);
$colCount = count($matrix1[0]);
$rowCount2 = count($matrix2);
$colCount2 = count($matrix2[0]);
}echo "\n";
$rowCount = count($matrix1);
Page 30 of 39
WEB TECHNOLOGY Practical Assessment
$colCount = count($matrix1[0]);
$rowCount2 = count($matrix2);
$colCount2 = count($matrix2[0]);
if($colCount == $rowCount2)
echo "\n";
} else {
?>
Output:
Page 31 of 39
WEB TECHNOLOGY Practical Assessment
Program 9:
Page 32 of 39
WEB TECHNOLOGY Practical Assessment
Write a PHP program named states.py that declares a variable states with value “Mississippi
Alabama Texas Massachusetts Kansas". write a PHP program that does the following:
5. Search for a word in variable states that ends in xas. Store this word in element0 of a
list named states List.
6. Search for a word in states that begins with k and ends in s. Perform a case-
insensitive comparison. [Note: Passing re.Ias a second parameter to method compile
performs a case-insensitive comparison.] Store this word in element1 of states List.
7. Search for a word in states that begins with M and ends in s. Store this word in
element 2 of the list.
Search for a word in states that ends in a. Store this word in element 3 of the listCode:
Program:
<?php
echo"1CR20CS188";
header('Content-Type: text/plain');
$statesArray = [];
$i = 0;
if (preg_match('/xas$/', ($state))) {
$statesArray[$i] = ($state);
$i = $i + 1;
Page 33 of 39
WEB TECHNOLOGY Practical Assessment
if (preg_match('/^k.*s$/i', ($state))) {
$statesArray[$i] = ($state);
$i = $i + 1;
echo "\nThe states that begins with k ans ends in s:" . $state;
foreach($states1 as $state) {
if (preg_match('/^M.*s$/', ($state))) {
$statesArray[$i] = ($state);
$i = $i + 1;
echo "\nThe states that begins with M and ends in s:" . $state;
foreach($states1 as $state) {
$i = $i + 1;
foreach ($statesArray as $element => $value) { print( "\n" . $value . " is the element " .
$element);}
?>
Output:
Page 34 of 39
WEB TECHNOLOGY Practical Assessment
Program 10: Write a PHP program to sort the student records which are stored in the database
using selection sort.
Page 35 of 39
WEB TECHNOLOGY Practical Assessment
PROGRAM:
<?php
echo"soumya ranjan\n";
echo"1CR20CS188";
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "weblab";
$a=[];
if ($conn->connect_error)
$result = $conn->query($sql);
echo "<br>";
echo "<tr>";
echo "<th>USN</th><th>NAME</th><th>Address</th></tr>";
if ($result->num_rows> 0)
while($row = $result->fetch_assoc())
Page 36 of 39
WEB TECHNOLOGY Practical Assessment
echo "<tr>";
array_push($a,$row["usn"]);
else
echo "</table>";
$n=count($a);
$b=$a;
$pos= $i;
$pos= $j;
if ( $pos!= $i )
$temp=$a[$i];
$a[$i] = $a[$pos];
Page 37 of 39
WEB TECHNOLOGY Practical Assessment
$a[$pos] = $temp;
$c=[];
$d=[];
while($row = $result->fetch_assoc())
for($i=0;$i<$n;$i++)
if($row["usn"]== $a[$i])
$c[$i]=$row["name"];
$d[$i]=$row["addr"];
echo "<br>";
echo "<tr>";
echo "<th>USN</th><th>NAME</th><th>Address</th></tr>";
Page 38 of 39
WEB TECHNOLOGY Practical Assessment
for($i=0;$i<$n;$i++)
echo "<tr>";
echo "</table>";
$conn->close();
?>
Output:
Page 39 of 39