0% found this document useful (0 votes)
16 views5 pages

Xii Cs Practical Sets

The document outlines various programming tasks related to Python and SQL, including creating functions for stack operations, file handling, and database queries. It includes specific examples of employee and activity tables, along with required SQL queries and Python functions for data manipulation. Additionally, it covers tasks involving reading and processing text files, as well as creating and searching CSV files.

Uploaded by

Mukeshwaran
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)
16 views5 pages

Xii Cs Practical Sets

The document outlines various programming tasks related to Python and SQL, including creating functions for stack operations, file handling, and database queries. It includes specific examples of employee and activity tables, along with required SQL queries and Python functions for data manipulation. Additionally, it covers tasks involving reading and processing text files, as well as creating and searching CSV files.

Uploaded by

Mukeshwaran
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/ 5

COMPUTER SCIENCE(CODE: 083) A

1 Create a python program using Stack, 8

i) write function push to add elements in to the stack


ii) write function remove to pop the element of the stack
iii) write function display to print all the elements in the stack
2 Consider the following tables EMPLOYEE and SALGRADE and answer the questions given 4
below:

Table: EMPLOYEE

ECODE NAME DESC SGRADE DOJ DOB


11 AMIT EXECUTIVE S003 23-03-2003 13-01-1980
12 RAM SHARMA IT HEAD S002 12-02-2010 22-07-1987
13 CHITRA RECEPTIONIST S003 24-06-2009 24-07-1983
14 NARESH GM S002 11-08-2006 03-03-1984
15 PRIYA CEO S001 29-12-2004 19-01-1982

Table: SALGRADE
SGRADE SALARY HRA
S001 56000 18000
S002 32000 12000
S003 24000 8000

1. To display the details of all EMPLOYEEs in descending order of DOJ.


2. To add a new row in employee table with the following:
19,” Harish’, “IT HEAD”,’S002’,’09-09-2007’, ’21-04-1983’.
3. To display NAME and SALARY from table EMPLOYEE and SALGRADE of employee of
ECODE is below 13
Give the output for the following:
4. SELECT COUNT(SGRADE),SGRADE FROM EMPLOYEE GROUP BY SGRADE;
B
COMPUTER SCIENCE(CODE: 083)

Write a python program to create the following functions:


1 i) count_p() - count number of lines starting with character ‘p’ in the text file “mytext.txt” 8
ii) copy_p() - write those lines with character ‘p’ to another text file "newtext.txt".
2
Consider the following tables ACTIVITY and COACH and answer the questions given below:

TABLE: ACTIVITY
Acode ActivityName Stadium ParticipantsNum PrizeMoney ScheduleDate
1001 Relay 100x4 Star Annex 16 10000 23-Jan-04
1002 High jump Star Annex 10 12000 12-Dec-03
1003 Shot put Super Power 12 8000 14-Feb-04
1005 Long jump Star Annex 12 9000 01-Jan-04
1008 Discuss Throw Super Power 10 15000 19-Mar-04

TABLE: COACH

Pcode Name Acode


4
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Jamila 1001
4 Naaz 1003

1. To display the Acode, ActivityName, Stadium from the table ACTIVITY of Prize Money
greater than 10000
2. To display the names of all activities with their Acodes in descending order
3. To display the coach’s name, Activity Name and ACode from the table ACTIVITY and
COACH which has more than 13 participants.
Give the output for the following:
4. SELECT Name, ActivityName FROM ACTIVITY A Natural Join COACH C;
C

COMPUTER SCIENCE(CODE: 083)

1 Write a python program to create the following functions: 8


i) add() - to create a binary file sports.dat with the player details in the form of list.
ii) search() - to read the player id from the user and display the details of particular player.
2 4
Consider the following tables SALESPERSON and ITEM and answer the questions given below:

TABLE: SALESPERSON
Code NAME SALARY ITCODE
1001 TANDEEP JHA 60000 12
1002 YOGRAJ SINHA 70000 15
1003 TENZIN JACK 45000 12
1005 ANOKHI RAJ 50000 17
1004 TARANA SEN 55000 17

TABLE: ITEM
ITCODE ITEMTYPE TURNOVER
15 STATIONERY 3400000
17 HOSIERY 6500000
12 BAKERY 10090000

1. To display the CODE and NAME of all SALESPERSON having “I7” Item Type Code from
the table SALESPERSON.
2. To display all details from table SALESPERSON in descending order of SALARY
3. To display NAME of all the salespersons from the SALESPERSON table along with their
corresponding ITEMTYPE from the ITEM table.
Give the output for the following:
4. SELECT DISTINCT ITCODE FROM SALESPERSON;
5. SELECT CODE,NAME, I.ITCODE FROM SALESPERSON S, ITEM I WHERE
S.ITCODE=I.ITCODE AND TURNOVER>=7000000;

D
COMPUTER SCIENCE(CODE: 083)

1 8
Write a Python Program to create the following functions:
i) create_csv - create a CSV file student.csv with the details [sno,name,marks] of n number of
students.
ii) search_csv - search a student record(sno) from a csv file student and display all the details of
the particular student.
2 4
Consider the following tables WORKER and PAYLEVEL and answer the questions given below:

TABLE: WORKER
ECODE NAME DESIG PLEVEL DOJ DOB
11 Radhe Shyam Supervisor P001 13-Sep-04 23-Aug-81
12 Chander Nath Operator P003 22-Feb-10 12-Jul-87
13 Fizza Operator P003 14-Jun-09 14-Oct-83
15 Ameen Ahmed Mechanic P002 21-Aug-06 13-Mar-84
18 Sanya Clerk P002 19-Dec-05 09-Jun-83

TABLE: PAYLEVEL
PLEVEL PAY ALLOWANCE
P001 26000 12000
P002 22000 10000
P003 12000 6000

1. To display the details of all WORKERs, descending order of DOB.


2. To add a new row with the following: 19,”Days Kishore‟, ”Operator‟, " P003‟,”19-Jun-2008‟,
”11-Jul-1984‟
3. To display NAME, DESIG and PAY of those WORKERs from the table WORKER and
PAYLEVEL whose PLEVEL is either P001 or P002.
Give the output for the following:
4. SELECT MAX(DOB), MIN(DOJ) FROM WORKER;

3 Report/Practical File 7
4 Project 8
5 Viva Voce 3
E
COMPUTER SCIENCE(CODE: 083)

1 Write a program to read a text file "paragraph.txt" and perform the following functions : 8
i) display_chr() - display the number vowels, consonants, uppercase and lowercase letters in the file.
ii) count_the() - display total number times the word "the" occurs in the text file

Consider the following tables BOOKS and ISSUED and answer the questions given below: 4
2
TABLE: BOOKS
Book_Id Book_Name Author_Name Publishers Price Type Quantity
F000
1 The Tears William Hopkins First Publ. 750 Fiction 10
F000
2 Thunderbolts Anna Roberts First Publ. 700 Fiction 5
T000
1 My First C++ Brain & Brooke EPB 250 Text 10
T000 C++
2 Brainworks A.W. Rossaine TDH 325 Text 5
C000
1 Fask Cook Lata Kapoor EPD 350 Cookery 8

TABLE: ISSUED
Book_Id Quantity_Issued
F0001 3
T0001 1
C0001 5

1. To show Book name, Author name and Price of books of EPB publishers
2. To increase the price of all books of First Publ. by 50
3. To display the Book_Id, Book_Name and Quantity_Issued for all books from the table BOOKS
and ISSUED which have been issued.
Give the output for the following:
4. SELECT SUM(Price) FROM Books WHERE Quantity >5;

You might also like