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

Practical File 2024-25

Uploaded by

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

Practical File 2024-25

Uploaded by

bharatram767995
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18

DR.

APJ ABDUL KALAM


C.B.SR.SEC.SCHOOL

SHASTRI BAZAR , DELHI CANTT-10

INFORMATION TECHNOLOGY
(802)
PRACTICAL FILE (SESSION:2024-25)

SUBMITTED BY:

NAME OF SUBJECT TEACHER : Ms. ARCHANA

ARUN

CLASS: XII A

ROLL NO:
ACKNOWLEDGEMENT
I wish to express my deep sense of gratitude and indebtedness to our
learned teacher M s .ARCHANA ARUN DR.APJ ABDUL KALAM
C.B.SR.SEC.SCHOOL] for her invaluable help, advice and guidance in
the preparation of this project.

I am also greatly indebted to our Principal


Mr.RAMSWAROOP SAMRIA and school authorities for providing me
with the facilities and requisite laboratory conditions for making this
practical file.

I also extend my thanks to a number of teachers , parents,


my classmates and friends who helped me to complete this practical file
successfully.
Md.SAMIR ANSARI

CERTIFICATE
This is to certify that Md.SAMIR ANSARI of Class XII,
Dr.A.P.J.ABDUL KALAM C.B.Sr.Sec.SCHOOL has completed
the Term II - PRACTICAL FILE during the academic year [2024-
25] towards partial fulfillment of credit for the Information
Technology (802) practical evaluation of CBSE and submitted
satisfactory report, as compiled in the following pages, under my
supervision.

Internal Examiner External Examiner


Signature Signature

1. MYSQL QUERIES

No. Practical Signature

1 Create a student table with the student id, name, and marks as
attributes where the student id is the primary key.
2 Insert the details of a new student in the above table
3 Delete the details of a student in the above table
4 Use the select command to get the details of the students with marks
more than 80
5 Find the min, max, sum, and average of the marks in a student
marks table
6 Find the total number of customers from each country in the table
(customer ID, customer Name, country) using group by.
7 Write a SQL query to order the (student ID, marks) table in
descending order of the marks
Write a SQL query to display the marks without decimal places,
8 display the reminder after diving marks by 3 and
display the square of marks
Write a SQL query to display names into capital letters, small
9 letters, display firstt 3 letters of name, display last 3 letters of name,
display the position the letter A in name
10 Remove extra spaces from left, right and both sides from the text - "
Informatics Practices Class XII "
2. JAVA PROGRAM

No. Practical Signature

1 Write a program to accept integer number from user and print the
number.

2 Write a program to accept two numbers from the user and find the
sum of numbers.
3 Write a program to swap the numbers without using 3rd variable.

4 Write a program to accept number from the user and check


whether number is even or odd.
5 Write a program to accept number from the user and check whether
an alphabet is vowel or consonant.
6 Write a program to Find Factorial of a Number.

7 Write a program to accept three numbers from the user and find
the largest number.
Write a program to check leap year.
8
Write a program the check whether a number is positive or negative.
9

10 Write a program to check whether a character is alphabet or not.

11 Write a program to print the Fibonacci series using for Loop.

12 Write a program to find the concatenate of two different string.


1. MYSQL QUERIES
1. Create a student table with the student id, name, and marks as attributes
where the student id is the primary key.
Ans.:
create table student
(studentid int(3) primary key,
name varchar(20) not null,
marks decimal(5,2));

2. Insert the details of a new student in the above table.

Table data:
3. Delete the details of a student in the above
table. Ans.:
delete from student where studentid=5;

4. Use the select command to get the details of the students with marks more
than 80.
Ans.:
select * from student where marks>80;
5. Find the min, max, sum, and average of the marks in a student marks table.
Ans.:
select max(marks), min(marks), sum(marks) , avg(marks)
from student;

6. Find the total number of customers from each country in the table (customer ID,
customer Name, country) using group by.
Ans.:
select country, count(customer_id) from customer group by
country;
7. Write a SQL query to order the (student ID, marks) table in descending order
of the marks.
Ans.:
select * from student order by marks desc;

8. Write a SQL query to display the marks without decimal places, display
the reminder after diving marks by 3 and display the square of marks.
Ans.:
select round(marks,0),mod(marks,3),pow(marks,2) from
student;
9. Write a SQL query to display names into capital letters, small letters, display frist
3 letters of name, display last 3 letters of name, display the position the letter A in
name
Ans.:
select ucase(name), lcase(name), left(name,3),right(name,3),
instr(name,'a') from student;

10. Remove extra spaces from left, right and both sidesfrom the text - "
Informatics Practices Class XII "
Ans.:
select ltrim(" Informatics Practices Class XII ") "Left
Spaces", rtim(" Informatics Practices Class XII ") "Right

Trim", trim(" Informatics Practices Class XII ");


2.Java program
1. Write a program to accept integer number from user and print the number.
import java.util.Scanner;

public class HelloWorld {

public static void main(String[] args) {

Scanner reader = new Scanner(System.in);


System.out.print("Enter a number: ");

int number = reader.nextInt();

System.out.println("You entered: " + number);


}
}

Output -
Enter a number: 20
You entered: 20

2. Write a program to accept two numbers from the user and find the sum of
numbers.
import java.util.Scanner;

public class sum{

public static void main(String[] args) {

int n1=22, n2=44, sum;

sum = n1 + n2;
System.out.println("The sum is: " + sum);
}
}

Output -
Enter two numbers
22 44
The sum is: 66
3. Write a program to swap the numbers without using 3rd variable.
import java.util.Scanner;

public class Swap {


public static void main(String[] args) {
int n1=51, n2=48;
System.out.println("First number = " + n1);
System.out.println("Second number = " + n2);
n1=n1+n2;
n2=n1-n2;
n1=n1-n2;

System.out.println("Result");
System.out.println("First number = " + n1);
System.out.println("Second number = " + n2);
}
}

Output -
First number = 51
Second number = 48
Result
First number = 48
Second number = 51

4. Write a program to accept number from the user and check whether number
is even or odd.
import java.util.Scanner;

public class EvenOdd {


public static void main(String[] args) {

Scanner reader = new Scanner(System.in);


System.out.print("Enter a number: ");
int num = reader.nextInt();
if(num % 2 == 0)
System.out.println(num + " is even");
else
System.out.println(num + " is odd");
}
}
Output -
Enter a number: 22
22 is even

5. Write a program to accept number from the user and check whether an
alphabet is vowel or consonant.
import java.util.Scanner;

public class VowelConsonant{


public static void main(String[] args) {

Scanner reader = new Scanner(System.in);


System.out.print("Enter a character: ");
char ch = reader.next().charAt(0);

if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )


System.out.println(ch + " is vowel");
else
System.out.println(ch + " is consonant");

}
}

Output -
Enter a character: a
a is vowel

6. Write a program to Find Factorial of a Number.


import java.util.Scanner;

public class Factorial {

public static void main(String[] args) {


Scanner reader = new Scanner(System.in);
System.out.print("Enter the number: ");

int num = reader.nextInt();


long fact = 1;
for(int i = 1; i <= num; i++)
{
fact = fact* i;
}
System.out.printf("Factorial of a number ", +fact);
}
}

Output -
Enter the number: 5
Factorial of the number: 120

7. Write a program to accept three numbers from the user and find the largest
number.

import java.util.Scanner;

public class Largest {


public static void main(String[] args) {

Scanner reader = new Scanner(System.in);


System.out.print("Enter a 1st number: ");
char n1 = reader.nextInt();

System.out.print("Enter a 2nd number: ");


char n2 = reader.nextInt();

System.out.print("Enter a 3rd number: ");


char n3 = reader.nextInt();

if( n1 >= n2 && n1 >= n3)


System.out.println(n1 + " is the largest number.");

else if (n2 >= n1)


System.out.println(n2 + " is the largest number.");

else
System.out.println(n3 + " is the largest number");
}
}

Output -

Enter a 1st number: 7

Enter a 2nd number: 3

Enter a 3rd number: 9

9 is the largest number


8. Write a program to check leap year.
import java.util.Scanner;

public class Main{


public static void main(String[] args) {

int year = 2022;


boolean leap = false;

if (year % 4 == 0) {

if (year % 100 == 0) {
if (year % 400 == 0)
leap = true;
else
leap = false;
}

else
leap = true;
}

else
leap = false;

if (leap)
System.out.println(year + " is a leap year.");
else
System.out.println(year + " is not a leap year");
}
}

Output -
2022 is not a leap year
9. Write a program the check whether a number is positive or negative.
import java.util.Scanner;

public class positive or negative number{


public static void main(String[] args) {

double n1 = 18;

if (number < 0.0)


System.out.println(number + " is a negative number");

else if ( number > 0.0)


System.out.println(number + " is a positive number");

else
System.out.println(number + " is 0");
}
}

Output -
18 is a positive number

10. Write a program to check whether a character is alphabet or not.


import java.util.Scanner;

public class alphabet {


public static void main(String[] args) {

char c = 'a';

if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
System.out.println(c + " is an alphabet");
else
System.out.println(c + " is not an alphabet");
}
}

Output -
a is an alphabet
11. Write a program to print the Fibonacci series using for Loop.
import java.util.Scanner;

public class main {


public static void main(String[] args) {

int n = 10, first = 0, second = 1, sum = 0;


System.out.println("Fibonacci Series till " + n + " terms:");

for (int i = 1; i <= n; i++) {


System.out.print(first + ", ");

sum = first + second;


first = second;
second = sum;
}
}
}

Output
Fibonacci Series till 10 terms:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34

12. Write a program to find the concatenate of two different string.

import java.util.Scanner;

public class concatenate {


public static void main(String[] args) {
String str1="Information";
String str2="Technology";

String str3=str1.concat(str2);

System.out.println(str3);

}
}

Output -
Information Technology

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy