Академический Документы
Профессиональный Документы
Культура Документы
EXCERCISE 1:
HOME PAGE:
The static home page must contain three frames.
Top frame : Logo and the college name and links to Home page, Login page, Registration
page, Catalogue page and Cart page (the description of these pages will be given below).
Left frame : At least four links for navigation, which will display the catalogue of respective
links.
Right frame: The pages to the links in the left frame must be loaded here. Initially this page
contains description of the web site.
homepage.html
<frameset rows="25%,*">
<frame src="topframe.html" scrolling=no>
<frameset cols="20%,*">
<frame src="leftframe.html" >
<frame src="rightframe.html" name="rframe">
</frameset>
</frameset>
topframe.html
<html>
<head><title>top frame</title>
</head>
<body bgcolor="yellow" text="blue">
<table border="1" width="100%">
<tr>
<th width="15%"><img src="E:\WT Lab\Ex1\logo.jpg" height=50 width=100>
<th colspan=4 ><center><h1> QIS BOOK STORE</h1></center>
</tr>
</table>
<table border="1" width="100%">
<tr>
<th><a href="E:\WT Lab\Ex1\rightframe.html" target="rframe">home</a>
<th><a href="E:\WT Lab\Ex1\login.html" target="rframe">login</a>
<th><a href="E:\WT Lab\Ex1\registration.html" target="rframe">registration</a>
<th><a href="E:\WT Lab\Ex1\cat.html" target="rframe">Catalogue</a>
<th><a href="E:\WT Lab\Ex1\cart.html" target="rframe">Cart</a>
</tr>
</table>
<table width=100%>
<marquee direction=right><h3> <a href="E:\WT Lab\Ex1\registration.html"
target="rframe">New user... register here</a> </h3></marquee>
</table></body></html>
leftframe.html
<html>
<head>
<title>leftframe</title>
</head>
<body bgcolor="orange" text="green">
<table border=1 height="100%" width="100%">
<tr>
<th><a href="E:\WT Lab\Ex1\cse.html" target="rframe">cse</a>
</tr>
<tr>
<th><a href="E:\WT Lab\Ex1\ece.html" target="rframe">ece</a>
</tr>
<tr>
<th><a href="E:\WT Lab\Ex1\eee.html" target="rframe">eee</a>
</tr>
<tr>
<th><a href="E:\WT Lab\Ex1\mech.html" target="rframe">mech</a>
</tr>
<tr>
<th><a href="E:\WT Lab\Ex1\it.html" target="rframe">it</a>
</tr>
<tr>
<th><a href="E:\WT Lab\Ex1\civil.html" target="rframe">civil</a>
</tr>
</table>
</body>
<html>
rightframe.html
<html>
<head><title>right frame</title>
</head>
<body bgcolor="pink" text="white">
<center><h1> About QIS Book Store</h1></center>
<p>
QIS Book store is the one of the best book store for Engineering books. This book store
provides the official information about Course Material and provides several options by
which students are able to purchase or rent what they need
</p>
<br>
<br>
<p>
QIS Book Store have 100s of volumes of books for all engineering branches. It is a backbone
for QIS College of Engineering and Technology. It indicates the quality and service of an
academic institution.
</p>
</body>
</html>
OUTPUT:
EXERCISE 2:
Design a static user login page for the online book store website with
1. loginid (textfield)
2. password (password field)
3. Two buttons (Submit and Reset)
HTML CODE:
login.html
<html>
<head>
<title>login</title>
</head>
<body bgcolor="blue" text="white">
<center>
<table>
<tr> <td>loginid
<td><input type="text" size=20>
</tr>
<tr> <td>password
<td><input type="password" size=20>
</tr>
</table>
<input type="button" value="submit">
<input type="button" value="reset">
</center>
</body></html>
OUTPUT:
EXERCISE 3:
CATOLOGUE PAGE:
The catalogue page should contain the details of all the books available in the web site in
a table.
The details should contain the following:
1. Snap shot of Cover Page.
2. Author Name.
3. Publisher.
4. Price.
5. Add to cart button.
HTML Code:
catalogue.html
<html>
<head><title>Catalogue</title>
</head>
<body bgcolor="red" text="white">
<center>
<h1> <U>List of Books Available</U></h1>
<table border="1">
<thead>
<tr>
<th>Cover Page
<th>Title
<th>Author
<th>Publisher
<th>Price
<th>Qunatity
<th>Cart
</tr>
</thead>
<tbody>
<tr>
<td><img src="E:\WT Lab\Ex1\c.jpg" height=50 width=50>
<td>Let Us C
<td>Yeswanth Kanethkar
<td>PHI
<td>500
<td>10
<td><input type="button" value="Add to Cart">
</tr>
<tr>
<td><img src="E:\WT Lab\Ex1\bee.jpg" height=50 width=50>
<td> Basic Electrical Engineering
<td>V K Mehta
<td> S Chand
<td>300
<td>25
OUTPUT:
EXERCISE 4:
REGISTRATION PAGE:
Create a registration form with the following fields
1) Name (Text field)
2) Password (password field)
3) E-mail id (text field)
4) Phone number (text field)
5) Sex (radio button)
6) Date of birth (3 select boxes)
7) Languages known (check boxes English, Telugu, Hindi, Tamil)
8) Address (text area)
HTML Code:
Registration.html
<html>
<head><title>Registration</title>
</head>
<body bgcolor="purple" text="white">
<h3> New User Rgister here</h3>
<center>
<table border=1>
<tr> <td> Name
<td> <input type="text" size=20>
</tr>
<tr> <td> Password
<td> <input type="password" size=20>
</tr>
<tr> <td> Email id
<td> <input type="text" size=20>
</tr>
<tr> <td> phone number
<td> <input type="text" size=20>
</tr>
<tr> <td> Gender
<td> <input type="radio" name="gender">male
<input type="radio" name="gender">female
</tr>
<tr>
<td> Date of Birth
<td>
<select name="date">
<option>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
<option>11
<option>12
<option>13
<option>14
<option>15
<option>16
<option>17
<option>18
<option>19
<option>20
<option>21
<option>22
<option>23
<option>24
<option>25
<option>26
<option>27
<option>28
<option>29
<option>30
<option>31
</select>
<select name="month">
<option>jan
<option>feb
<option>mar
<option>apr
<option>may
<option>jun
<option>Jul
<option>Aug
<option>Sep
<option>Oct
<option>Nov
<option>Dec
</select>
<select name="year">
<option>1995
<option>1996
<option>1997
</select>
</tr>
<tr> <td> languages known
<td> <input type="checkbox">English
<input type="checkbox">Hindi
<input type="checkbox">Tamil
<input type="checkbox">Telugu
</tr>
<tr>
<td> Address
<td> <textarea cols=20 rows=5></textarea>
</tr>
</table>
<input type="button" value="submit">
<input type="button" value="reset">
</center>
</body>
</html>
OUTPUT:
EXERCISE 5:
Design a web page using CSS (Cascading Style Sheets) which includes the following:
Use different font, styles.
Source Code:
<html>
<head>
<title>css</title>
<style>
p{color:green;background-color:lightblue;font-size:30pt}
.p1{font-size:10pt;color:orange;background-color:white}
.p2{font-size:20pt;color:blue}
a:link{font-size:30pt;color:red}
a:visited{font-size:30pt;color:purple}
a:hover{font-size:30pt;color:magenta}
a:active{font-size:30pt;color:blue}
body {background-image:url("c.jpg")}
</style>
</head>
<body>
<p class="p1">In modern website development, CSS programming is a service on
demand. CSS helps web design and development professionals to add fonts,
colors and other formatting to web pages. Developed and maintained by the
World Wide Web Consortium, CSS helps web developers to separate content from
design and save a lot of working time. Prior to CSS, the presentational
elements of HTML docs were contained within the HTML markup. All colors,
styles, borders, fonts, etc had to be repeatedly described within the HTML
file. CSS allows creating a simpler HTML file and move the formatting
designers and web developers use to build professional websites with unique
look and feel. CSS gives many great options allowing enhancing the website
design and functioning. Take a glance at some of WOWEB projects using CSS
document from document presentation, such as layout, colors, fonts. Styles are
stored in .css files enabling web masters to change website layout by editing
one single file. There are Author Style Sheets (created by the web page
author); User Style Sheets (set by the web page user); User Agent Style Sheets
OUTPUT:
EXERCISE 6:
Source Code:
<html>
<head>
<title>Arithmetic Operators </title>
<script>
function add()
{
var a=document.arithmetic.first.value;
var b=document.arithmetic.second.value;
var c=parseInt(a)+parseInt(b);
document.arithmetic.result.value=c;
}
function sub()
{
var a=document.arithmetic.first.value;
var b=document.arithmetic.second.value;
document.arithmetic.result.value=a-b;
}
function mul()
{
var a=document.arithmetic.first.value;
var b=document.arithmetic.second.value;
document.arithmetic.result.value=a*b;
}
function div()
{
var a=document.arithmetic.first.value;
var b=document.arithmetic.second.value;
document.arithmetic.result.value=a/b;
}
</script>
<style>
table {background-color:pink}
</style>
</head>
<body background="as.jpg" text="darkblue">
<br><br><br><br><br><br><br>
<center>
<form name="arithmetic">
<table border=1>
<tr>
<td align="center" colspan=2><h1> Javascript Arithmetic Operators
Demo </h1>
</tr>
<tr>
<td><h2>First Numeber</h2>
<td><input type="text" size=50 name="first">
</tr>
<tr>
<td><h2>Second Numeber</h2>
<td><input type="text" size=50 name="second">
</tr>
<tr>
<td><h2>Result</h2>
<td><input type="text" size=50 name="result">
</tr>
<tr >
<h2>
<td colspan=2 align=center>
<input type="button" value="Add" onclick="add()">
<input type="button" value="Subtract" onclick="sub()">
<input type="button" value="Multiply" onclick="mul()">
<input type="button" value="Divide" onclick="div()">
</h2>
<tr>
<table>
</form>
<center>
</html>
OUTPUT:
EXERCISE 7:
Write an XML file which will display the Book information which
includes the following:
1) Title of the book
2) Author Name
3) ISBN number
4) Publisher name
5) Edition
6) Price
Write a Document Type Definition (DTD) to validate the above
XML file.
Source Code:
<bookstore>
<book>
<title>web programming</title>
<author>chrisbates</author>
<ISBN>123-456-789</ISBN>
<publisher>wiley</publisher>
<edition>3</edition>
<price>350</price>
</book>
<book>
<title>internet worldwideweb</title>
<author>ditel&ditel</author>
<ISBN>123-456-781</ISBN>
<publisher>person</publisher>
<edition>3</edition>
<price>450</price>
</book>
</bookstore>
Bookstore.xml
<!DOCTYPE bookstore SYSTEM "C:\Documents and Settings\Administrator\My
Documents\bookstore.dtd">
<bookstore>
<book>
<title>web programming</title>
<author>chrisbates</author>
<ISBN>123-456-789</ISBN>
<publisher>wiley</publisher>
<edition>3</edition>
<price>350</price>
</book>
<book>
<title>internet worldwideweb</title>
<author>ditel&ditel</author>
<ISBN>123-456-781</ISBN>
<publisher>person</publisher>
<edition>3</edition>
<price>450</price>
</book>
</bookstore>
Bookstore.xml
<bookstore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Documents and Settings\Administrator\My
Documents\bookstore.xsd">
<book>
<title>web programming</title>
<author>chrisbates</author>
<ISBN>123-456-789</ISBN>
<publisher>wiley</publisher>
<edition>3</edition>
<price>350</price>
</book>
<book>
<title>internet worldwideweb</title>
<author>ditel&ditel</author>
<ISBN>123-456-781</ISBN>
<publisher>person</publisher>
<edition>3</edition>
<price>450</price>
</book>
</bookstore>
XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="bookstore.xsl"?>
<bookstore>
<book>
<title>Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book>
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2> My Books collection</h2>
<table border="1">
<tr bgcolor="red">
<th align="left">title</th>
<th align="left">author</th>
</tr>
<xsl:for-each select="bookstore/book">
<tr>
<td><xsl:value-of select="title"/></td>
<xsl:choose>
<xsl:when test="price > 30">
<td bgcolor="yellow"><xsl:value-of select="author"/></td>
</xsl:when>
<xsl:when test="price > 10">
<td bgcolor="magneta"><xsl:value-of select="author"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="author"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
OUTPUT:
EXERCISE 8:
Source Code:
contactus.html
<html>
<body text="blue">
<center>
<h1> Contact @ QISCET</h1>
<img src="contactus.jpg" height=30% width=100%>
<form action="contact.php" method="GET">
<h3>Name<br>
<input type="text" name="name" size=50><br>
Mailid<br>
<input type="text" name="email" size=50><br>
Subject<br>
<input type="text" name="subject" size=50><br>
Message<br>
<textarea cols=50 rows=20 name="message">Your message here....!
</textarea><br>
<input type="submit" value="send" name="submit">
</h3>
</form>
<center>
</body>
</html>
contact.php
<?php
$n=$_GET['name'];
$e=$_GET['email'];
$m=$_GET['message'];
if($n==""||$e==""||$m=="")
echo "fill all the required data...!";
else
echo "Your message sent successfully... Thank you for your interest in
us!";
?>
OUTPUT:
EXERCISE 9:
Source Code:
registration.html
<html>
<body bgcolor="red" text="white">
<center>
<img src="Reg.jpg" height=20% width=50%>
<form name="f" method="get" action="reg.php" onsubmit="reg()">
<table>
<tr>
<td>First Name
<td><input type="text" name="fname">
</tr>
<tr>
<td>Last Name
<td><input type="text" name="lname">
</tr>
<tr>
<td>User Id
<td><input type="text" name="uid"><br>
</tr>
<tr>
<td>Password
<td><input type="password" name="pwd">
</tr>
<tr>
<td>Confirm Password
<td><input type="password" name="cp">
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" value="Register">
<input type="reset" value="Cancel">
</tr>
</form>
</center>
</html>
reg.php:
<?php
$f=$_GET['fname'];
$l=$_GET['lname'];
$u=$_GET['uid'];
$p=$_GET['pwd'];
$con=mysqli_connect("localhost","root","","Authorized");
if($con)
{
$query="insert into users values('$f','$l','$u','$p')";
$result=mysqli_query($con,$query);
if($result)
echo "You have registered successfully...<a href=login.html>Click here to
login</a>";
}
?>
OUTPUT:
login.html
<html>
<script>
</script>
<body bgcolor="green" text="white">
<center>
<h1> User Login</h1>
login.php:
<?php
$l=$_GET['lid'];
$p=$_GET['p'];
$con=mysqli_connect("localhost","root","","Authorized");
if($con)
{
$query="Select userid, password from users where userid='$l' and password='$p'";
$result=mysqli_query($con,$query);
if($result)
{
$row=mysqli_fetch_array($result);
if($row['userid']==$l and $row['password']==$p)
echo "Welcome $l, You are the authorized user...!";
else
echo "You are not an authorized user... Please register";
}
}
?>
OUTPUT:
EXERCISE 10:
Source Code:
<?php
$con=mysqli_connect("localhost","root","","User");
if($con)
{
$query="insert into Users values
('user1','password1','user1@mail.com','9999999999'),
('user2','password2','user2@mail.com','9888888888'),
('user3','password3','user3@mail.com','9877777777'),
('user4','password4','user4@mail.com','9876666666'),
('user5','password5','user5@mail.com','9876555555')";
$result=mysqli_query($con,$query);
if($result)
echo "Data Inserted successfully.....!";
?>
OUTPUT:
EXERCISE 11:
Write a PHP program to extract data from MySQL data base and display it
Source Code:
<?php
$con=mysqli_connect("localhost","root","","User");
if($con)
{
$query="select * from users";
$result=mysqli_query($con,$query);
if($result)
{
echo "<center>The Results extracted from MySQL";
echo "<table border=1><tr><td>User Name<td>Password<td>Email<td>Phone
Number</tr>";
while($row=mysqli_fetch_array($result))
{
echo "<tr><td>$row[UserName]<td>$row[Password]<td>$row[MailId]<td>
$row[Phone]</tr>";
}
echo "</table></center>";
}
}?>
OUTPUT:
EXERCISE 12:
Source Code:
#!usr/bin/perl
%ceo=('yahoo'=>"Marissa Mayer",'google'=>"Sundar Pichai", 'infosys'=>"Vishal
Shikka",'HCL'=>"Anant Gupta",'TCS'=>"Rajesh Gopinathan");
@company=keys(%ceo);
@ceos=values(%ceo);
$size=@company.length;
for($i=0;$i<$size;$i++)
{
print $ceos[$i]." is the CEO of ".$company[$i]."\n";
}
OUTPUT:
EXERCISE 13:
Write perl program takes a set names along the command line and prints their file type.
Source Code:
#!usr/bin/perl
$len = @ARGV;
for ($i=0;$i<$len;$i++)
{
if(-e $ARGV[$i])
{
if(-T $ARGV[$i])
{
print "$ARGV[$i] is a text file\n";
}
else
{
print "$ARGV[$i] is a special file\n";
}
}
else
{
print "$ARGV[$i] does not exists\n";
}
}
OUTPUT:
EXERCISE 14:
Source Code:
my $salt='';
my $encrypted='';
my $password='';
my $use = 'Usage: Please provide password for encrypt';
my @saltchars=('.', '/', 0..9, 'A'..'Z', 'a'..'z');
my $args=@ARGV;
if ( $args < 1 || $args > 2 )
{
print "$use\n";
exit;
}
$password=$ARGV[0];
if( $args == 1 )
{
$salt = join('',@saltchars[rand(64),rand(64)]);
}
else
{
$salt=$ARGV[1];
}
$encrypted=crypt($password,$salt);
print "$password --> $encrypted\n";
OUTPUT:
EXERCISE 15:
Source Code:
use DBI;
$db="cse";
$host="localhost";
$user="root";
$password="";
EXERCISE 16:
Source Code:
OUTPUT:
EXERCISE 17:
Source Code:
#! usr/bin/ruby
OUTPUT:
EXERCISE 18:
Source Code:
puts "1.each"
puts "2.times"
puts "3.step"
puts "4.upto"
puts "5.downto"
puts "enter your choice"
ch=gets.to_i
case ch
when 1
(1..9).each do |i|
puts i
end
when 2
5.times do
puts "cse"
end
when 3
0.step(10,2) do |i|
puts i
end
when 4
5.upto(10) do |i|
puts i
end
when 5
10.downto(5) do |i|
puts i
end
end
OUTPUT:
EXERCISE 19:
Write a Ruby program that uses iterator to find out the length of
a string.
Source Code:
#!usr/bin/ruby
str=gets.chomp.split("")
count=0
str.each do |i|
count+=1
end
OUTPUT:
EXERCISE 20:
Source Code:
#!usr/bin/ruby
a=Array.new()
puts "How many elements the array can hold?"
size=gets.to_i
puts "What are elements.... Enter them"
for i in 0..size-1 do
a[i]=gets.to_i
end
for i in 0..size-1 do
for j in i..size-1 do
if a[i]>a[j]
t=a[i]
a[i]=a[j]
a[j]=t
end
end
end
puts "Sorting was done... Now the contents of array are"
puts a
OUTPUT
EXERCISE 21:
Source Code:
#! usr/bin/ruby
college=["cse","ece","eee","mech","it","civil"]
branch=gets.chomp
if college.include?(branch)
puts "College is offering branch #{branch}"
else
puts "Collge is not offering branch #{branch}"
end
OUTPUT:
EXERCISE 22:
Source Code:
#!usr/bin/ruby
state={:ap=>"Amaravathi",:ts=>"Hyderabad",:tn=>"chennai"}
puts "The capital of Andhra pradesh is #{state[:ap]}"
puts "The capital of Telangana state is #{state[:ts]}"
puts "The capital of Tamilanadu is #{state[:tn]}"
state[:ka]="Bengaluru"
state[:mh]="Mumbai"
state[:kl]="Thiruvanantapuram"
puts "the states in the hash after adding karnataka, maharshtra, Kerala
are"
puts state
state.delete(:kl)
puts "the states in the hash after deleting Kerala are"
puts state
OUTPUT
EXERCISE 23:
Source Code:
#!usr/bin/ruby
puts "enter values for a, b, c"
a=Integer(gets)
b=Integer(gets)
c=Integer(gets)
s=(a+b+c)/2
tarea=Math.sqrt(s*(s-a)*(s-b)*(s-c))
puts "The area of triangle is #{tarea}"
OUTPUT
EXERCISE 24:
Source Code:
require 'tk'
root = TkRoot.new { title "Ex1" }
TkLabel.new(root) {
text 'Hello, World!'
pack { padx 15 ; pady 15; side 'left' }
}
Tk.mainloop
OUTPUT
EXERCISE 25:
Source Code:
#! usr/bin/ruby
c1=Complex(2,3)
c2=Complex(4,5)
OUTPUT: