0% found this document useful (0 votes)
13 views

Web Technology Lab Assignment

Uploaded by

Suvam chatterjee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Web Technology Lab Assignment

Uploaded by

Suvam chatterjee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Govt.

College of Engineering and Ceramic Technology


INDEX

Sl. Page
Date Signature/
No. Name of Practical / Assignment No.
Remarks

Write a HTML program for the


demonstration of Lists. a. Unordered List
1 1 to 3
b. Ordered List c. Definition List d.
Nested List

Write a HTML program for


demonstrating Hyperlinks. a. Navigation
2 4 to 5
from one page to another. b. Navigation
within the page.

Write a HTML program for time-table


3 6 to 7
using tables.

Write a HTML program to develop a


4 8 to 11
static Home Page using frames.

Write a HTML program to develop a


5 12 to 16
static Registration Form.

Write a HTML program to develop a


6 17 to 20
static Login Page.

Write a HTML program to develop a


7 21 to 24
static Web Page for Catalog

Write a HTML program to develop a


8 25 to 28
static Web Page for Shopping Cart.
Govt. College of Engineering and Ceramic Technology
INDEX

Sl. Page
Date Signature/
No. Name of Practical / Assignment No.
Remarks

Write HTML for demonstration of


cascading stylesheets. a. Embedded
9 29 to 31
stylesheets. b. External stylesheets. c.
Inline styles.

Write a javascript program to validate


10 32 to 35
USER LOGIN page.

Write a javascript program for validating


11 36 to 41
REGISTRATION FORM

Write a servlet that connects to the


12 database and retrieves the data and 42 to 44
displays it.

Write a simple servlet that displays a


13 45 to 46
message.

14 Write a servlet for session tracking. 47 to 48

15 Write a JSP for session tracking. 49 to 50


GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...01..
Question No =1
Write a HTML program for the demonstration of Lists. a. Unordered List b. Ordered
List c. Definition List d. Nested List ?
Complete Code Listing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
Any change in thecontent="width=device-width, initial-scale=1.0">
source program after the compilation requires recompiling the entire code.
<title>Lists</title>
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.
body { Errors are displayed in every single line.
Thebackground-color: orange;
compiler can see code upfront which helps in running the code faster because of performing Optimization.
color: white;
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
font-family: Arial, sans-serif; Compilers.
font-size: 20px; It does not require source code for later execution.
} It requires source code for later execution.
h2 { 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.
</style> In comparison, Interpreters take less time for the source code.
</head> CPU utilization is more in the case of a Compiler.
<body> CPU utilization is less in the case of a Interpreter.
<h2><u>HTML Lists Demonstration</u></h2>
Question No =2 What is the function of Lexical Analysis phase of a compiler?

<!-- Unordered List -->


<h3><u>a.Unordered List</u></h3>
<ul>
<li>GCECT</li>
<li>GCELT</li>
<li>GCETT</li>
</ul>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...02..

<!-- Ordered List -->


<h3><u>b.Ordered List</u></h3>
<ol>
<li>IIT</li>
<li>NIT</li>
<li>IIIT</li>
</ol>

<!-- Definition List -->


<h3><u>c.Definition
Any change in List</u></h3>
the source program after the compilation requires recompiling the entire code.
<dl>
Any change in the source program during the translation does not require retranslation of the entire code.
<dt>HTML:</dt>
Errors are displayed in Compiler after Compiling together at the current time.
<dd>HyperText Markup Language</dd>
Errors are displayed in every single line.
<dt>CSS:</dt>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<dd>Cascading Style
The Interpreter Sheets</dd>
works by line working of Code, that’s why Optimization is a little slower compared to
</dl> Compilers.
It does not require source code for later execution.
<!-- Nested List --> It requires source code for later execution.
<h3><u>d.Nested List<u></h3>
Execution of the program takes place only after the whole program is compiled.
<ul> Execution of the program happens after every line is checked or evaluated.
<li>GCECT Compilers more often take a large amount of time for the source code.
<ul> In comparison, Interpreters take less time for the source code.
<li>IT</li> CPU utilization is more in the case of a Compiler.
<li>CT</li> CPU utilization is less in the case of a Interpreter.
</ul> Question No =2 What is the function of Lexical Analysis phase of a compiler?
</li>
<li>GCELT
<ul>
<li>IT</li>
<li>LT</li>
</ul>
</li>
</ul>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Pracrical Assignment
Assignment No. …1……. Page No...03..

</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..

<!-- Navigation from one page to another -->


<h3>Navigate to Another Page</h3>
<p>Click the link below to navigate to another page:</p>
<a href="Question_1.html">Question 1</a>

<br><br>

<!-- Navigation within the same page -->


<h3>Navigate Within
Any change in the Same
sourcePage</h3>
program after the compilation requires recompiling the entire code.
<p>Click the links
Any change in thebelow
sourcetoprogram
navigateduring
to different sections within
the translation thisrequire
does not page:</p>
retranslation of the entire code.
<a href="./Question_2.html">Question 2</a><br>
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...06..
Question No =3
Write a HTML program for time-table using tables.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>LOK SABHA</title>
</head>
<style>
body { Any change in the source program after the compilation requires recompiling the entire code.
background-color: orange;program during the translation does not require retranslation of the entire code.
Any change in the source
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.
font-size:
The compiler 20px; /* Font
can see codesize for allwhich
upfront text */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
h2 { Compilers.
text-align: center; /* Center-align thenot
It does heading */source code for later execution.
require
text-decoration: underline; /* Underline thesource
It requires heading */ 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; 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.
<body> Question No =2 What is the function of Lexical Analysis phase of a compiler?
<h2>TOP 5 STATE WISE SEATS IN THE LOK SABHA</h2>
<table border="2" align="center">
<tr>
<th>STATE NAME</th>
<th>LOK SABHA SEATS</th>
</tr>
<tr>
<td>1.Uttar Pradesh</td>
<td align="center">80</td>
</tr>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Pracrical Assignment
Assignment No. …1……. Page No...07..

<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..

<!-- header.html -->


<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: orange;
color: white;
text-align: center;
} Any change in the source program after the compilation requires recompiling the entire code.
</style>
Any change in 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.
<h1>Welcome
The tosee
compiler can Mycode
Website</h1>
upfront which helps in running the code faster because of performing Optimization.
<nav>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<a href="home.html" target="contentFrame" style="color:
Compilers.white;">Home</a> |
<a href="about.html" target="contentFrame"
It does not requirestyle="color:
source codewhite;">About Us</a> |
for later execution.
<a href="services.html" target="contentFrame" style="color:
It requires source white;">Services</a>
code for later execution. |
<a href="contact.html"
Executiontarget="contentFrame" style="color:
of the program takes place only afterwhite;">Contact</a>
the whole program is compiled.
</nav> Execution of the program happens after every line is checked or evaluated.
</body> Compilers more often take a large amount of time for the source code.
</html> In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
<!-- menu.html --> CPU utilization is less in the case of a Interpreter.
<!DOCTYPE html>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<html>
<head>
<style>
body {
background-color: orange;
color: white;
text-align: center;
}
</style>
</head>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...10..

<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>

<!-- Name Section -->


<div> Any change in the source program after the compilation requires recompiling the entire code.
<label for="firstName">First
Any change Name:</label>
in the source program during the translation does not require retranslation of the entire code.
<input type="text" id="firstName"
Errors are displayedname="firstName" placeholder="Enter
in Compiler after Compiling together atyour first name"
the current time.required>
</div> Errors are displayed in every single line.
<div>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<label
Thefor="lastName">Last Name:</label>
Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<input type="text" id="lastName" name="lastName" placeholder="Enter your last name" required>
Compilers.
</div> It does not require source code for later execution.
It requires source code for later execution.
<!-- Email Section -->
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.
<label for="email">Email:</label>
Compilers more often take a large amount of time for the source code.
<input type="email" id="email" name="email"
In comparison, placeholder="Enter
Interpreters take less time foryour email" code.
the source required>
</div> CPU utilization is more in the case of a Compiler.
CPU utilization is less in the case of a Interpreter.
<!-- Password Section -->No =2 What is the function of Lexical Analysis phase of a compiler?
Question
<div>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter your password"
required>
</div>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...15..

<!-- Gender Section -->


<div>
<label>Gender:</label>
<input type="radio" id="male" name="gender" value="Male">
<label for="male" style="display: inline;">Male</label>
<input type="radio" id="female" name="gender" value="Female">
<label for="female" style="display: inline;">Female</label>
</div>

<!-- Date of Birth Section -->


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.
<label for="dob">Date of Birth:</label>
Errors are displayed in Compiler after Compiling together at the current time.
<div style="display: flex; gap: 10px;">
Errors are displayed in every single line.
<select id="dob-day" name="dob-day" required>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<option value="" disabled selected>Day</option>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<option value="1">1</option>
Compilers.
<option value="2">2</option>
It does not require source code for later execution.
<option value="3">3</option>
It requires source code for later execution.
<!-- Add more days as needed -->
Execution of the program takes place only after the whole program is compiled.
</select>
Execution of the program happens after every line is checked or evaluated.
<select id="dob-month" name="dob-month" required>
Compilers more often take a large amount of time for the source code.
<option value="" disabled selected>Month</option>
In comparison, Interpreters take less time for the source code.
<option value="January">January</option>
CPU utilization is more in the case of a Compiler.
<option value="February">February</option>
CPU utilization is less in the case of a Interpreter.
<option value="March">March</option>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<!-- Add more months as needed -->
</select>
<select id="dob-year" name="dob-year" required>
<option value="" disabled selected>Year</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<!-- Add more years as needed -->
</select>
</div>
</div>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...16..

<!-- Address Section -->


<div>
<label for="address">Address:</label>
<textarea id="address" name="address" rows="3" placeholder="Enter your address" required>
</textarea>
</div>

<!-- Submit and Reset Buttons -->


<div>
<buttonAny
type="submit">Submit</button>
change in the source program after the compilation requires recompiling the entire code.
<button type="reset">Reset</button>
Any change in the source program during the translation does not require retranslation of the entire code.
</div> Errors are displayed in Compiler after Compiling together at the current time.
</form> Errors are displayed in every single line.
</div>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
</body>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
</html> Compilers.
It does not require source code for later execution.
Output
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...17..
Question No =6
Write a HTML program to develop a static Login Page.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Login Page</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: 400px; /* Set maximum width
It does not for the
require formcode
source */ for later execution.
margin: 100px auto; /* Center the form vertically
It requires and horizontally
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;
}
form {
display: flex;
flex-direction: column;
gap: 15px; /* Space between form fields */
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...18..

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>

<!-- Buttons -->


<div>
<button type="submit">Login</button>
<button type="reset">Reset</button>
</div>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...20..

<!-- Forgot Password Link -->


<div class="forgot-password">
<a href="#">Forgot your password?</a>
</div>
</form>
</div>
</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...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>

<!-- Catalog Item 1 -->


<div class="catalog-item">
<img src="https://onlinetestseriesmadeeasy.in/uat/images/madeeasy_publogo.jpg" alt="Product 1">
<div>
Any change in the source program after the compilation requires recompiling the entire code.
<h3>Product 1: GATE 2025 COURSE</h3>
Any change in the source program during the translation does not require retranslation of the entire code.
<p>Organization: Made Easy</p>
Errors are displayed in Compiler after Compiling together at the current time.
<p>Mode: Online</p>
Errors are displayed in every single line.
<p>Price: 25000.00/-</p>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
</div>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<button>Add to Cart</button>
Compilers.
</div>
It does not require source code for later execution.
It requires source code for later execution.
<!-- Catalog Item 2 -->
Execution of the program takes place only after the whole program is compiled.
<div class="catalog-item">
Execution of the program happens after every line is checked or evaluated.
<imgsrc="https://static.toiimg.com/thumb/msid-94028661,width-400,resizemode-4/94028661.jpg"
Compilers more often take a large amount of time for the source code.
alt="Product 2">
In comparison, Interpreters take less time for the source code.
<div>
CPU utilization is more in the case of a Compiler.
<h3>Product 2: GATE 2025 COURSE</h3>
CPU utilization is less in the case of a Interpreter.
<p>Organization: Unacademy</p>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
<p>Mode: Online</p>
<p>Price: 20000.00/-</p>
</div>
<button>Add to Cart</button>
</div>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...24..

<!-- Catalog Item 3 -->


<div class="catalog-item">
<imgsrc="https://playlh.googleusercontent.com/x5_bJXO_-4zH95U6GSmZPHWX7iFe1JPmfGe26kV2f
VrZS5Ebi7L_VFIOopAQ3XBDg" alt="Product 3">
<div>
<h3>Product 3: GATE 2025 COURSE</h3>
<p>Organization: Physics Wallah</p>
<p>Mode: Online</p>
<p>Price: 6999.00/-</p>
</div> Any change in the source program after the compilation requires recompiling the entire code.
<button>Add tothe
Any change in Cart</button>
source program during the translation does not require retranslation of the entire code.
</div> Errors are displayed in Compiler after Compiling together at the current time.
</div> 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.
</html>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
Compilers.
Output 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...25..
Question No =8
Write a HTML program to develop a static Web Page for Shopping Cart.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Shopping Cart</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: 800px; /* Set maximum width source
It requires for the code
cart */
for later execution.
margin: 50px auto; /* Center
Execution the cart */takes place only after the whole program is compiled.
of the program
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;
}
table {
width: 100%;
border-collapse: collapse; /* Remove double borders */
margin-bottom: 20px;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...26..

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..

<!-- Row 3 -->


<tr>
<td>GATE 2025 COURSE (Physics Wallah)</td>
<td>6999.00/-</td>
<td>1</td>
<td>6999.00</td>
</tr>
</tbody>
</table>
<!-- Total Amount -->
Any change in the source program after the compilation requires recompiling the entire code.
<div class="total">Total: 76999.00/-</div>
Any change in the source program during the translation does not require retranslation of the entire code.
<!-- Buttons -->
Errors are displayed in Compiler after Compiling together at the current time.
<button type="button">Proceed to Checkout</button>
Errors are displayed in every single line.
<button type="button">Continue Shopping</button>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
</div>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
</body>
Compilers.
</html>
It does not require source code for later execution.
Output 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...29..
Question No =9
Write HTML for demonstration of cascading stylesheets. a. Embedded stylesheets.
b. External stylesheets. c. Inline styles.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>Cascading Stylesheets Demo</title>
<!-- External Stylesheet -->
<link rel="stylesheet"
Any change in thehref="styles.css">
source program after the compilation requires recompiling the entire code.
<!--
AnyEmbedded Stylesheet
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.
body { Errors are displayed in every single line.
background-color:
The compiler can see codeorange;
upfront which helps in running the code faster because of performing Optimization.
color:
The white; works by line working of Code, that’s why Optimization is a little slower compared to
Interpreter
font-family: Arial, sans-serif; Compilers.
text-align: center; It does not require source code for later execution.
} It requires source code for later execution.
h1 { Execution of the program takes place only after the whole program is compiled.
text-decoration: underline;
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.
.embedded-style { In comparison, Interpreters take less time for the source code.
font-size: 18px; CPU utilization is more in the case of a Compiler.
color: lightblue; CPU utilization is less in the case of a Interpreter.
margin: 20px;
Question No =2 What is the function of Lexical Analysis phase of a compiler?
}
.table-style {
margin: 20px auto;
border: 1px solid white;
border-collapse: collapse;
width: 60%;
}
.table-style th, .table-style td {
border: 1px solid white;
padding: 10px;
text-align: center;}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...30..

.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');

// Clear previous error messages


errorMessage.textContent = '';

if (username === '' || password === '') {


errorMessage.textContent = 'Username and Password cannot be empty.';
return false;
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...35..

// Simple hardcoded validation for demo


if (username === 'admin' && password === 'password123') {
alert('Login successful!');
// Redirect or perform other actions here
} else {
errorMessage.textContent = 'Invalid Username or Password.';
}
}
</script>
</body>
Any change in the source program after the compilation requires recompiling the entire code.
</html>
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.
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...36..
Question No =11
Write a javascript program for validating REGISTRATION FORM.
Complete Code Listing
<!DOCTYPE html>
<html>
<head>
<title>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.
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: 600px; It requires source code for later execution.
margin: 50px auto;
Execution of the program takes place only after the whole program is compiled.
padding: 40px;Execution of the program happens after every line is checked or evaluated.
background-color: rgba(255,
Compilers 255,often
more 255, 0.1);
take /* Semi-transparent
a large white
amount of time forbackground */
the source code.
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); 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;
}
form {
display: flex;
flex-direction: column;
gap: 15px;
}
label {
font-weight: bold;
text-align: left;}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...37..

input, textarea, select {


width: 100%;
padding: 10px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: white;
color: orange;
}
input:focus, textarea:focus, select: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;
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;
text-align: left;
}
</style>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...38..

</head>
<body>
<div class="container">
<h1>Registration Form</h1>
<form id="registrationForm">

<!-- Username -->


<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.
<p id="usernameError" class="error"></p>
Any change in the source program during the translation does not require retranslation of the entire code.
</div>
Errors are displayed in Compiler after Compiling together at the current time.
Errors are displayed in every single line.
<!-- Email -->
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<div>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
<label for="email">Email:</label>
Compilers.
<input type="email" id="email" name="email" placeholder="Enter your email">
It does not require source code for later execution.
<p id="emailError" class="error"></p>
It requires source code for later execution.
</div>
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.
<!-- Password -->
Compilers more often take a large amount of time for the source code.
<div>
In comparison, Interpreters take less time for the source code.
<label for="password">Password:</label>
CPU utilization is more in the case of a Compiler.
<input type="password" id="password" name="password" placeholder="Enter your password">
CPU utilization is less in the case of a Interpreter.
<p id="passwordError" class="error"></p>
Question No =2 What is the function of Lexical Analysis phase of a compiler?
</div>

<!-- Confirm Password -->


<div>
<label for="confirmPassword">Confirm Password:</label>
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm your
password">
<p id="confirmPasswordError" class="error"></p>
</div>
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...39..

<!-- Address -->


<div>
<label for="address">Address:</label>
<textarea id="address" name="address" rows="3" placeholder="Enter your address"></textarea>
<p id="addressError" class="error"></p>
</div>

<!-- Submit Button -->


<div style="display: flex; justify-content: center; gap: 10px;">
<button type="button" onclick="validateForm()">Submit</button>
Any change in the source program after the compilation requires recompiling the entire code.
<button type="reset">Reset</button>
Any change in the source program during the translation does not require retranslation of the entire code.
</div>
Errors are displayed in Compiler after Compiling together at the current time.
</form>
Errors are displayed in every single line.
</div>
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
<script>
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
function validateForm() {
Compilers.
// Get form values
It does not require source code for later execution.
const username = document.getElementById('username').value.trim();
It requires source code for later execution.
const email = document.getElementById('email').value.trim();
Execution of the program takes place only after the whole program is compiled.
const password = document.getElementById('password').value.trim();
Execution of the program happens after every line is checked or evaluated.
const confirmPassword = document.getElementById('confirmPassword').value.trim();
Compilers more often take a large amount of time for the source code.
const address = document.getElementById('address').value.trim();
In comparison, Interpreters take less time for the source code.
CPU utilization is more in the case of a Compiler.
// Error fields
CPU utilization is less in the case of a Interpreter.
const usernameError = document.getElementById('usernameError');
Question No =2 What is the function of Lexical Analysis phase of a compiler?
const emailError = document.getElementById('emailError');
const passwordError = document.getElementById('passwordError');
const confirmPasswordError = document.getElementById('confirmPasswordError');
const addressError = document.getElementById('addressError');

// Reset error messages


usernameError.textContent = '';
emailError.textContent = '';
passwordError.textContent = '';
confirmPasswordError.textContent = '';
addressError.textContent = '';
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...40..

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;

CREATE TABLE customers (


id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
Any change in the source program after the compilation requires recompiling the entire code.
email VARCHAR(100)
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.
INSERT INTO
The compiler cancustomers (name, email)
see code upfront VALUES
which helps ('Johnthe
in running Doe', '[email protected]');
code faster because of performing Optimization.
INSERT INTO customers
The Interpreter (name,
works by email) VALUES
line working of Code, ('Jane Smith',
that’s why '[email protected]');
Optimization is a little slower compared to
Compilers.
Servlet Code: CustomerServlet.java
It does not require source code for later execution.
import java.io.*; It requires source code for later execution.
import java.sql.*;
Execution of the program takes place only after the whole program is compiled.
import javax.servlet.*;
Execution of the program happens after every line is checked or evaluated.
import javax.servlet.http.*;
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
@WebServlet("/CustomerServlet")
CPU utilization is more in the case of a Compiler.
public class CustomerServlet extends HttpServlet
CPU utilization { in the case of a Interpreter.
is less
private static final StringNo
Question DB_URL
=2 What=is"jdbc:mysql://localhost:3306/customerDB";
the function of Lexical Analysis phase of a compiler?
private static final String DB_USER = "root"; // Replace with your MySQL username
private static final String DB_PASS = "password"; // Replace with your MySQL password

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException {
response.setContentType("text/html");
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...43..

try (PrintWriter out = response.getWriter()) {


// Establish database connection
Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PASS);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM customers");

// Display data in HTML table


out.println("<html><body>");
out.println("<h1>Customer List</h1>");
out.println("<table border='1'><tr><th>ID</th><th>Name</th><th>Email</th></tr>");
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.
while (rs.next()) {
Errors are displayed in Compiler after Compiling together at the current time.
out.println("<tr>");
Errors are displayed in every single line.
out.println("<td>" + rs.getInt("id") + "</td>");
The compiler can see code upfront which helps in running the code faster because of performing Optimization.
out.println("<td>" + rs.getString("name") + "</td>");
The Interpreter works by line working of Code, that’s why Optimization is a little slower compared to
out.println("<td>" + rs.getString("email") + "</td>");
Compilers.
out.println("</tr>");
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.
out.println("</table>");
Execution of the program happens after every line is checked or evaluated.
out.println("</body></html>");
Compilers more often take a large amount of time for the source code.
In comparison, Interpreters take less time for the source code.
// Close resources
CPU utilization is more in the case of a Compiler.
rs.close();
CPU utilization is less in the case of a Interpreter.
stmt.close();
Question No =2 What is the function of Lexical Analysis phase of a compiler?
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
GOVT. COLLEGE OF ENGINEERING & CERAMIC TECHNOLOGY
Practical Assignment
Assignment No. …1……. Page No...44..

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?

You might also like