Professional Documents
Culture Documents
(PBC 602)
BCA
By
Abhinav Baranwal
University Roll Number:-2071502
Under the Guidance of
MR.DEVENDRA SINGH
Assistant professor
Computer Science and Engineering / School of Computing
SCHOOL OF COMPUTING
GRAPHIC ERA HILL UNIVERSITY BHIMTAL
CAMPUS
SATTAL ROAD, P.O.
BHOWALI DISTRICT-
NAINITAL-263136 (2022 –
2023)
School of Computing
Graphic Era Hill University, Bhimtal Campus,
Uttarakhand
2022-2023
CERTIFICATE
ACKNOWLEDGEMENT
I express my gratitude to professors, for coming up with this
interesting and thought-provoking course, compiling the best
contents and the most important working towards changing the
words, making the differences, and inspiring us to become the
climate saver ourselves, knowledge that I gained will last a lifetime.
Many thanks to my institute, Graphic Era Hill University, Bhimtal
and a special thanks to our subject teacher Mr. Devendra Singh,
Assistant Professor, School of Computing, GEHU Bhimtal Campus
for motivating us to look beyond the syllabus, to take the
opportunity and to learn as much as we can. I also thank sir for
helping us in this Term.
PROGRAMS
Ques 1. Design a user registration page with help of HTML and also
implement validation using HTML5.
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<title>Registration Page</title>
</head>
<body>
<div class="form">
<h1>Registration Form</h1>
<form>
<!-- Contact Details -->
<fieldset class="first-section">
<legend>Contact Details</legend>
<label for="name">Name</label>
<input autofocus type="text" id="name" name="name" autofocus placeholder=" "
autocomplete="on" required> <br><br>
<label for="email">Email</label>
<input type="email" id="email" placeholder=" "> <br><br>
<label for="tel">Phone</label>
<input type="tel" id="tel" placeholder=" "> <br><br>
</fieldset>
<!-- Personal Information -->
<fieldset class="second-section">
<legend>Personal Information</legend>
<label for="dob">Birth Date</label>
<input type="date" id="dob"> <br><br>
<label for="gender">Gender ??</label>
<input list="genders" name="gender" id="gender">
<datalist id="genders">
<option value="female">
<option value="male">
<option value="other">
</datalist><br><br>
</fieldset>
<!-- Preferred Language -->
<div class="terms">
<input type="checkbox" id="scales" name="scales" class="checkbox">
<label for="scales">I have read and agree to the terms and conditions</label>
</div>
<button>Submit</button>
</form> </div>
</body>
</html>
Output:-
Ques 3. Create a design audio and video player with the help of HTML5
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<title>Audio and Video</title>
</head>
<body>
<video width = "300" height = "200" controls autoplay>
<source src = "foo.mp4" type = "video/mp4" />
Your browser does not support the <video> element.
</video>
<audio controls autoplay>
<source src = "/html5/audio.wav" type = "audio/wav" />
Your browser does not support the <audio> element.
</audio>
</html>
</body>
</html>
Output:-
Output:-
External CSS:-
Style.css
.xleftcol {
float: left;
width: 33%;
background:#809900;
}
.xmiddlecol {
float: left;
width: 34%;
background:#eff2df;
}
[ In the <head> section of your HTML sheet, add a reference to your external .css file
right after <title> tag: ]
Output:-
Inline CSS:-
<!DOCTYPE html>
<html>
<body style="background-color:black;">
<h1 style="color:white;padding:30px;">Hostinger Tutorials</h1>
<p style="color:white;">Something usefull here.</p>
</body>
</html>
Output:-
Ques 2. Design a web page to demonstrate the use of Class and Id
selector in CSS.
Code:-
CSS class Selector
<!DOCTYPE html>
<html>
<head>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
<body>
<h1 class="center">Red and center-aligned heading</h1>
<p class="center">Red and center-aligned paragraph.</p>
</body>
</html>
Output:-
CSS id Selector
<!DOCTYPE html>
<html>
<head>
<style>
#para1 {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
Output:-
Output:-
JAVA SCRIPT (JS)
QUES 1. Write a program to find min and max number from a given array
using javascript.
Code:-
<!DOCTYPE html>
<html>
<body>
<p>The original array: [28, 45, 69, 20, 15, 7, 98]</p>
<p id="result"></p>
<script>
let array = [28, 45, 69, 20, 15, 7, 98];
let min = array[0], max = array[0];
for (let i = 1; i < array.length; i++) {
if (array[i] > max)
max = array[i];
if (array[i] < min)
min = array[i];
}
document.getElementById('result').innerHTML =
"The maximum or the largest element of the array is: " + max + "<br>" +
"The minimum or the smallest element of the array is: " + min;
</script>
</body>
</html>
Output:-
QUES 2. Write a program to demonstrate the use of var, let and const keyword.
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<script>
let a = 23;
alert("Value of let variable is: "+a);
function display(a) {
var b = a*2;
alert("Value of var variable is: " + b)
}
display(a);
const c = 24;
alert("Value of const variable is: " +c);
</script>
</body>
</html>
Output:-
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<script>
let num=6;
for(let i=num;i>1;){
i=i-1;
var factorial=num*i;
num=factorial;
}
console.log(factorial);
</script>
</body>
</html>
Output:-
Code:-
try-catch:-
<!DOCTYPE html>
<html>
<head> Exception Handling</br></head>
<body>
<script>
try{
var a= ["34","32","5","31","24","44","67"]; //a is an array
document.write (a); // displays elements of a
document.write (b); //b is undefined but still trying to fetch its value. Thus catch block will be
invoked
}catch(e){
alert("There is error which shows "+e.message); //Handling error
}
</script>
</body>
</html>
Output:-
Throw:-
<!DOCTYPE html>
<html>
<head>Exception Handling</head>
<body>
<script>
try {
throw new Error('This is the throw keyword'); //user-defined throw statement.
}
catch (e) {
document.write(e.message); // This will generate an error message
}
</script>
</body>
</html>
Output:-
try-catch-finally:-
<!DOCTYPE html>
<html>
<head>Exception Handling</head>
<body>
<script>
try{
var a=2;
if(a==2)
document.write("ok");
}
catch(Error){
document.write("Error found"+e.message);
}
finally{
document.write("Value of a is 2 ");
}
</script>
</body>
</html>
Output:-
QUES 5. Write a program to add two numbers with the help of text box and display their
sum in 3rd text box in javascript.
Code:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add two Numbers</title>
</head>
<body>
<h1>Add Two Numbers</h1>
<tr>
<th>First Number :-</th>
<td>
<input type="text" id="num1" /><br>
</td>
</tr>
<br>
<tr>
<th>Secound Number :-</th>
<td>
<input type="text" id="num2" /><br>
</td>
</tr>
<br>
<tr>
<th>Sum of Two Numbers are :-</th>
<td>
<input type="text" id="Sum" /><br>
</td>
</tr>
<br>
<tr>
<td>
<input type="button" onclick="resume()" value="Sum" />
</td>
</tr>
<br>
<script type="text/javascript">
function resume() {
var Num1 = parseInt(document.getElementById("num1").value);
var Num2 = parseInt(document.getElementById("num2").value);
}
</script>
</body>
</html>
Output:-
PHP
QUES 1. Write a program in PHP to pass value from one page to another.
Code:-
(index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>program1</title>
</head>
<body>
<form action="display.php" method="post" id="nameform">
First Name:<input type="text" name="fname"></<br>
Last Name:<input type="text" name="lname"></<br>
<button type="submit">Submit</button>
<button type="reset" value="reset">Reset</button>
</form>
</body>
</html>
(display.php)
<?php
$first_name = $_POST['fname'];
$last_name = $_POST['lname'];
echo $first_name;
echo $last_name;
?>
Output:-
QUES 2. Write a program in PHP to demonstrate the use of ‘GET’ and ‘POST’ methods.
Code:-
GET method
(test1.html)
<!DOCTYPE html>
<html>
<body>
<form action = "gettest.php" method = "GET">
Username: <input type = "text" name = "username" /> <br>
Blood Group: <input type = "text" name = "bloodgroup" /> <br>
<input type = "submit" />
</form>
</body>
</html>
(gettest.php)
<?php
echo $_GET["username"];
?>
</br>
Your blood group is:
<?php
echo $_GET["bloodgroup"];
?>
Output:-
POST method
(test2.html)
<html>
<body>
</body>
</html>
(posttest.php)
<html>
<body>
</body>
</html>
Output:-
QUES 3. Write a program in PHP to register a user information in MySQl data base.
Code:-
(index.html)
<!DOCTYPE html>
<html>
<head>
<title>REGISTRATION FORM</title>
</head>
<body>
<form name="registration" method="post" action="registration.php">
<!-- we will create registration.php after registration.html -->
USERNAME:<input type="text" name="name" value=""></br>
EMAIL-ID:<input type="text" name="email" value=""></br>
PASSWORD:<input type="text" name="password"
value=""></br>
RE-PASSWORD:<input type="text" name="repassword" value=""></br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
(registration.php)
<?php
//include connect.php page for database connection
include('connect.php')
//if submit is not blanked i.e. it is clicked.
if(isset($_REQUEST['submit'])!='')
{
if($_REQUEST['name']=='' || $_REQUEST['email']=='' || $_REQUEST['password']==''||
$_REQUEST['repassword']=='')
{
Echo "please fill the empty field.";
}
Else
{
$sql="insert into student(name,email,password,repassword) values('".
$_REQUEST['name']."', '".$_REQUEST['email']."', '".$_REQUEST['password']."', '".
$_REQUEST['repassword']."')";
$res=mysqli_query($sql);
If($res)
{
Echo "Record successfully inserted";
}
Else
{
Echo "There is some problem in inserting record";
}
}
}
?>
Output:-