Rel Cer Cs
Rel Cer Cs
vfEcdkiqj
Telephone : 07774-261609 (j{kk ea=ky; ds vf/ku
lapkfyr)
email: [email protected] Sainik School Ambikapur
website: www.sainikschoolambikapur.org.in (Under the aegis of Ministry of
Defence)
es.Mªkdyka] iksLV
fHkV~Bhdyka
Mendra Kalan, Post – Bhitti Kalan
ftyk & ljxqtk
¼NRRkhlx<+½
Dist – Surguja (Chhattisgarh)
fiu dksM+ & 497 001
PIN – 497 001
1. Lab Test:
1) Python Program [8]
1. Write a program to read content of a file “MEMO.TXT” and print number of
occurrence of the word “do” in it. Do not count the within a word eg. “done”.
Ex :- I will do it, if you request me to do it. It would have been done much earlier
3. Write a function in Python that counts the number of “Me” or “My” words present
in a text file “STORY.TXT”
4. Write a program using function SUMFUN( ) with arguments X and N which
returns the sum of N terms of the following: x-x3 /3 + x5 /5 – x7 /7 + x9 /9…..
5. Write a python program using function PUSH(Arr), where Arr is a list of numbers.
From this list push all numbers divisible by 5 into a stack implemented by using a
list. Display the stack if it has at least one element, otherwise display appropriate
error message.
6. Program to write data in a csv file student.csv. and then read and display the data
from student.csv file.
7. Write a program to accept an array of marks of ten students and sort using
Bubble/Selection sort.
1
8. Write a python program using function POP(Arr), where Arr is a stack
implemented by a list of numbers. The function returns the value deleted from the
stack.
10. WAP to open a file and count the Number of Lines, No. of Words and No.
of Characters in a given file.
11. Write a Program to create a binary file to store roll number and name and search
any roll number and display the respective name.
12. Write a python program to create a stack of Book’s record which contains [Book
code, Book title, Book price].
Write function PUSH to add record into the stack
Write function POP and display the record in the stack
13. Write a function in Python that counts the number of “this” or “that” words present
in a text file “STORY.TXT”
14. Write a python program to create stack Sport_Stack to store age of sportsman
using stack implementation as list. Write Operation for Push, Pop and Traversal
operation using menu.
15. Write a python code to create a SQL table Cadet (using pymysql interface )
with following specifications:
16. Write a python code to create a SQL table Student (using pymysql interface )
with following specifications:
Admno – int – size 4 – Primary Key
SName – char – size 15
DOB – Date
Note the following to establish connectivity between Python and MYSQL:
Username is root
Password is tiger
2
Insert one row as given below:
AdmNo SName DOB
1229 Harsh Bhati 21-03-2006
Q Write queries for (i) to (iii) and find outputs (any one) for SQL queries (iv) to (v), which are based on the
following tables: Table : VEHICLE
Note:
PERKS is Freight Charges per kilometer.
Km is kilometers Travelled
NOP is number of passengers travelled in vehicle.
i. To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.
ii. To display the CNO and CNAME of those customers from the table TRAVEL who travelled between
‘2015-1231’ and ‘2015-05-01’.
iii. To display all the details from table TRAVEL for the customers, who have travel distance more than 120
KM in ascending order of NOE
iv. SELECT COUNT (*), VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT (*) > 1;
v. SELECT DISTINCT VCODE FROM TRAVEL;
Q. Write queries for (i) to (iii) and find outputs (any one) for SQL queries (iv) to (v), which are based on
the following tables :
3
Note:
PERKM is Freight Charges per kilometer
TTYPE is Transport Vehicle Type
NO is Driver Number
KM is Kilometer travelled
NOP is number of travelers travelled in vehicle
TDATE is Trip Date
i. To display NO, NAME, TDATE from the table TRIP in descending order of NO.
ii. To display the NAME of the drivers from the table TRIP who are traveling by transport vehicle
with code 101 or 103.
iii. To display the NO and NAME of those drivers from the table TRIP who travelled between
‘2015-02-10’ and ‘2015-04-01’.
iv. SELECT COUNT (*), TCODE From TRIP GROUP BY TCODE HAVNING Count (*) > 1;
v. SELECT DISTINCT TCODE from TRIP;
Q. Write queries for (i) to (iii) and find outputs (any one) for SQL queries (iv) to (v), which are based on
the following tables:
i. To display those company name which are having prize less than 30000.
ii. To display the name of the companies in reverse alphabetical order.
iii. To increase the prize by 1000 for those customers whose name starts with S?
iv. SELECT COUNT(*) , CITY FROM COMPANY GROUP BY CITY;
v. SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%”;
5. VIVA [03]
******