Computer Science File
Computer Science File
SESSION-2023-24
COMPUTER SCIENCE
PRACTICAL FILE
CLASS- XII-A
ROLL NO.- 34
Q.1 WAP to compute xn of given two integers x and n.
Ans- Input
Output
Q.2 WAP to print Fibonacci series up to a certain limit
using a user-defined module.
Ans- Input-
Output-
Q,3 Write a Program to find factorial of entered
number using user-defined module fact().
Ans- Input
Output
Q.4 WAP to accept a number, find and display whether
it’s an Armstrong number or not.
Ans- Input
Output
Q.5 WAP to accept a number and find out whether it is
a perfect number or not.
Ans- Input-
Output-
Q.6 WAP to print the following pattern:
1
12
123
1234
1 2 3 4 5.
Ans- Input-
Output-
Q.7 WAP that counts the number of alphabets and
digits, uppercase letters, lowercase letters, spaces and
other characters in the string entered.
Ans- Input-
Output-
Q.8 WAP to accept a string ( a sentence) and returns a
string having the first letter of each word in capital
letter.
Ans- Input-
Output-
Q.9 WAP to remove all odd numbers from the given
Index list.
Ans- Input-
Output-
Q.10 WAP to display cumulative elements of a given
list.
Ans- Input-
Output-
Q.11 WAP to display frequencies of all the elements of
a list.
Ans- Input-
Output-
Q.12 WAP to create a CSV file to store student
data(Rollno, Name, Marks). Obtain data from the user
and write 5 records into file.
Ans- Input-
Output-
Q.13 Write a function in Python to count the number of
lines in a text file “STORY.TXT” which is starting with
an alphabet ‘A’.
Ans- Input-
Output-
Q.14 Write a function that reads a text file and prints
only the numbers or digits from the file.
Ans- Input-
Output-
Q.15 Write a function that copies a text file source.txt
onto target.txt barring the lines starting with ‘a’.
Ans- Input-
Output-
Q.16 A binary file “Book.dat” has structure
[bookno.,Book_name, Author, Price].
Write a menu driven program.
a. To write a function CreateFile() to input data and
add in Book.dat.
b. To write a function CountRec(Author) in python
which accepts the Author name as parameter and
counts and returns the number of books by the given
Author are stored in the binary file.
c. To write a function to update the price of a book
having bookno. passed as parameter Update(bookno.).
Ans- Input-
Output-
Q.17 A csv file teacher.csv contains details (Teacherid,
Teachername, subjects taught and salary) and write a
menu driven python program a. To take input from the
user and add records in the csv file. b. To update the
salary of a teacher.
Ans- Input-
Output-
Q.18 Write a menu based program to Maintaining
Book details like bcode, btitle and price using stacks in
python. Write functions to perform push, pop and
display methods.
Ans- Input-
Output-
Q.19 Write a menu based program to add, delete and
display the record of a hostel using a list as stack data
structure in python. Record of the hostel contains the
fields :Hostel number, Total Students and Total Rooms.
Ans- Input-
Output-
Q.20 Create the following tables.
D. To display the quarter and the sum of quantities sold from the
Sale table.
FROM Trainer
FROM Trainer
FROM COURSE
FROM COURSE
GROUP BY TID
FROM Trainer
GROUP BY City;
23. Create the following tables and find the output of
the following commands:-
(iv) To increase the fees of all courses by 500 for the "System
Design" course:
UPDATE Courses
SET Fees = Fees + 500
WHERE Course_Name = 'System Design';
(v)
To find the minimum fee from the Courses table:
SELECT MIN(Fees) AS Min_Fee
FROM Courses;
26. Create the following tables. Write the command
and find the output of the following commands:-
4. Write a function to input data from the user and insert records
in the table.
5. Write a function to display all the records from table empl.
6. Write a function to update the employee record of entered
empno.
7. Write a function to search employee number in table
employee and display record, if empno not found display
appropriate message.
8. Write a function to delete the employee record of entered
empno.
Ans-