You are on page 1of 34

DELHI PUBLIC SCHOOL, RANCHI

REPORT FILE
COMPUTER SCIENCE
(083)

NAME: PRANAY PRATEEK


CLASS: XII ‘H’
ROLL NO: 29
BOARD ROLL NO:
INDEX
1: Write a program to enter two nos. and print the arithmetic operations
like +,-,*,/,// and % as per user choice.

Source Code:

Output:
2: Write a program to enter two nos. and print the arithmetic operations
like +,-,*,/,// and % as per user choice.

Source Code:

Output:
3: write a program to enter the number of terms and print the fibonacci
series.

Source Code:

Output:
4: Write a program to enter the string and display the longest word present
in the entered string.

Source Code:

Output:
5: Write a python function that takes a number as a parameter and checks
whether a number is prime or not.

Source Code:

Output:
6: Write a python function to add the first ‘n’ terms of the series:
1+1/2-1/3+1/4-1/5+………………………

Source Code:

Output:
7: Write a program that accepts a hyphen '-' separated sequence of words
as input and print the words in a hyphen '-' separated sequence after
storing them alphabetically.

Source Code:

Output:
8: Write a python function that takes a number as a parameter and checks
whether a number is prime or not.

Source Code:

Output:
9: Write a program to remove all the lines that contain the character “b” in
a file and write it in to another text file.

Source Code:

Output:
10: Write a program to read a text file and display the number of vowels
/consonants /uppercase /lowercase characters in the file.

Source Code:

Output:
11: Write a program to create a binary file with name and roll no. Search
for a given roll number and display the name, if not found display
appropriate message.

Source Code:

Output:
12: Write a program to create a binary file to store Rollno, Name and
Marks and update marks of entered Rollno.

Source Code:

Output:
13: Write a program to implement a stack using a list data structure.

Source Code:

Output:
14: Write a program to read a text file line by line and display each word
separated by #.

Source Code:

Output:
15: Write a program to accept string/sentences from the user till the user
enters "END". Save the data in a text file and then display only those
sentences which begin with an uppercase alphabet.

Source Code:

Output:
16: Write a program to read a file 'Story.txt' and create another file, storing
an index of 'Story.txt', telling which line of the file each words appears in. If
word appears more than once, then index should show all the line
numbers containing the word.
Source Code:

Output:
17: Write a program to display the size of the file after removing EOL
characters, leading and trailing white spaces and blank lines.

Source Code:

Output:
18: Raj has been asked to display all the students who have secured less
than 40 for Remedial Classes. Write a user-defined function to display
those students who have secured less than 40 from the binary file
"Student.dat".

Source Code:

Output:
19: Write a program to create CSV file and store empno, name, salary and
search any empno and display name, salary and if not found appropriate
message.

Source Code:

Output:
20: Write a menu driven program to implement Stack in Python using List.

Source Code:

Output:
25: Create a student table and insert data. Implement the following SQL
commands on the student table:
(a) ALTER table to add new attributes / modify data type / drop attribute.

(b) UPDATE table to modify data.


(c) ORDER BY to display data in ascending/ descending order.

(d) DELETE to remove tuple(s) (e) GROUP BY and find the min, max, sum,
count and average.
26: Create a table STUDENT and write sql commands for (a) to (f):

(a)List the name of all students who have taken stream as COMPUTER.

(b) To count the number of female students.

(c)To display the number of students stream wise.


(d) To insert a new row in the student table:
9,"KARISHMA","ECONOMICS",300,18, "F".

(e) To display a report, listing NAME, STREAM, SEX and stipend where
stipend is 20% of the fees.

(f) To display all the records in stored order of name.


27: Consider the following table named "Softdrink". Write commands of
SQL for (i) to (iv).

(i)To display names and drink codes of those drinks that have more than
120 calories.

(ii)To display drink codes, names and calories of all drinks, in descending
order of calories.

(iii)To display names and price of drinks that have price in the range 12 to
18 (both 12 and 18 included).
(iv)Increase the price of all drinks in the given table by 10%.
28: Write a output for SQL queries (i) to (iii), which are based on the table:
student given below:

(i)Select count(*), city from student group by city having count()>1;

(ii)Select max(DOB), Min(DOB) from student;

(iii) Select Name, Gender from student where city="Delhi';


28:Write the SQL commands for the following table:
(i)To display the records from table student in alphabetical order as per
the name of the student.

(ii) To display Class, DOB and City whose marks is between 450 and 551.

(iii)To display Name, Class and total number of students who have secured
more than 450 marks, class wise.

(iv)To increase marks of all students by 20 whose class is 'XII'.


29: Consider the table CLUB given below.

i)SELECT COUNT (DISTINCT SPORTS) FROM CLUB;

ii) SELECT MIN(AGE) FROM CLUB WHERE SEX = 'F';

iii) SELECT AVG(PAY) FROM CLUB WHERE SPORTS= 'KARATE';

iv) SELECT SUM(PAY) FROM CLUB WHERE DATEOFAPP>'31/01/1998';


30: Write SQL commands for the following queries (i) to (iv) based on the
relations Product and Client given below:

i)Write SQL query to display ProductName and Price for all products whose
Price is in the range of 50 to 150.

ii) Write SQL query to display details of product whose manufacturer is XYZ
orAbc.
iii) Write SQL query to display ProductName, Manufacturer and Price for all
Products that are not giving any discount.

iv) Write SQL query to display ClientName, City, and P_ID for all clients
whose city is Delhi.

You might also like