Web Technology Lab Assignment
Web Technology Lab Assignment
Sl. Page
Date Signature/
No. Name of Practical / Assignment No.
Remarks
Sl. Page
Date Signature/
No. Name of Practical / Assignment No.
Remarks
</body>
</html>
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...04..
Question No =2
Write a HTML program for demonstrating Hyperlinks. a. Navigation from one page to
another. b. Navigation within the page.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Hyperlinks Demonstration</title>
<style>
body {Any change in the source program after the compilation requires recompiling the entire code.
background-color:
Any orange;
change in the source program during the translation does not require retranslation of the entire code.
color: white; Errors are displayed in Compiler after Compiling together at the current time.
font-family: Arial, sans-serif; Errors are displayed in every single line.
Thefont-size:
compiler20px; /* code
can see Font upfront
size for all text helps
which */ in running the code faster because of performing Optimization.
} The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
h2 { Compilers.
text-align: center; /* Center-align
It doesthe
notheading
require*/source code for later execution.
text-decoration: underline; /* Underline
It requiresthe heading
source */ for later execution.
code
} Execution of the program takes place only after the whole program is compiled.
a{ Execution of the program happens after every line is checked or evaluated.
color: white; /* Hyperlink
Compilerscolor
more */often take a large amount of time for the source code.
text-decoration: none;
In/*comparison,
Remove underline from links
Interpreters take */
less time for the source code.
} CPU utilization is more in the case of a Compiler.
a:hover { CPU utilization is less in the case of a Interpreter.
text-decoration: underline;
Question No =2 /* What
Underline links
is the on hover
function */
of Lexical Analysis phase of a compiler?
}
</style>
</head>
<body>
<h2>Hyperlinks Demonstration</h2>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Pracrical Assignment
Assignment No. …1……. Page No...05..
<br><br>
<tr>
<td>2.Maharashtra</td>
<td align="center">48</td>
</tr>
<tr>
<td>3.West Bengal</td>
<td align="center">42</td>
</tr>
<tr> Any change in the source program after the compilation requires recompiling the entire code.
<td>4.Bihar</td>
Any change in the source program during the translation does not require retranslation of the entire code.
<td align="center">40</td>
Errors are displayed in Compiler after Compiling together at the current time.
</tr> Errors are displayed in every single line.
<tr>compiler can see code upfront which helps in running the code faster because of performing Optimization.
The
<td>5.Tamil Nadu</td>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<td align="center">39</td> Compilers.
</tr> It does not require source code for later execution.
</table> It requires source code for later execution.
</body> Execution of the program takes place only after the whole program is compiled.
</html> Execution of the program happens after every line is checked or evaluated.
Output Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...08..
Question No =4
Write a HTML program to develop a static Home Page using frames.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Static Home Page</title>
<style>
body {
background-color:
Any change in theorange;
source program after the compilation requires recompiling the entire code.
Any color:
changewhite;
in the source program during the translation does not require retranslation of the entire code.
font-family: Arial,
Errors aresans-serif;
displayed in Compiler after Compiling together at the current time.
text-align: center; /* Center-align text
Errors are*/displayed in every single line.
}
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
h1 {
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
text-decoration: underline; /* Underline theCompilers.
heading */
} It does not require source code for later execution.
</style> It requires source code for later execution.
</head> Execution of the program takes place only after the whole program is compiled.
<frameset rows="20%,*">
Execution of the program happens after every line is checked or evaluated.
<!-- Top Frame: Logo and Navigation
Compilers more oftenLinks
take a-->
large amount of time for the source code.
<frame src="header.html" name="headerFrame"
In comparison, style="background-color:
Interpreters take less time for the source orange;
code. color: white; text-
align: center;"> CPU utilization is more in the case of a Compiler.
<!-- Middle Frame: Split intoCPU
Leftutilization
and MainisContent -->case of a Interpreter.
less in the
<frameset cols="30%,70%">
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<frame src="menu.html" name="menuFrame" style="background-color: orange; color: white;">
<frame src="content.html" name="contentFrame">
</frameset>
</frameset>
</html>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...09..
<body>
<h2>Menu</h2>
<ul>
<li><a href="cse.html" target="contentFrame" style="color: white;">CSE</a></li>
<li><a href="ece.html" target="contentFrame" style="color: white;">ECE</a></li>
<li><a href="eee.html" target="contentFrame" style="color: white;">EEE</a></li>
<li><a href="mech.html" target="contentFrame" style="color: white;">Mechanical</a></li>
</ul>
</body>
</html> Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
<!-- content.htmlErrors
--> are displayed in Compiler after Compiling together at the current time.
<!DOCTYPE html> Errors are displayed in every single line.
<html>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<head>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<style> Compilers.
body { It does not require source code for later execution.
background-color: orange; It requires source code for later execution.
color: white; Execution of the program takes place only after the whole program is compiled.
text-align: center;Execution of the program happens after every line is checked or evaluated.
} Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
</style> CPU utilization is less in the case of a Interpreter.
</head> Question No =2 What is the function of Lexical Analysis phase of a compiler?
<body>
<h2>Welcome to the Content Area</h2>
<p>This is where the main content will appear when links are clicked.</p>
</body>
</html>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Pracrical Assignment
Assignment No. …1……. Page No...11..
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...12..
Question No =5
Write a HTML program to develop a static Registration Form.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Professional Registration Form</title>
<style>
body {
background-color:
Any change inorange;
the source program after the compilation requires recompiling the entire code.
color:
Any white;in the source program during the translation does not require retranslation of the entire code.
change
font-family: Arial,
Errorssans-serif;
are displayed in Compiler after Compiling together at the current time.
margin: 0; Errors are displayed in every single line.
Thepadding:
compiler0;can see code upfront which helps in running the code faster because of performing Optimization.
} The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
.container { Compilers.
max-width: 600px; /* Set maximum width
It does not for form
require */ code for later execution.
source
margin: 50px auto; /* Center the
It form vertically
requires sourceand horizontally
code */
for later execution.
padding: 50px;
Execution of the program takes place only after the whole program is compiled.
background-color: rgba(255,
Execution 255,
of the 255, 0.1);
program /* Slightly
happens aftertransparent
every line iswhite background
checked */
or evaluated.
border-radius: 10px;
Compilers more often take a large amount of time for the source code.
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
In comparison, /* Add shadow
Interpreters fortime
take less a professional lookcode.
for the source */
} CPU utilization is more in the case of a Compiler.
h1 { CPU utilization is less in the case of a Interpreter.
text-align: center;
Question No =2 What is the function of Lexical Analysis phase of a compiler?
text-decoration: underline;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
gap: 15px; /* Space between form elements */
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...13..
label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
input, textarea, select, button {
width: 100%; /* Full-width input fields */
padding: 10px;
font-size: 16px;
border: none;
Any change in the source program after the compilation requires recompiling the entire code.
border-radius:
Any change in5px;
the source program during the translation does not require retranslation of the entire code.
} Errors are displayed in Compiler after Compiling together at the current time.
input, textarea, select { Errors are displayed in every single line.
background-color:
The compiler can seewhite;
code upfront which helps in running the code faster because of performing Optimization.
color:
Theorange;
Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
} Compilers.
input:focus, textarea:focus, select:focus
It does not{require source code for later execution.
outline: none; It requires source code for later execution.
box-shadow: 0 Execution
0 5px white;
of /*
theHighlight
programinput
takeson focus
place */ after the whole program is compiled.
only
} Execution of the program happens after every line is checked or evaluated.
button { Compilers more often take a large amount of time for the source code.
background-color: white;
In comparison, Interpreters take less time for the source code.
color: orange; CPU utilization is more in the case of a Compiler.
font-weight: bold; CPU utilization is less in the case of a Interpreter.
cursor: pointer; Question No =2 What is the function of Lexical Analysis phase of a compiler?
transition: background-color 0.3s, color 0.3s;
}
button:hover {
background-color: lightgray;
color: black;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...14..
</style>
</head>
<body>
<div class="container">
<h1>Registration Form</h1>
<form>
label {
font-weight: bold;
text-align: left;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 10px;
font-size: 16px;
border: none;
Any change in the source program after the compilation requires recompiling the entire code.
border-radius: 5px;
Any change in the source program during the translation does not require retranslation of the entire code.
background-color: white;
Errors are displayed in Compiler after Compiling together at the current time.
color: orange;
Errors are displayed in every single line.
}
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
input:focus {
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
outline: none;
Compilers.
box-shadow: 0 0 5px white; /* Highlight input on focus */
It does not require source code for later execution.
}
It requires source code for later execution.
button {
Execution of the program takes place only after the whole program is compiled.
background-color: white;
Execution of the program happens after every line is checked or evaluated.
color: orange;
Compilers more often take a large amount of time for the source code.
font-size: 16px;
In comparison, Interpreters take less time for the source code.
font-weight: bold;
CPU utilization is more in the case of a Compiler.
border: none;
CPU utilization is less in the case of a Interpreter.
padding: 10px;
Question No =2 What is the function of Lexical Analysis phase of a compiler?
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
button:hover {
background-color: lightgray;
color: black;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...19..
.forgot-password {
margin-top: 10px;
font-size: 14px;
}
.forgot-password a {
color: white;
text-decoration: none;
}
.forgot-password a:hover {
text-decoration: underline;
Any change in the source program after the compilation requires recompiling the entire code.
}
Any change in the source program during the translation does not require retranslation of the entire code.
</style>
Errors are displayed in Compiler after Compiling together at the current time.
</head>
Errors are displayed in every single line.
<body>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<div class="container">
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<h1>Login</h1>
Compilers.
<form>
It does not require source code for later execution.
<!-- Username Field -->
It requires source code for later execution.
<div>
Execution of the program takes place only after the whole program is compiled.
<label for="username">Username:</label>
Execution of the program happens after every line is checked or evaluated.
<input type="text" id="username" name="username" placeholder="Enter your username" required>
Compilers more often take a large amount of time for the source code.
</div>
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
<!-- Password Field -->
CPU utilization is less in the case of a Interpreter.
<div>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter your password"
required>
</div>
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...21..
Question No =7
Write a HTML program to develop a static Web Page for Catalog.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Product Catalog</title>
<style>
body {
background-color:
Any change inorange;
the source program after the compilation requires recompiling the entire code.
color:
Any white;in the source program during the translation does not require retranslation of the entire code.
change
font-family: Arial,
Errorssans-serif;
are displayed in Compiler after Compiling together at the current time.
margin: 0; Errors are displayed in every single line.
Thepadding:
compiler0;can see code upfront which helps in running the code faster because of performing Optimization.
} The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
.container { Compilers.
max-width: 800px; /* Set maximum width
It does not for the
require catalog
source code*/for later execution.
margin: 50px auto; /* Center the
It catalog
requires*/source code for later execution.
padding: 20px;
Execution of the program takes place only after the whole program is compiled.
background-color: rgba(255,
Execution 255,
of the 255, 0.1);
program /* Transparent
happens white
after every line background */evaluated.
is checked or
border-radius: 10px;
Compilers more often take a large amount of time for the source code.
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
In comparison, /* Shadow
Interpreters forless
take a professional
time for thelook */ code.
source
text-align: center; CPU utilization is more in the case of a Compiler.
} CPU utilization is less in the case of a Interpreter.
h1 { Question No =2 What is the function of Lexical Analysis phase of a compiler?
text-decoration: underline;
margin-bottom: 20px;
}
.catalog-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
margin-bottom: 15px;
border: 1px solid white; /* Add a border between items */
border-radius: 5px;}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...22..
.catalog-item img {
width: 100px;
height: 100px;
border-radius: 5px;
}
.catalog-item div {
text-align: left;
flex: 1;
margin: 0 15px;
}
Any change in the source program after the compilation requires recompiling the entire code.
.catalog-item h3 {
Any change in the source program during the translation does not require retranslation of the entire code.
margin: 0;
Errors are displayed in Compiler after Compiling together at the current time.
font-size: 18px;
Errors are displayed in every single line.
}
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
.catalog-item p {
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
margin: 5px 0;
Compilers.
font-size: 14px;
It does not require source code for later execution.
}
It requires source code for later execution.
.catalog-item button {
Execution of the program takes place only after the whole program is compiled.
background-color: white;
Execution of the program happens after every line is checked or evaluated.
color: orange;
Compilers more often take a large amount of time for the source code.
border: none;
In comparison, Interpreters take less time for the source code.
padding: 10px 15px;
CPU utilization is more in the case of a Compiler.
font-size: 16px;
CPU utilization is less in the case of a Interpreter.
border-radius: 5px;
Question No =2 What is the function of Lexical Analysis phase of a compiler?
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
.catalog-item button:hover {
background-color: lightgray;
color: black;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...23..
</style>
</head>
<body>
<div class="container">
<h1>Product Catalog</h1>
th, td {
border: 1px solid white; /* Add border around table cells */
padding: 10px;
text-align: center;
}
th {
background-color: rgba(255, 255, 255, 0.2); /* Slightly transparent white for headers */
}
td {
Any change in the source program after the compilation requires recompiling the entire code.
background-color: rgba(255, 255, 255, 0.1); /* Slightly transparent white for cells */
Any change in the source program during the translation does not require retranslation of the entire code.
}
Errors are displayed in Compiler after Compiling together at the current time.
.total {
Errors are displayed in every single line.
font-size: 18px;
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
font-weight: bold;
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
text-align: right;
Compilers.
}
It does not require source code for later execution.
It requires source code for later execution.
button {
Execution of the program takes place only after the whole program is compiled.
background-color: white;
Execution of the program happens after every line is checked or evaluated.
color: orange;
Compilers more often take a large amount of time for the source code.
border: none;
In comparison, Interpreters take less time for the source code.
padding: 10px 15px;
CPU utilization is more in the case of a Compiler.
font-size: 16px;
CPU utilization is less in the case of a Interpreter.
border-radius: 5px;
Question No =2 What is the function of Lexical Analysis phase of a compiler?
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
button:hover {
background-color: lightgray;
color: black;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...27..
</style>
</head>
<body>
<div class="container">
<h1>Shopping Cart</h1>
<table>
<thead>
<tr>
<th>Item</th>
<th>Price</th>
Any change in the source program after the compilation requires recompiling the entire code.
<th>Quantity</th>
Any change in the source program during the translation does not require retranslation of the entire code.
<th>Subtotal</th>
Errors are displayed in Compiler after Compiling together at the current time.
</tr>
Errors are displayed in every single line.
</thead>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<tbody>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
<!-- Row 1 -->
It does not require source code for later execution.
<tr>
It requires source code for later execution.
<td>GATE 2025 COURSE (Made Easy)</td>
Execution of the program takes place only after the whole program is compiled.
<td>25000.00/-</td>
Execution of the program happens after every line is checked or evaluated.
<td>2</td>
Compilers more often take a large amount of time for the source code.
<td>50000.00/-</td>
In comparison, Interpreters take less time for the source code.
</tr>
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
<!-- Row 2 -->
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<tr>
<td>GATE 2025 COURSE (Unacademy)</td>
<td>20000.00/-</td>
<td>1</td>
<td>20000.00/-</td>
</tr>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...28..
.table-style th {
background-color: rgba(255, 255, 255, 0.2);
}
.table-style td {
background-color: rgba(255, 255, 255, 0.1);
}
</style>
</head>
<body>
<h1>Cascading Stylesheets Demo</h1>
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
<!-- Inline Styles -->
Errors are displayed in Compiler after Compiling together at the current time.
<p style="color: yellow; font-size: 20px;">
Errors are displayed in every single line.
This paragraph uses **Inline CSS** for its styling.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
</p>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
<!-- Embedded Styles -->
It does not require source code for later execution.
<div class="embedded-style">
It requires source code for later execution.
This text is styled using **Embedded CSS** defined in the `<style>` tag within the HTML `<head>`.
Execution of the program takes place only after the whole program is compiled.
</div>
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
<!-- External Styles -->
In comparison, Interpreters take less time for the source code.
<table class="table-style">
CPU utilization is more in the case of a Compiler.
<thead>
CPU utilization is less in the case of a Interpreter.
<tr>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<th>Feature</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Inline CSS</td>
<td>Applies styles directly to an element using the `style` attribute.</td>
</tr>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...31..
<tr>
<td>Embedded CSS</td>
<td>Defines styles within a `<style>` tag in the HTML `<head>` section.</td>
</tr>
<tr>
<td>External CSS</td>
<td>Links an external `.css` file to the HTML document for consistent styling.</td>
</tr>
</tbody>
</table>
Any change in the source program after the compilation requires recompiling the entire code.
</body>
Any change in the source program during the translation does not require retranslation of the entire code.
</html>
Errors are displayed in Compiler after Compiling together at the current time.
Output Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...32..
Question No =10
Write a javascript program to validate USER LOGIN page.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>User Login</title>
<style>
body {
background-color:
Any change inorange;
the source program after the compilation requires recompiling the entire code.
color:
Any white;in the source program during the translation does not require retranslation of the entire code.
change
font-family: Arial,
Errorssans-serif;
are displayed in Compiler after Compiling together at the current time.
margin: 0; Errors are displayed in every single line.
Thepadding:
compiler0;can see code upfront which helps in running the code faster because of performing Optimization.
text-align: center;works by line working of Code, that’s why Optimization is a little slower compared to
The Interpreter
} Compilers.
.container { It does not require source code for later execution.
max-width: 400px; /* Set maximum width source
It requires for the code
login for
form */ execution.
later
margin: 100px auto; /*of
Execution Center the logintakes
the program formplace
*/ only after the whole program is compiled.
padding: 20px;Execution of the program happens after every line is checked or evaluated.
background-color: rgba(255,
Compilers 255,often
more 255, 0.1);
take /* Transparent
a large amountwhite background
of time */ code.
for the source
border-radius: 10px; In comparison, Interpreters take less time for the source code.
box-shadow: 0 4px 8px rgba(0,
CPU0,utilization
0, 0.2); /* isShadow
more infor a professional
the look */
case of a Compiler.
} CPU utilization is less in the case of a Interpreter.
h1 { Question No =2 What is the function of Lexical Analysis phase of a compiler?
text-decoration: underline;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
gap: 15px; /* Space between form fields */
}
label {
font-weight: bold;
text-align: left;}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...33..
input {
width: 100%;
padding: 10px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: white;
color: orange;
}
input:focus {
Any change in the source program after the compilation requires recompiling the entire code.
outline: none;
Any change in the source program during the translation does not require retranslation of the entire code.
box-shadow: 0 0 5px white; /* Highlight input on focus */
Errors are displayed in Compiler after Compiling together at the current time.
}
Errors are displayed in every single line.
button {
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
background-color: white;
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
color: orange;
Compilers.
border: none;
It does not require source code for later execution.
padding: 10px;
It requires source code for later execution.
font-size: 16px;
Execution of the program takes place only after the whole program is compiled.
font-weight: bold;
Execution of the program happens after every line is checked or evaluated.
border-radius: 5px;
Compilers more often take a large amount of time for the source code.
cursor: pointer;
In comparison, Interpreters take less time for the source code.
transition: background-color 0.3s, color 0.3s;
CPU utilization is more in the case of a Compiler.
}
CPU utilization is less in the case of a Interpreter.
button:hover {
Question No =2 What is the function of Lexical Analysis phase of a compiler?
background-color: lightgray;
color: black;
}
.error {
color: red;
font-size: 14px;
margin-top: 10px;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...34..
</style>
</head>
<body>
<div class="container">
<h1>User Login</h1>
<form id="loginForm">
<!-- Username Field -->
<div>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter your username">
Any change in the source program after the compilation requires recompiling the entire code.
</div>
Any change in the source program during the translation does not require retranslation of the entire code.
<!-- Password Field -->
Errors are displayed in Compiler after Compiling together at the current time.
<div>
Errors are displayed in every single line.
<label for="password">Password:</label>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<input type="password" id="password" name="password" placeholder="Enter your password">
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
</div>
Compilers.
<!-- Submit Button -->
It does not require source code for later execution.
<button type="button" onclick="validateLogin()">Login</button>
It requires source code for later execution.
</form>
Execution of the program takes place only after the whole program is compiled.
<p id="errorMessage" class="error"></p>
Execution of the program happens after every line is checked or evaluated.
</div>
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
<script>
CPU utilization is more in the case of a Compiler.
// JavaScript function to validate login form
CPU utilization is less in the case of a Interpreter.
function validateLogin() {
Question No =2 What is the function of Lexical Analysis phase of a compiler?
const username = document.getElementById('username').value.trim();
const password = document.getElementById('password').value.trim();
const errorMessage = document.getElementById('errorMessage');
</head>
<body>
<div class="container">
<h1>Registration Form</h1>
<form id="registrationForm">
et isValid = true;
// Username validation
if (username === '') {
usernameError.textContent = 'Username is required.';
isValid = false;
} else if (username.length < 3) {
usernameError.textContent = 'Username must be at least 3 characters.';
isValid = false;
}
Any change in the source program after the compilation requires recompiling the entire code.
// Email validation
Any change in the source program during the translation does not require retranslation of the entire code.
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
Errors are displayed in Compiler after Compiling together at the current time.
if (email === '') {
Errors are displayed in every single line.
emailError.textContent = 'Email is required.';
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
isValid = false;
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
} else if (!emailPattern.test(email)) {
Compilers.
emailError.textContent = 'Invalid email format.';
It does not require source code for later execution.
isValid = false;
It requires source code for later execution.
}
Execution of the program takes place only after the whole program is compiled.
// Password validation
Execution of the program happens after every line is checked or evaluated.
if (password === '') {
Compilers more often take a large amount of time for the source code.
passwordError.textContent = 'Password is required.';
In comparison, Interpreters take less time for the source code.
isValid = false;
CPU utilization is more in the case of a Compiler.
} else if (password.length < 6) {
CPU utilization is less in the case of a Interpreter.
passwordError.textContent = 'Password must be at least 6 characters.';
Question No =2 What is the function of Lexical Analysis phase of a compiler?
isValid = false;
}
// Confirm Password validation
if (confirmPassword === '') {
confirmPasswordError.textContent = 'Please confirm your password.';
isValid = false;
} else if (password !== confirmPassword) {
confirmPasswordError.textContent = 'Passwords do not match.';
isValid = false;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...41..
// Address validation
if (address === '') {
addressError.textContent = 'Address is required.';
isValid = false;
}
// Final validation
if (isValid) {
alert('Registration Successful!');
}
Any change in the source program after the compilation requires recompiling the entire code.
}
Any change in the source program during the translation does not require retranslation of the entire code.
</script>
Errors are displayed in Compiler after Compiling together at the current time.
</body>
Errors are displayed in every single line.
</html>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Output
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...42..
Question No =12
Write a servlet that connects to the database and retrieves the data and displays it.
Complete Code Listing
MySQL Database Setup
CREATE DATABASE customerDB;
USE customerDB;
Configure web.xml
<servlet>
<servlet-name>CustomerServlet</servlet-name>
<servlet-class>CustomerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CustomerServlet</servlet-name>
<url-pattern>/CustomerServlet</url-pattern>
</servlet-mapping>
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...45..
Question No =13
Write a simple servlet that displays a message.
Complete Code Listing
FirstServlet.java:
import java.io.*;
import javax.servlet.*;
public class FirstServlet extends GenericServlet{
public void service(ServletRequest req,ServletResponse res)throws
ServletException,IOException{
Any change in the source program after the compilation requires recompiling the entire code.
res.setContentType("text/html");
Any change in the source program during the translation does not require retranslation of the entire code.
PrintWriter pw=res.getWriter();
Errors are displayed in Compiler after Compiling together at the current time.
pw.println("<html><head><title>First Servlet</title></head>");
Errors are displayed in every single line.
pw.println("<body><center><h1>This
The compiler can see code upfront whichMessage
helps in came from
running theacode faster because of performing Optimization.
servlet</h1>");
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
pw.println("</center></body></html>"); Compilers.
pw.close(); It does not require source code for later execution.
} It requires source code for later execution.
} Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Web.xml: Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
<web-app> CPU utilization is more in the case of a Compiler.
<servlet> CPU utilization is less in the case of a Interpreter.
<servlet-name>abc</servlet-name>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<servlet-class>FirstServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>abc</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...46..
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...47..
Question No =14
Write a servlet for session tracking.
Complete Code Listing
DateServlet.java:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class
AnyDateServlet extends
change in the HttpServlet{
source program after the compilation requires recompiling the entire code.
public
Anyvoid doGet(HttpServletRequest
change req,HttpServletResponse
in the source program during res)throws
the translation does not require retranslation of the entire code.
ServletException,IOException{
Errors are displayed in Compiler after Compiling together at the current time.
res.setContentType("text/html"); Errors are displayed in every single line.
HttpSession
The compilerhs=req.getSession(true);
can see code upfront which helps in running the code faster because of performing Optimization.
PrintWriter pw=res.getWriter();
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
pw.print("<b>"); Compilers.
Date d=(Date)hs.getAttribute("date");
It does not require source code for later execution.
if(d!=null){ It requires source code for later execution.
pw.print("Last accessed date:"+d+"<br>");
Execution of the program takes place only after the whole program is compiled.
} Execution of the program happens after every line is checked or evaluated.
d= new Date(); Compilers more often take a large amount of time for the source code.
hs.setAttribute("date",d);In comparison, Interpreters take less time for the source code.
pw.print("current date:"+d); CPU utilization is more in the case of a Compiler.
pw.close(); CPU utilization is less in the case of a Interpreter.
} Question No =2 What is the function of Lexical Analysis phase of a compiler?
}
Web.xml:
<web-app>
<servlet>
<servlet-name>sess</servlet-name>
<servlet-class>DateServlet</servlet-class>
</servlet>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...48..
<servlet-mapping>
<servlet-name>sess</servlet-name>
<url-pattern>/ddd</url-pattern>
</servlet-mapping>
</web-app>
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...49..
Question No =15
Write a JSP for session tracking.
Complete Code Listing
<%@ page import="java.io.*,java.util.*" %>
<%
Date createTime = new Date(session.getCreationTime());
Date lastAccessTime = new Date(session.getLastAccessedTime());
%>
<html>
<head> Any change in the source program after the compilation requires recompiling the entire code.
<title>Session
Any change inTracking</title>
the source program during the translation does not require retranslation of the entire code.
</head> Errors are displayed in Compiler after Compiling together at the current time.
<body> Errors are displayed in every single line.
<center>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<h1>Session Tracking
The Interpreter Example</h1>
works by line working of Code, that’s why Optimization is a little slower compared to
</center> Compilers.
<table border="1" align="center">
It does not require source code for later execution.
<tr bgcolor="#ffcccc"> It requires source code for later execution.
<th>Session info</th>
Execution of the program takes place only after the whole program is compiled.
<th>Value</th> Execution of the program happens after every line is checked or evaluated.
</tr> Compilers more often take a large amount of time for the source code.
<tr > In comparison, Interpreters take less time for the source code.
<td>id</td> CPU utilization is more in the case of a Compiler.
<td><% out.print( session.getId());
CPU %></td>
utilization is less in the case of a Interpreter.
</tr> Question No =2 What is the function of Lexical Analysis phase of a compiler?
<tr>
<td>Creation Time</td>
<td><% out.print(createTime); %></td>
</tr>
<tr>
<td>Time of Last Access</td>
<td><% out.print(lastAccessTime); %></td> </tr>
</table>
</body>
</html>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...50..
Output
Any change in the source program after the compilation requires recompiling the entire code.
Any change in the source program during the translation does not require retranslation of the entire code.
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
It does not require source code for later execution.
It requires source code for later execution.
Execution of the program takes place only after the whole program is compiled.
Execution of the program happens after every line is checked or evaluated.
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
Question No =2 What is the function of Lexical Analysis phase of a compiler?