[go: up one dir, main page]

0% found this document useful (0 votes)
90 views36 pages

Class 12 Python & SQL Practical Tasks

This document contains a summary of programming tasks completed by a student. It includes 13 Python programs involving functions that manipulate lists, stacks, dictionaries, files and CSV files. It also includes 21 SQL queries involving creating and manipulating databases and tables, adding, updating and deleting records, joining tables and more. The tasks cover a range of fundamental programming and database concepts.

Uploaded by

Nikhil Johari
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)
90 views36 pages

Class 12 Python & SQL Practical Tasks

This document contains a summary of programming tasks completed by a student. It includes 13 Python programs involving functions that manipulate lists, stacks, dictionaries, files and CSV files. It also includes 21 SQL queries involving creating and manipulating databases and tables, adding, updating and deleting records, joining tables and more. The tasks cover a range of fundamental programming and database concepts.

Uploaded by

Nikhil Johari
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

CS PRACTICAL FILE

CLASS 12 A ROLL NO 17 NIKHIL JOHARI


INDEX:
[Link] PROGRAM DATE SIGNATURE
1 WAF EOREPLACE() WHICH ACCEPTS a list L of numbers.
The function is supposed to increment all even numbers
by 1 and decrements all odd numbers by 1.
2 A list contains following record of a customer :
[Customer_name, Room_type] Write the following user
defined functions to perform given operations on the
stack named ‘Hotel’ :
(i) Push_Cust() : To push customer names of
those customers who are staying in “Delux’
Room type.
(ii) Pop_Cust() : To pop the names of customers
from the stack and display them. Also,
display “Underflow” when there are no
customers In the stack.
3 WAF Push(Vehicle) where, Vehicle is a dictionary
containing details of vehicles - {Car_name:Maker}. The
function should push the name of car manufactured by
‘TATA’ to the stack.
4. WA function to create a file and put some text to it.
Write another function that reads this file and print the
file contents in reverse.
5. WA function to create a file and enter some lines in it.
Write another function to return the size of file in bytes.
6. WAF to enter student records [rno,name,age] in a
binary file. Also write a function to search for a
particular roll number in the file.
7. WAF to enter student records {“rno”: rno,”name”:name
,”age”: age] in a binary file. Also write a function to
modify age for a particular roll number in the file.
8. WAF to enter student records in a binary file. Also write
a function to delete record of a particular roll number in
the file.
9. WA function to create a file and enter some lines in it.
Write another function to return the number of words
in the file
10. WA function to create a file and enter some lines in it.
Write another function to return the number of lines
that begin with a vowel
11. WA function to create a file and enter some lines in it.
Write another function to print number of words in
each line.
12. WAP to write records of emp [empno, ename, age] to a
CSV File. Also read all these records from the CSV File
created and print the same. Count the number of
records in the CSV File
13. SQL QUERIES
PYTHON:
Q1: WAF EOREPLACE() WHICH ACCEPTS a list
L of numbers. The function is supposed to
increment all even numbers by 1 and
decrements all odd numbers by 1.
Q2: A list contains following record of a
customer : [Customer_name, Room_type]
Write the following user defined functions to
perform given operations on the stack named
‘Hotel’ :
(i) Push_Cust() : To
push customer names of those customers
who are staying in “Delux’ Room type.
Pop_Cust() : To pop the names of customers
from the stack and display them. Also, display
“Underflow” when there are no customers in
the stack
Q3: WAF Push(Vehicle) where, Vehicle is a
dictionary containing details of vehicles -
{Car_name:Maker}. The function should push
the name of car manufactured by ‘TATA’ to
the stack.
Q4: WA function to create a file and put some
text to it. Write another function that reads
this file and print the file contents in reverse.

Q5: WA function to create a file and enter


some lines in it. Write another function to
return the size of file in bytes.

Q6: WAF to enter student records


[rno,name,age] in a binary file. Also write a
function to search for a particular roll number
in the file.
Q7: WAF to enter student records {“rno”:
rno,”name”:name ,”age”: age] in a binary file.
Also write a function to modify age for a
particular roll number in the file.
Q8: WAF to enter student records in a binary
file. Also write a function to delete record of a
particular roll number in the f WAF to enter
student records in a binary file. Also write a
function to delete record of a particular roll
number in the file

Q9: WA function to create a file and enter


some lines in it. Write another function to
return the number of words in the file
Q10: WA function to create a file and enter
some lines in it. Write another function to
return the number of lines that begin with a
vowel.
Q11: WA function to create a file and enter
some lines in it. Write another function to
print number of words in each line
Q12: WAP to write records of emp
[empno,ename,age] to a CSV File. Also read
all these records from the CSV File created
and print the same. Count the number of
records in the CSV File
SQL QUERIES:
Q1: CREATE A DATABASE:
Q2: CHANGE DATABASE:
Q3: DISPLAY THE LISTINGS OF TABLE IN THE
DATABASE:
Q4: CREATE A TABLE
Q5: DISPLAY STRUCTURE OF THE TABLE
Q6: ADD DATA TO THE TABLE
Q7: DISPLAY CONTENTS OF TABLE
Q8: DISPLAY SELECTED COLUMNS OF TABLE
Q9: DISPLAY SELECTED ROWS OF THE TABLE
Q10: PATTERN MATCHING IN SQL
Q11: USING ‘IN’ OPERATOR
Q12: USING ‘BETWEEN’ OPERATOR
Q13: USING ‘DISTINCT’
Q14: USING ‘AGGREGATE’ FUNCTION:
Q15: TO ARRANGE RESULTS IN ASCENDING
OR DESCENDING ORDER
Q16: GROUP RECORDS ON THE BASIS OF A
COMMON VALUE IN COULMN
Q17: USING ‘HAVING’ TO RESTRICT DISPLAY
OF GROUPS
Q18: CHANGING/UPDATING VALUE OF ONE
OR MORE RECORDS IN A TABLE
Q19: TO DELETE SELECTED RECORDS FROM A
TABLE
Q20: CARTESION PRODUCT OF 2 TABLES IN
SQL
Q21: 2 QUERIES OF ‘JOIN’

You might also like