0% found this document useful (0 votes)
11 views

CS_Practical_file_XII

Uploaded by

itsrayhan.m
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CS_Practical_file_XII

Uploaded by

itsrayhan.m
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

COMPUTER

SCIENCE
PRACTICAL

By : Revanth Krishna Sai Padamata


XIIB5, Rn.7
2024-2025
1. Write a program using user defined function to find factorial of a number.

2. Write a program using user defined function to accept two numbers as


parameters, if num1 is less than num2 swap them and return the values
otherwise return the numbers as is.

3. Write a program to generate a random number between 1 and 6


(simulates a dice).
4. Write a user defined function EvenSum(numbers) to add those values
from the list of NUMBERS which are at even positions.

5. Write a program to read a text file line by line and display each word
separated by '#'

6. Write a program to read a text file and display the number of vowels,
consonants, uppercase and lowercase in the file.
7. Write a program to remove all the lines that contains the character 'a' in
a file and write it to another textfile ‘OTHER.TXT’
8. Write a method in python to read data from a text file INDIA.TXT, to
count and display the occurrence of word ‘INDIA’

9. Write a program to input roll_no, name, marks & grade from the user
and write it to a binary file Student.dat. The program must display the
names of all the students who receive grade ‘A’.
10. Write a menu driven program to read employee data
(EmpId,EmpName,EmpSal) and write it into a binary file emp.dat. Based
on the user’s choice the program must search (), update (), delete () or
read () more data into the file.
11. Write a program to search and display all those records of the
students whose marks are 50 and above in a binary file Student.dat.
12. Write a program to generate a csv file by reading rollno, name and
marks from user. The program must display the name when rollno is
entered. If not found, displays appropriate message.
13. Create a CSV file by entering user-id and password, read and search
the password for given userid.
14. Write a program to read the dictionary dict1= {“Dev”:45,” Ravi”:56,”
tej”:78} Consisting of name and marks of students. Include a function to
push name of those students into the stack where marks are greater than
75. Display the contents of the stack.

15. Sami has a list L1 containing 10 integers you need to help him create a
program with separate functions to push () those elements from list L1
which are at even positions and pop() to empty the stack and print the
contents.
Database management MySQL commands:
1. Write queries for the following questions for the given table.

a. To create a new database: ‘Students’.


b. To open the database ‘Students’.

c. To create the above table: Info


d. To insert all the rows of the above table.

e. To display names of those male students whose data of admission is


after 1996 April.

f. To list all departments from Info table.


g. To display the names of the students whose name starts with ‘A’ and
has 5 letters.

h. To display the details of those students whose names have second


alphabet as ‘n’.

i. To delete the details where roll no is 8.

j. To change the fees of the student to 170 where roll number is 1, if the
existing fees is less than 130.
k. To add a new column ‘Area’ of type varchar in table Info.
l. To delete ‘Area’ column from Info table.

m. To delete the above table from the database.


2. Write queries for the following questions for the given table.

a. To create the above two tables.


b. To display the unit price of all the products whose DCODE is 102.

c. To display details of all the products in the stock table in descending


order of stock date.

d. To display maximum unit price of products for each dealer individually


as per DCODE from the stock table.

e. To display Pname and Dname from the tables stock and dealers.

You might also like