0% found this document useful (0 votes)
36 views39 pages

Practical File-Class XII

The document is a practical file for Information Technology (IT Code 802) for Class XII students at Educole The Girls’ School, Dhampur, for the session 2025-26. It includes a certificate of completion, acknowledgments, an index of practical programs, and various Java and MySQL programs demonstrating programming concepts and database management. The practical file showcases a range of programming tasks, including basic arithmetic operations, string methods, and SQL commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views39 pages

Practical File-Class XII

The document is a practical file for Information Technology (IT Code 802) for Class XII students at Educole The Girls’ School, Dhampur, for the session 2025-26. It includes a certificate of completion, acknowledgments, an index of practical programs, and various Java and MySQL programs demonstrating programming concepts and database management. The practical file showcases a range of programming tasks, including basic arithmetic operations, string methods, and SQL commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Educole The Girls’ School, Dhampur

Practical File
Information Technology
(IT Code 802)
Session- 2025-26
Class- XII

Submitted to: Submitted by:

Ms. Muskan Chhabra Name :______________


HOD (Information Class :______________
Technology) Roll No.:_____________
CERTIFICATE

This is to certify that ___________ _____ ,of class XII, Educole The
Girls’ School, Dhampur has completed the practical file of
Information Technology Code 802.

She has submitted the Practical File within the given time. She has
shown utmost sincerity in completing this project work.

______________ _________________
Teacher’s Signature Principal’s Signature
ACKNOWLEDGEMENT
I would like to extend my sincere and heartfelt gratitude to my
Information Technology teacher Ms. Muskan Chhabra who has
helped me in this endeavor and has always been very cooperative
without her help, cooperation, guidance and encouragement, the
project couldn’t be what it evolved to be.

I extend my heartfelt thanks to my faculty for their guidance and


constant supervision, as well as, for providing me the necessary
information regarding the project.

I am also thankful to my parents for their cooperation and


encouragement.

At last but not least, gratitude to all my friends who helped me to


complete this project within a limited time frame.
___________________
Signature
Name of Student :
Class :
CBSE Roll No :
Practical File Index

S.No. Names of Practical Date of Pg.No. Teacher


Practical Sign
1 Print Good Morning
Print Wish your friend Good
2 Morning
3 Add three Numbers
Add the numbers using Wrapper
4 Class
5 Find Maximum no. among three
6 Print weekdays using Switch
Find odd, even no. using While
7 loop
8 Print an array
Find average salary of 10
9 employees
Find Minimum and Maximum
10 salary
11 Sorting in alphabetic order
12 Search any element
13 Add three numbers using sum()
14 Parameterised function sum()
15 Examples of String method
16 Create table
17 Insert values
18 Display Information
19 Display Structure
20 List of Employees in 2020
Calculate HRA,DA,PF,NET,Gross
21 salary
22 Retrieve datails of Manager
23 Remove name start with K
24 Max, Min, Avg, Salary
25 Find Emp_id
26 Fetch employees
27 Show empno, name, salary
28 Show empid, name start with A
29 Show the eldest date of birth
30 Add column bonus
31 Use of Concat
32 Increament of employee
33 Use of Select
34 Use of Joins
35 Use of Count(*)
36 Display length
37 Drop table Salary
JAVA
PROGRAMS
PROGRAM 1
Write a program that print Good Morning to all.
import java.util.Scanner;
public class firstProgram
{
public static void main(String args[]) {
System.out.println("Good Morning to all");
}
}
OUTPUT:
Good Morning to all
PROGRAM 2
Write a program that wish your friend Good Morning.
import java.util.Scanner;
public class firstProgram
{
public static void main(String args[]) {
Scanner user_input=new Scanner (System.in);
System.out.print("enter your friend name");
String name=user_input.next();
System.out.println("Good Morning to my friend "+ name);
}
}
OUTPUT:
enter your friend nameMeera
Good Morning to my friend Meera
PROGRAM 3
Write a program that will add three numbers.
import java.util.Scanner;
public class addNo
{
public static void main(String args[]) {
Scanner sc=new Scanner (System.in);
System.out.print("Enter first no ");
int a=Integer.parseInt(sc.next());
System.out.print("Enter second no ");
int b=Integer.parseInt(sc.next());
System.out.print("Enter third no ");
int c=Integer.parseInt(sc.next());
int s=a+b+c;
System.out.print("Total is "+s);
}
}
OUTPUT:
Enter first no 45
Enter second no 67
Enter third no 89
Total is 201
PROGRAM 4
Write a program that will add the numbers using Wrapper class.
import java.util.Scanner;
public class helloClass
{
public static void main(String args[]) {
Integer b=new Integer(10);
int a=15;
int c=a+b.intValue();
System.out.print("The value of c is "+c);
}
}
OUTPUT:
The value of c is 25
PROGRAM 5
Write a program that will find the maximum number among three
numbers entered by user.
import java.util.Scanner;
public class secondProgram
{ public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("Enter first number= ");
int a=sc.nextInt();
System.out.print("Enter second number= ");
int b=sc.nextInt();
System.out.print("Enter third number= ");
int c=sc.nextInt();
int max;
if(a>b)
max=a;
else max=b;
if (max<c)
max=c;
System.out.println("Maximum "+max);
}}
OUTPUT:
Enter first number= 34
Enter second number= 56
Enter third number= 29
Maximum 56
PROGRAM 6
Write a program that will print the weekday name according to the
weekday number entered by user.
import java.util.Scanner;
public class switchProgram
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("Enter weekday- ");
int weekday=sc.nextInt();
switch(weekday)
{
case 1: System.out.print("Sunday");
break;
case 2: System.out.print("Monday");
break;
case 3: System.out.print("Tuesday");
break;
case 4: System.out.print("Wednesday");
break;
case 5: System.out.print("Thursday");
break;
case 6: System.out.print("Friday");
break;
case 7: System.out.print("Saturday");
break;
default: System.out.print("Invalid Number");
}
}
}
OUTPUT:
Enter weekday- 6
Friday
PROGRAM 7
Write a program to find the odd and even numbers from 1 to 10 using do
while loop.
import java.util.Scanner;
public class dowhileloop
{
public static void main(String args[]) {
int x=1;
do
{
if(x%2==0)
System.out.print(x+" is even\n");
else
System.out.print(x+" is odd\n");
x++;
}while(x<=10);
}
}
OUTPUT:
1 is odd
2 is even
3 is odd
4 is even
5 is odd
6 is even
7 is odd
8 is even
9 is odd
10 is even
PROGRAM 8
Write a program to declare an array and print its element on the screen.
import java.util.Scanner;
public class array1
{
public static void main(String args[]) {
double[] salary={45000,65000,55000,38700,34600,44700,44300,56500,65700};
for (int i=0;i<salary.length;i++)
{
System.out.print(salary[i]+" is "+(i+1)+"element\n");
}
}
}
OUTPUT:
45000.0 is 1element
65000.0 is 2element
55000.0 is 3element
38700.0 is 4element
34600.0 is 5element
44700.0 is 6element
44300.0 is 7element
56500.0 is 8element
65700.0 is 9element
PROGRAM 9
Write a program to calculate the average salary of 10 employees.
import java.util.Scanner;
public class array1
{
public static void main(String args[]) {
double sum=0; int I;
double[]
salary={45000,65000,64000,55000,38700,34600,44700,44300,56500,65700};
I=salary.length;
for (int i=0;i<salary.length;i++)
{
sum=sum+salary[i];
}
System.out.print("The average salary of "+I+" employee is "+sum/salary.length);
}
}
OUTPUT:
The average salary of 10 employee is 51350.0
PROGRAM 10
Write a program to calculate the minimum and maximum salary of 10
employees.
import java.util.Scanner;
import java.util.Arrays;
public class array1
{
public static void main(String args[]) {
double sum=0; int I;
double[]
salary={45000,65000,64000,55000,38700,34600,44700,44300,56500,65700};
I=salary.length;
Arrays.sort(salary);
for (int i=0;i<salary.length;i++)
{
System.out.println("The salary at "+(i+1)+" position "+salary[i]);
}
System.out.println(salary[0]+" is the minimum salary");
System.out.println(salary[salary.length-1]+" is the minimum salary");
}
}
OUTPUT:
The salary at 1 position 34600.0
The salary at 2 position 38700.0
The salary at 3 position 44300.0
The salary at 4 position 44700.0
The salary at 5 position 45000.0
The salary at 6 position 55000.0
The salary at 7 position 56500.0
The salary at 8 position 64000.0
The salary at 9 position 65000.0
The salary at 10 position 65700.0
34600.0 is the minimum salary
65700.0 is the minimum salary
PROGRAM 11
Write a program used to sort an array of Strings in the alphabetic order.
import java.util.Scanner;
import java.util.Arrays;
public class color
{
public static void main(String args[]) {
String[] color={"red","yellow","orange","blue","green","grey","purple"};
Arrays.sort(color);
for (int i=0;i<color.length;i++)
{
System.out.println(color[i]);
}
}
}
OUTPUT:
blue
green
grey
orange
purple
red
yellow
PROGRAM 12
Write a program used to search any element within the array.
import java.util.Scanner;
import java.util.Arrays;
public class arraysearch
{
public static void main(String args[]) {
double[] salary={45000,65000,64000,55000,38700,34600,44300,56500,65700};
Scanner sc=new Scanner(System.in);
System.out.print("enter number to be searched");
int key=Integer.parseInt(sc.next());
int index=Arrays.binarySearch(salary,key);
if(index!=-1)
System.out.println("element found at position "+(index+1));
else
System.out.println("element not found");

}
}
OUTPUT:
enter number to be searched38700
element found at position 5
PROGRAM 13
Write a user defined function sum() which will add 3 numbers.
import java.util.Scanner;
public class addNo
{
static int sum()
{
Scanner sc= new Scanner(System.in);
System.out.print("Enter first no ");
int a=Integer.parseInt(sc.next());
System.out.print("Enter second no ");
int b=Integer.parseInt(sc.next());
System.out.print("Enter third no ");
int c=Integer.parseInt(sc.next());
int s=a+b+c;
return s; }
public static void main(String args[]){
int t=sum();
System.out.println("Total is "+t);
}}
OUTPUT:
Enter first no 6
Enter second no 7
Enter third no 8
Total is 21
PROGRAM 14
Write a user defined parameterised function sum() which will add 3
numbers.
import java.util.Scanner;
public class addNo
{ static int sum(int a,int b,int c)
{ int s=a+b+c;
return s;}
public static void main(String args[]) {
Scanner sc= new Scanner(System.in);
System.out.print("Enter first no ");
int x=Integer.parseInt(sc.next());
System.out.print("Enter second no ");
int y=Integer.parseInt(sc.next());
System.out.print("Enter third no ");
int z=Integer.parseInt(sc.next());
int t=sum(x,y,z);
System.out.println("Total is"+t); }}
OUTPUT:
Enter first no 45
Enter second no 67
Enter third no 9 89
Total is201
PROGRAM 15
Write a program that will show the examples of String methods with
output.
import java.util.Scanner;
public class firstProgram
{
public static void main(String args[])
{
String Str="Good Morning ";
System.out.println(Str.charAt(3));
System.out.println(Str.concat("World"));
System.out.println(Str.contains("oo"));
System.out.println(Str.endsWith("ing"));
System.out.println(Str.equals("good morning"));
System.out.println(Str.equalsIgnoreCase("good morning"));
System.out.println(Str.indexOf('M'));
System.out.println(Str.isEmpty());
System.out.println(Str.length());
System.out.println(Str.replace("o","e"));
System.out.println(Str.replaceAll("o","e"));
System.out.println(Str.startsWith("G"));
System.out.println(Str.substring(3,7));
System.out.println(Str.toLowerCase());
System.out.println(Str.toUpperCase());
System.out.println(Str.trim());
}
}
OUTPUT:
d
Good Morning World
true
false
false
false
5
false
13
Geed Merning
Geed Merning
true
d Mo
good morning
GOOD MORNING
Good Morning
MySQL
QUERIES
Databases
A database may be defined as a collection of
interrelated data stored together to serve multiple
applications.

Rdms:
In relational data model, the data is organized into
tables (i.e., rows and columns). These are called
relations. A row in a table represents a relationship
among a set of values.

Mysql
SQL, Structured Query Language, was developed in
1970s in an IBM Laboratory. SQL, sometimes also
referred to as SEQUEL is a 4th generation non-
procedural language.

SQL, enables the following: (1) Creating/modifying a


database’s structure (ii) Changing security settings for
Page 40 of 57
system (iii) Permitting users for working on databases
or tables (iv) Querying database (v)
Inserting/Modifying/Deleting the database contents.

Data definition language (ddl): The SQL DDL


provides commands for defining relation schemas,
deleting relations, creating indexes, and modifying
relation schemas.

Some examples of such DDL statements are: CREATE


TABLE, ALTER TABLE, DROP TABLE, CREATE
INDEX, ALTER INDEX, DROP INDEX, RENAME
TABLE, TRUNCATE etc.

Data manipulation language (dml): The SQL


DML includes a query language based on both the
relational algebra and the tuple relational calculus. It
includes also commands to insert, delete, and modify
tuples in the database.

Some examples of such DML statements are: SELECT,


LOCK TABLE ect.

Transaction control language (TCL):A


transaction is successfully completed (known as
COMMIT) if and only if all its constituent steps are
successfully completed. To manage and control the
transactions, the transaction control commands are
used. These commands manage changes made by DML
commands. Some examples of TCL commands are:
Page 41 of 57
COMMIT, ROLLBACK, SAVEPOINT, SET
TRANSACTION.

SQl commands:
1.Show databases; It displays all the database, of the
system.

2.create database <Name>; It is used to create a


new database in the system.

3.Use <database name >; It is used to open a Specific


database.

4.Show tables; to display the list of table of the


database we have opened.

5.Create table; It is used to create a table With the


specified name.

6.Describe table name ; it is used to show the


structure of the specified table.

7.Select; It is used to display the records of the table.

8.Insert into; The rows are added command to


relation using insert command.

9.Delete command ; This command removes rows


from the table.

10.Update Command ; It is used to Contents modify


the of a table (increase, decrease or change).

Page 42 of 57
11. Group by; The GROUP BY clause combines all
those records that have identical values in a
particular field or a group of fields.

12. Group by – having; The HAVING clause places


conditions on groups in contrast to WHERE clause
that places conditions on individual rows.

Creating a table :--


Create database practical;

use practical;

create table employee_info(emp_id int primary key,emp_name varchar(30),DOB


date, DateOfJoin date, email_id varchar(30),address varchar(30), state
varchar(20),pincode int, phone_no varchar(15),sex varchar(10));

alter table employee_info add department varchar(20), designation varchar(20);

insert into employee_info values(101,'LAKSHAY SINGHAL','2005-02-24','2019-05-


02','KAVI NAGAR GAJRAULA','8266081865','MALE','COMPUTER SC','CEO');

insert into employee_info values(102,'ANSH YADAV','2005-05-02','2019-06-


04','TEVA COLONY GAJRAULA','8791196187','MALE','COMPUTER SC','MANAGER');

insert into employee_info values(103,'ADITYA BHATT','2005-02-25','2020-03-


22','C-44 TEVA COLONY
GAJRAULA','8979953163','MALE','MECHANICAL','MANAGER');

insert into employee_info values(104,'ANSH SHARMA','2005-05-10','2020-10-


14','TEACHERS COLONY GAJRAULA','8077869584','MALE','HR','MANAGER');

insert into employee_info values(105,'ARCHISHREE GUPTA','2005-06-21','2020-


10-14','JUBILIANT COLONY GAJRAULA','9897137127','FEMALE','HR','MANAGER');

Page 43 of 57
insert into employee_info values(106,'AYUSH VERMA','2005-05-17','2021-12-
24','MDA GAJRAULA','9913979603','MALE','MECHANICAL','CLERK');

insert into employee_info values(107,'SAMIKSHA GARG','1998-01-10','2022-04-


17','GOL ROAD DELHI','8649531854','FEMALE','COMPUTER SC','CLERK');

insert into employee_info values(108,'PIYA SHARMA','2005-10-12','2022-04-


22','SECTOR-62 NOIDA','9465865875','FEMALE','MECHANICAL','SALESMAN');

insert into employee_info values(109,'KAJOL DEVGAN','1974-08-05','2021-03-


06','CHANDNI CHOWK DELHI','8846328566','FEMALE','HR','OFFICER');

insert into employee_info values(110,'DISHA PATANI','1992-06-13','2021-07-


24','BANDRA MUMBAI','9348952675','FEMALE','COMPUTER SC','DIRECTOR');

create table salary(emp_id int,basic_salary float(10,2),HRA float(10,2),DA


float(10,2),PF float(10,2),Net_Salary float(10,2),Gross_Salary float(10,2));

insert into salary values(101,100000,00,00,00,00,00);

insert into salary values(102,80000,00,00,00,00,00);

insert into salary values(103,60000,00,00,00,00,00);

insert into salary values(104,80000,00,00,00,00,00);

insert into salary values(105,85000,00,00,00,00,00);

insert into salary values(106,35000,00,00,00,00,00);

Page 44 of 57
insert into salary values(107,45000,00,00,00,00,00);

insert into salary values(108,30000,00,00,00,00,00);

insert into salary values(109,60000,00,00,00,00,00);

insert into salary values(110,65000,00,00,00,00,00);

# 36. MYSQl questions:


1.Display all the information of the employee_info
table.

➢ select * from employee_info;

Page 45 of 57
2.Display the structure of the table employee_info.

➢ describe employee_info;

3.List the employees who are joined in the year 2020.

➢ SELECT * FROM Employee_info WHERE DateOfJoin >'2022-


01-01';

4.calculate values of HRA, DA, PF, NET SALARY


and GROSS SALARY from salary table.

➢ update salary set hra=basic_salary*10/100,


da=basic_salary*7/100, pf=basic_salary*6/100,
net_salary=basic_salary+hra+da,
gross_salary=net_salary+pf;

Page 46 of 57
5.To fetch all the Employees who are managers.

➢ select emp_name from Employee_info where designation


like 'manager';

6. To remove the employee from employee_info whose


name starts with k.

➢ delete from employee_info where name like ‘d%’;

Page 47 of 57
7.To find the maximum, minimum, and average
salary of the employees.

➢ select max(basic_salary), min(basic_salary),


avg(basic_salary) from salary;

8. To find the employee id whose salary lies in the


range of 80000 and 150000.

➢ select basic_salary from salary where basic_salary>80000


and basic_salary<150000;

9.To fetch the employees whose name begins with any


two characters, followed by a text “sh” and ends with
any sequence of characters.

➢ select emp_name from employee_info where emp_name


like '__sh%';

Page 48 of 57
10.show emp_no, emp_name and salary in ascending
order of salary.

➢ select a.emp_id,a.emp_name,b.net_salary from


employee_info a,salary b where a.emp_id=b.emp_id
order by b.net_salary;

11.show the emp_id of those whose name starts with ‘A’


or ends in ‘A’.

➢ select emp_id from employee_info where emp_name


like "a%a";

12.show the eldest date of birth and current date.

➢ select min(DOB), curdate() from employee_info;

Page 49 of 57
13.add column bonus.

➢ alter table salary add(bonus float(9));

14. select concat(emp_name,designation) from


employee_info where department like ‘computer sc';

15.To give increment to the employees as 10% of basic


salary as bonus.

➢ update salary set bonus=basic_salary*10/100;

Page 50 of 57
16.select emp_id, left(gross_salary,3) from salary;

17. display the names, net salary, gross salary of all the
male employees with their department and
designation.

➢ select a.emp_name, b.net_salary,


b.gross_salary,a.department, a.designation from
employee_info a, salary b where a.emp_id=b.emp_id
and sex like 'male';

18.Select department, count(*) from employee_info


group by department;

Page 51 of 57
19.display length of each name.

➢ select length(address),emp_id from employee_info;

20.Remove the table salary.

➢ Drop table salary;

Page 52 of 57

You might also like