HTML
1. Bio Data Form
<!DOCTYPE html>
<html>
<head>
<title>Biodata</title>
<style>
body {
font-family: 'Courier New', Courier, monospace, sans-serif;
}
.biodata-table {
width: 100%;
border: 1px solid black;
background-color: rgb(200, 200, 200);
margin-top: 20px;
}
.bio {
width: 100%;
}
td {
font-weight: bold;
font-size: 25px;
}
.title {
text-align: center;
font-weight: bold;
font-family: Courier New;
font-size: 50px;
padding: 10px;
}
.personal-info {
padding: 10px;
vertical-align: top;
}
.label {
font-size: 25px;
padding: 5px;
font-weight: bold;
}
.photo {
padding-top: 90px;
height: 110px;
width: 160px;
border: 1px solid black;
margin-left: 80%;
text-align: center;
}
.qualification {
padding: 10px;
vertical-align: top;
}
.qualification table {
width: 100%;
border-collapse: collapse;
border: 1px solid black;
}
.qualification th,
.qualification td {
padding: 5px;
border: 1px solid black;
}
h3 {
font-size: 45px;
text-decoration: underline;
}
</style>
</head>
<body>
<div class="biodata-table">
<p class="title">BIO DATA</p>
<div class="photo">PHOTO</div>
<table>
<tr>
<td class="label">Name</td>
<td>:</td>
</tr>
<tr>
<td class="label">Mobile</td>
<td>:</td>
</tr>
<tr>
<td class="label">Email id</td>
<td>:</td>
</tr>
<tr>
<td class="label">Father's Name</td>
<td>:</td>
</tr>
<tr>
<td class="label">Gender</td>
<td>:</td>
</tr>
<tr>
<td class="label">Date of Birth</td>
<td>:</td>
</tr>
<tr>
<td class="label">Marital Status</td>
<td>:</td>
</tr>
<tr>
<td class="label">Religion</td>
<td>:</td>
</tr>
<tr>
<td class="label">Languages Known</td>
<td>:</td>
</tr>
</table>
<table class="bio">
<tr>
<td colspan="2" class="qualification">
<h3>Qualification</h3>
<table>
<tr>
<th></th>
<th>Institute Name</th>
<th>Year of Passing</th>
<th>Marks Percentage</th>
</tr>
<tr>
<td>School</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Intermediate</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Degree</td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
2. Write an HTML code to form a table to show the below
<!DOCTYPE html>
<html>
<head>
<title>Students Mark Sheet</title>
<style type="text/css">
.studentInfo {
width: 100%;
border-collapse: collapse;
}
.studentInfo td {
border: 1px solid black;
}
.studentInfo td:nth-child(even) {
background-color: #E4FFB7;
}
.studentInfo td:nth-child(odd) {
background-color: #EFFFD2;
}
.studentInfo tr:first-child td {
text-align: center;
font-weight: bolder;
background-color: #80B327;
color: white;
}
</style>
</head>
<body>
<table class="studentInfo">
<tr>
<td colspan="6">STUDENTS MARK SHEET</td>
</tr>
<tr>
<td>Name</td>
<td>Maths</td>
<td>Science</td>
<td>English</td>
<td>Physics</td>
<td>General Knowledge</td>
</tr>
<tr>
<td>David</td>
<td>85</td>
<td>87</td>
<td>88</td>
<td>92</td>
<td>88</td>
</tr>
<tr>
<td>Richard</td>
<td>91</td>
<td>81</td>
<td>78</td>
<td>71</td>
<td>74</td>
</tr>
<tr>
<td>John</td>
<td>81</td>
<td>86</td>
<td>88</td>
<td>84</td>
<td>92</td>
</tr>
<tr>
<td>Tony</td>
<td>84</td>
<td>86</td>
<td>87</td>
<td>82</td>
<td>81</td>
</tr>
<tr>
<td>Scott</td>
<td>71</td>
<td>79</td>
<td>82</td>
<td>88</td>
<td>89</td>
</tr>
</table>
</body>
</html>
3. Create a form as following:
<!DOCTYPE html>
<html>
<head>
<title>Simple Form</title>
<style>
body {
font-family: Verdana, sans-serif;
}
.form-container {
width: 300px;
margin: 50px auto;
border: 2px solid blue;
padding: 20px;
}
label {
color: red;
font-weight: bold;
}
::placeholder {
color: blue;
}
#name,
#email,
#password {
width: 100%;
padding: 5px;
margin: 10px 0 20px 0;
border: 1px solid #ccc;
box-sizing: border-box;
color: blue;
}
.ss {
background-color: green;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
width: 100%;
}
</style>
</head>
<body>
<div class="form-container">
<form>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" placeholder="Enter Name"><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" placeholder="Enter email"><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password" placeholder="Enter Password"><br>
<input type="submit" class="ss" value="Submit">
</form>
</div>
</body>
</html>
4. Write program to generate the followings:
<!DOCTYPE html>
<html>
<head>
<title>Numbered List</title>
</head>
<body>
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Tailwind</li>
<li>React</li>
<li>Mongo DB</li>
<li>React</li>
</ol>
</body>
</html>
5. Write HTML code to add images in the webpage.
<!DOCTYPE html>
<head>
<title>Image</title>
</head>
<body>
<img src="C:\Users\USer\OneDrive\Pictures\Camera Roll\[Link]" width="300" height="200">
<img src="C:\Users\USer\OneDrive\Pictures\Camera Roll\[Link]" width="400" height="300">
</body>
</html>
6. Write HTML code to link more than one files in single page.
<!DOCTYPE html>
<html>
<head>
<title>Multiple File Links</title>
</head>
<body>
<h2>My Files</h2>
<ul>
<li><a href="[Link]">Open Page 1</a></li>
<li><a href="[Link]">Open Page 2</a></li>
<li><a href="[Link]">Open PDF File</a></li>
<li><a href="[Link]">View Image</a></li>
<li><a href="[Link]">Open CSS File</a></li>
</ul>
</body>
</html>
7. Write HTML code to divide entire page into some rows and columns using frame tag.
<!DOCTYPE html>
<head>
<title>Frameset Example</title>
</head>
<frameset cols="50%, 50%">
<frameset rows="50%, 50%">
<frame src="[Link]" name="top-left">
<frame src="[Link]" name="bottom-left">
</frameset>
<frame src="[Link]" name="right">
</frameset>
</html>
CSS
8. Inline CSS
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS Example</title>
</head>
<body style="background-color: lightyellow; font-family: Arial;">
<h1 style="color: blue; text-align: center;">
Welcome to My Web Page
</h1>
<p style="color: green; font-size: 18px;">
This page is designed using inline CSS.
</p>
<p style="color: red;">
Inline CSS is written inside the HTML tags using the style attribute.
</p>
<button style="background-color: orange; color: white; padding: 10px; border: none;">
Click Me
</button>
</body>
</html>
9. Internal CSS
<!DOCTYPE html>
<html>
<head>
<title>Internal CSS Example</title>
<style>
body {
background-color: lightblue;
font-family: Arial;
}
h1 {
color: darkblue;
text-align: center;
}
p {
color: green;
font-size: 18px;
}
button {
background-color: orange;
color: white;
padding: 10px;
border: none;
}
</style>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>
This web page is designed using internal CSS.
</p>
<p>
Internal CSS is written inside the <style> tag in the head section.
</p>
<button>Click Me</button>
</body>
</html>
JS
10. Write JS program to find factorial of a number
<!DOCTYPE html>
<html>
<head>
<title>Factorial Program</title>
</head>
<body>
<input type="number" id="num" placeholder="Enter number">
<button onclick="fact()">Find Factorial</button>
<p id="result"></p>
<script>
function fact() {
let n = [Link]("num").value;
let f = 1;
for (let i = 1; i <= n; i++) {
f = f * i;
}
[Link]("result").innerHTML =
"Factorial = " + f;
}
</script>
</body>
</html>
11. WAP in JS to check weather a number is Armstrong or not
<!DOCTYPE html>
<html>
<head>
<title>Armstrong Number</title>
</head>
<body>
<input type="number" id="num" placeholder="Enter number">
<button onclick="armstrong()">Check</button>
<p id="result"></p>
<script>
function armstrong() {
let n = [Link]("num").value;
let temp = n;
let sum = 0;
let digits = [Link];
while (temp > 0) {
let r = temp % 10;
sum = sum + [Link](r, digits);
temp = [Link](temp / 10);
}
if (sum == n)
[Link]("result").innerHTML =
"Armstrong Number";
else
[Link]("result").innerHTML =
"Not an Armstrong Number";
}
</script>
</body>
</html>
JDBC
12. Create JDBC program to display records from database
import [Link].*;
public class DisplayRecords {
public static void main(String[] args) {
try {
// 1. Load JDBC Driver
[Link](“[Link]");
// 2. Create Connection
Connection con = [Link](
"jdbc:mysql://localhost:3306/umesh",
"root",
"#Umesh"
);
// 3. Create Statement
Statement stmt = [Link]();
// 4. Execute Query
ResultSet rs = [Link]("SELECT * FROM student");
// 5. Display Records
[Link]("ID\tName\tMarks");
[Link]("----------------------");
while ([Link]()) {
[Link](
[Link]("id") + "\t" +
[Link]("name") + "\t" +
[Link]("marks")
);
}
// 6. Close Connection
[Link]();
} catch (Exception e) {
[Link](e);
}
}
}
13. Create JDBC program to add records in the database.
import [Link].*;
public class InsertRecords {
public InsertRecords() {
}
public static void main(String[] var0) {
try {
[Link]("[Link]");
Connection var1 =
[Link]("jdbc:mysql://localhost:3306/umesh", "root", "Umesh@2003");
String var2 = "INSERT INTO student VALUES (4, 'Ritesh', 150)";
PreparedStatement var3 = [Link](var2);
[Link](1, 101);
[Link](2, "Umesh");
[Link](3, 21);
int var4 = [Link]();
if (var4 > 0) {
[Link]("Record inserted successfully");
}
[Link]();
} catch (Exception var5) {
[Link]();
}
}
}
JSP
14. Create JSP program to find greatest of two numbers.
<%@ page language="java" %>
<html>
<head>
<title>Greatest of Two Numbers</title>
</head>
<body>
<form method="post">
Enter First Number:
<input type="text" name="n1"><br><br>
Enter Second Number:
<input type="text" name="n2"><br><br>
<input type="submit" value="Find Greatest">
</form>
<%
if ([Link]("n1") != null &&
[Link]("n2") != null) {
int a = [Link]([Link]("n1"));
int b = [Link]([Link]("n2"));
if (a > b) {
[Link]("<h3>Greatest Number is: " + a + "</h3>");
} else if (b > a) {
[Link]("<h3>Greatest Number is: " + b + "</h3>");
} else {
[Link]("<h3>Both numbers are equal</h3>");
}
}
%>
</body>
</html>
15. Create JSP program to display some information
<%@ page language="java" %>
<html>
<head>
<title>Display Information</title>
</head>
<body>
<h2>My Information</h2>
<%
String name = "Umesh Sahoo";
String course = "BCA";
int age = 21;
String college = "ABC College";
%>
<p><b>Name:</b> <%= name %></p>
<p><b>Course:</b> <%= course %></p>
<p><b>Age:</b> <%= age %></p>
<p><b>College:</b> <%= college %></p>
</body>
</html>
AWT
16. Create form using AWT Components
import [Link].*;
import [Link].*;
public class AWTForm extends Frame implements ActionListener {
// Declare components
Label title, nameLbl, fnameLbl, ageLbl, genderLbl, courseLbl, hobbyLbl, addressLbl;
TextField nameTxt, fnameTxt, ageTxt;
Checkbox male, female;
CheckboxGroup genderGroup;
Choice courseChoice;
Checkbox draw, sing, music, others;
TextArea addressArea;
Button saveBtn, clearBtn;
AWTForm() {
// Set frame properties
setTitle("Registration Form");
setSize(500, 500);
setLayout(null);
setBackground(new Color(45, 50, 60));
// Title
title = new Label("Registration Form");
[Link](180, 40, 200, 30);
[Link]([Link]);
[Link](new Font("Arial", [Link], 16));
add(title);
// Labels
nameLbl = new Label("Name");
fnameLbl = new Label("Father Name");
ageLbl = new Label("Age");
genderLbl = new Label("Gender");
courseLbl = new Label("Course");
hobbyLbl = new Label("Hobbies");
addressLbl = new Label("Address");
[Link](50, 90, 100, 20);
[Link](50, 120, 100, 20);
[Link](50, 150, 100, 20);
[Link](50, 180, 100, 20);
[Link](50, 210, 100, 20);
[Link](50, 240, 100, 20);
[Link](50, 270, 100, 20);
add(nameLbl);
add(fnameLbl);
add(ageLbl);
add(genderLbl);
add(courseLbl);
add(hobbyLbl);
add(addressLbl);
// TextFields
nameTxt = new TextField();
fnameTxt = new TextField();
ageTxt = new TextField();
[Link](160, 90, 250, 20);
[Link](160, 120, 250, 20);
[Link](160, 150, 250, 20);
add(nameTxt);
add(fnameTxt);
add(ageTxt);
// Gender
genderGroup = new CheckboxGroup();
male = new Checkbox("Male", genderGroup, true);
female = new Checkbox("Female", genderGroup, false);
[Link](160, 180, 60, 20);
[Link](230, 180, 80, 20);
add(male);
add(female);
// Course Choice
courseChoice = new Choice();
[Link]("Java");
[Link]("Python");
[Link]("C++");
[Link]("Web Development");
[Link](160, 210, 250, 20);
add(courseChoice);
// Hobbies
draw = new Checkbox("Drawing");
sing = new Checkbox("Singing");
music = new Checkbox("Music");
others = new Checkbox("Others");
[Link](160, 240, 70, 20);
[Link](240, 240, 70, 20);
[Link](320, 240, 60, 20);
[Link](390, 240, 70, 20);
add(draw);
add(sing);
add(music);
add(others);
// Address
addressArea = new TextArea();
[Link](160, 270, 250, 80);
add(addressArea);
// Buttons
saveBtn = new Button("Save Details");
clearBtn = new Button("Clear All");
[Link](160, 370, 100, 30);
[Link](280, 370, 100, 30);
add(saveBtn);
add(clearBtn);
// Button actions
[Link](this);
// Window close
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}
});
setVisible(true);
}
// Clear button action
public void actionPerformed(ActionEvent e) {
[Link]("");
[Link]("");
[Link]("");
[Link]("");
[Link](male);
[Link](false);
[Link](false);
[Link](false);
[Link](false);
[Link](0);
}
public static void main(String[] args) {
new AWTForm();
}
}
SWING
17. Create Form using Swing Components
import [Link].*;
import [Link].*;
import [Link].*;
public class SwingFORM extends JFrame implements ActionListener {
JLabel nameLbl, genderLbl, fnameLbl, passLbl, cpassLbl, cityLbl, emailLbl;
JTextField nameTxt, fnameTxt, cityTxt, emailTxt;
JPasswordField passTxt, cpassTxt;
JComboBox<String> genderBox;
JButton registerBtn, resetBtn;
SwingFORM() {
setTitle("Registration Form");
setSize(450, 450);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setBackground([Link]);
// Labels
nameLbl = new JLabel("NAME");
genderLbl = new JLabel("GENDER");
fnameLbl = new JLabel("FATHER NAME");
passLbl = new JLabel("PASSWORD");
cpassLbl = new JLabel("CONFIRM PASSWORD");
cityLbl = new JLabel("CITY");
emailLbl = new JLabel("EMAIL");
[Link](50, 40, 150, 25);
[Link](50, 80, 150, 25);
[Link](50, 120, 150, 25);
[Link](50, 160, 150, 25);
[Link](50, 200, 150, 25);
[Link](50, 240, 150, 25);
[Link](50, 280, 150, 25);
add(nameLbl);
add(genderLbl);
add(fnameLbl);
add(passLbl);
add(cpassLbl);
add(cityLbl);
add(emailLbl);
// Text Fields
nameTxt = new JTextField();
fnameTxt = new JTextField();
cityTxt = new JTextField();
emailTxt = new JTextField();
[Link](220, 40, 150, 25);
[Link](220, 120, 150, 25);
[Link](220, 240, 150, 25);
[Link](220, 280, 150, 25);
add(nameTxt);
add(fnameTxt);
add(cityTxt);
add(emailTxt);
// Gender ComboBox
genderBox = new JComboBox<>();
[Link]("Male");
[Link]("Female");
[Link]("Other");
[Link](220, 80, 150, 25);
add(genderBox);
// Password Fields
passTxt = new JPasswordField();
cpassTxt = new JPasswordField();
[Link](220, 160, 150, 25);
[Link](220, 200, 150, 25);
add(passTxt);
add(cpassTxt);
// Buttons
registerBtn = new JButton("REGISTER");
resetBtn = new JButton("RESET");
[Link](100, 330, 100, 30);
[Link](230, 330, 100, 30);
add(registerBtn);
add(resetBtn);
// Action listeners
[Link](this);
[Link](this);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if ([Link]() == registerBtn) {
String pass = new String([Link]());
String cpass = new String([Link]());
if () {
[Link](
this,
"Password did not match",
"Message",
JOptionPane.INFORMATION_MESSAGE
);
} else {
[Link](
this,
"Registration Successful",
"Message",
JOptionPane.INFORMATION_MESSAGE
);
}
}
if ([Link]() == resetBtn) {
[Link]("");
[Link]("");
[Link]("");
[Link]("");
[Link]("");
[Link]("");
[Link](0);
}
}
public static void main(String[] args) {
new SwingFORM();
}
}