0% found this document useful (0 votes)
78 views32 pages

Practical File 23-24

Uploaded by

shafat.bazaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views32 pages

Practical File 23-24

Uploaded by

shafat.bazaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

/

COMPUTER SCIENCE

PRACTICAL FILE

GRADE 12 (2023-2024)

NAME - Hadi Shafat


CLASS - 12A

ROLL No. -
Certificate
Roll No.___________________________

Certified that Miss/Master ____________________________________________


of Grade ____________________ Section ____________________ has carried out
practical work in Computer Science prescribed by the Central Board of Secondary
Education, New Delhi during the academic year 2021-2022.

Teacher-in charge

____________________________

Date:

_______________________ _______________________

External Examiner Internal Examiner


INDEX

S.No Date Particulars Pg.No


1. LINEAR SEARCH

2. USER DEFINED FUNCTION

3 FACTORIAL NUMBER SERIES

4. LOGIN CREDENTIALS_CHECKING

5. DICTIONARY MANIPULATION

6. STRING MANIPULATION

7. RANDOM NUMBER GENERATOR

8. TEXT FILE HANDLING-1

9. TEXT FILE HANDLING-2

10. TEXT FILE HANDLING-3

11. TEXT FILE HANDLING-4

12. BINARY FILE HANDLING-1

13. Stack using LIst

14. CSV FILE HANDLING-1

15. CSV FILE HANDLING-21

16. SQL Queries Set-1

17. SQL Queries Set-2

18. SQL Queries Set-3

19. SQL Queries Set-4

20. SQL Queries Set-5

21. Python - SQL connectivity


PRACTICAL- 1

AIM- Write a program to search an element in a list and display the


frequency of element present in list and their location using Linear
search.

INPUT

OUTPUT
PRACTICAL- 2

AIM- Write a program to pass list to a function and double the odd values and
half even values of a list and display list element after changing.

INPUT

OUTPUT
PRACTICAL- 3

AIM- Write a python program using a function to print factorial number series from n to m numbers.

INPUT

OUTPUT

PRACTICAL- 4
AIM- Write a python program to accept the username “Admin” as the default argument and password
123 entered by the user to allow login into the system.

INPUT

OUTPUT

PRACTICAL- 5
AIM- Write a program to function with key and value, and update
value at that key in dictionary entered by user

INPUT

OUTPUT
PRACTICAL- 6

AIM- Write a program to pass a string to a function and count how many vowels
present in the string
INPUT

OUTPUT
PRACTICAL- 7

AIM- Write a program to generator that generates random numbers


between 1 and 6 using user defined function

INPUT

OUTPUT
PRACTICAL- 8

AIM- WAP to read a text file line by line and display each word separated by a #.

INPUT

OUTPUT
PRACTICAL- 9

AIM- WAP to read a text file and display the number of vowels/consonants/uppercase/lowercase
characters in the file

INPUT

OUTPUT

PRACTICAL-1 0
AIM- Write a program to know the cursor position and print the text according to the below-given
specifications:

o Print the initial position


o Move the cursor to 4th position
o Display next 5 characters
o Move the cursor to the next 10 characters
o Print the current cursor position
o Print next 10 characters from the current cursor position

INPUT

OUTPUT
PRACTICAL- 11

AIM- Write a program to remove all the lines that contain the character ‘a’ in a file
and write it to another file.

INPUT

OUTPUT

PRACTICAL- 12
AIM- Write a program to create a binary file with name, roll number and marks.

i. display the records of students who scored more than 95 marks.


ii. search for a given roll number and display name, if not found display
appropriate

INPUT
PRACTICAL- 13

AIM-
Write a Python program to implement a stack using list.

INPUT

OUTPUT

PRACTICAL- 15
AIM- Write a program to create a CSV file with empid, name and mobile no. and search
empid, update the record and display the records

INPUT

OUTPUT

Queries Set 1 (Database Fetching records)


[1] Consider the following MOVIE table and write the SQL queries based on it.
1. Display all information from movie.
Select * from Movie;

2.
Display the type of movies.
--Select Type from Movie;

3. Display movieid, moviename, total_eraning by


showing the business done by the movies.
Claculate the business done by movie using the sum of
productioncost and businesscost.
--Select movieid, moviename , productioncost+businesscost as ‘Total Earnings’ from Movie;

4. Display movieid, moviename and productioncost for all movies with productioncost greater
than 150000 and less than 1000000.
--Select movieid, moviename , productioncost
where production cost between 150000 and 1000000;

5. Display the movie of type action and romance.


--Select from Movie where type in (‘action’, ‘romance’ );
Queries set 2 (Aggregate Functions)

Consider the given table patient and Write following queries:

1. Display the total charges of patients admitted in the month of November.


Select SUM(charges) from patients where %____11__%;

2. Display the eldest patient with name and age.


Select pname , age from patient where age(Select Max(Age) from patients);

3. Count the unique departments.


Select count (DISTINC department ) from patients ;

4. Display average charges.


Select avg(charges) from patients;
Queries set 3 (DDL Commands)

1. Create a database “Sports”.


2. Create a table “TEAM” with following considerations:
o It should have a column TeamID for storing an integer value between 1 to 9, which
refers to unique identification of a team.
o Each TeamID should have its associated name (TeamName), which should be a string of
length not less than 10 characters.
o Using table level constraint, make TeamID as the primary key.
o Show the structure of the table TEAM using a SQL statement.
o As per the preferences of the students four teams were formed as given below. Insert
these four rows in TEAM table:
o Row 1: (1, Tehlka)
o Row 2: (2, Toofan)
o Row 3: (3, Aandhi)
o Row 3: (4, Shailab)
o Show the contents of the table TEAM using a DML statement.
3. Now create another table MATCH_DETAILS and insert data as shown below. Choose
appropriate data types and constraints for each attribute.
Queries set 4 (Based on Two Tables)

1. Display the matchid, teamid, teamscore who scored more than 70 in the first inning along with team
name.

2. Display matchid, teamname and secondteamscore between 100 to 160.


3. Display matchid, teamnames along with matchdates.
4. Displayune team names
5. Display matchid and matchdate played by Anadhi and Shailab
1.

2.

3.

4.

5.
Queries Set 5 (Group by , Order By)
Consider the following table stock table to answer the queries:

1. Display all the items in the ascending order of stockdate.


Select * from stationary order by stockdate ASC

2. Display maximum price of items for each dealer individually as per dcode from stock.
Select item,dcode,qty*unitprice as ‘selling_price’ from stationary

3. Display all the items in descending orders of itemnames.


Select * from stationary order by item DESC
4. Display average price of items for each dealer individually as per doce from stock which
avergae price is more than 5.
Select AVG(price) from stationary where price > ‘5’

5. Diisplay the sum of quantity for each dcode.


Select SUM(qty) from stationary
Python – MySQL Connectivity

1. Write a MySQL connectivity program in Python to


o Create a database school
o Create a table students with the specifications – ROLLNO integer, STNAME
character(10) in MySQL and perform the following operations:
 Insert two records in it
 Display the contents of the table
Display the contents of the table
Output:
2. Write a menu-driven program to store data into a MySQL database named shop and table customer
as following:

1. Add customer details


2. Update customer details
3. Delete customer details
4. Display all customer details

INPUT:
OUTPUT:
1)

2)

3)

4)
3. Modify the above program and display the customer details based on the following menu:

1. Display customer details by city


2. Display customer details by bill amount
3. Display customer details by name
4. Display customer details by category

2)

3)

4)
OUTPUT:

You might also like