Avi Arora Computer Science Practical File
Avi Arora Computer Science Practical File
Guided by:
Ms. Neha Adlakha
Submitted by:
Name : Avi Arora
Class: XII – A
Board Roll no.:
1|Page
INDEX
S.NO. TOPIC DATE PAGE NO. TEACHER
SIGN.
1 WAP to input two integers and find their LCM.
2|Page
PRACTICAL 1 :
CODING:
OUTPUT:
3|Page
PRACTICAL 2:
CODING:
OUTPUT:
4|Page
PRACTICAL 3:
Q3.WAP that accepts a string and calculates the number of uppercase letters and lowercase letters
using functions.
CODING:
OUTPUT:
5|Page
PRACTICAL 4:
CODING:
OUTPUT:
6|Page
PRACTICAL 5:
Q5.WAP using user-defined function to calculate and display average of all the elements in a user-
defined tuple containing numbers.
CODING:
OUTPUT:
7|Page
PRACTICAL 6:
CODING:
O
UTPUT:
8|Page
PRACTICAL 7:
Q7.Read a text file and display the number of vowels/ consonants/ uppercase/lowercase characters
in a file
CODING:
OUTPUT:
9|Page
PRACTICAL 8:
Q8.Remove all the lines that contain the character ‘a’ in a file and write it to another file.
CODING:
10 | P a g e
OUTPUT:
11 | P a g e
Q9.Create a binary file with name and roll no. search for a given roll no and display the name, if not
found display appropriate message
CODING:
OUTPUT:
12 | P a g e
Q10.Create a binary file with roll no, name and marks. Input a roll no and update the marks
CODING:
13 | P a g e
OUTPUT:
14 | P a g e
Q11.Write a random number generator that generates random numbers between 1 and 6(simulates
a dice).
CODING:
OUTPUT:
15 | P a g e
Q12.. Create a CSV file by entering user-id and password, read and search the password for given
user-id
CODING:
OUTPUT:
16 | P a g e
Q13. WAP to store multiple integers in and from a binary file.
CODING:
OUTPUT:
17 | P a g e
Q14..WAP to count the number of records present in “student.csv” file
CODING:
OUTPUT:
18 | P a g e
Q15.Write a menu driven program to perform read and write operations using a text file called
“student.txt” containing student roll_no, name and address using two separate functions:
CODING:
19 | P a g e
OUTPUT:
20 | P a g e
Q16. Write a Python program to implement all basic operations of a Stack, such as adding element,
removing element and displaying the Stack elements using lists.
CODING:
OUTPUT:
21 | P a g e
Q17. WAP to display unique vowels in the given word using Stack.
22 | P a g e
Q18.Write a program to create a Stack called Employee, to perform the basic operations on Stack
using list. The list contains the two values-employee number and employee name. The program
should include the options for addition, deletion and display of employee details.
CODING:
23 | P a g e
OUTPUT:
24 | P a g e
Q19.Consider a database LOANS with the following table:
TABLE: LOANS
(i)Display the sum of all Loan Amounts whose Interest rate is greater than 10.
(iii) Display the count of all loan holders whose name ends with 'Sharma'.
(iv) Display the count of all loan holders whose Interest rate is Null.
(vi) Display the Interest-wise details of Loan Account Holders with at least 10 instalments remaining.
ANSWERS:
(i)
(ii)
(iii)
25 | P a g e
(iv)
(v)
(vi)
26 | P a g e
TABLE: STATIONERY
Table: Consumer
Write SQL statements for the queries (i) to (iv) and output for (v) and (vi):
(i) To display details of all the Stationery Items in the Stationery table in descending order
ofStockDate.
(ii) To display details of that Stationery item whose Company is XYZ and price is below 10.
(iii) To display ConsumerName, Address from the table Consumer and Company and Price from
(iv) To increase the price of all the stationery items in Stationery table by * 2.
Answers:
27 | P a g e
(i)
(ii)
(iii)
(iv)
(v)
28 | P a g e
(vi)
29 | P a g e
TABLE: SCHOOL
TABLE: ADMIN
1. Select Designation, Count (*) From Admin Group By Designation Having Count (*) <2;
ANSWERS:
30 | P a g e
(1)
(2)
(3)
(4)
31 | P a g e
Q22.Write SQL commands for (1) to (4) and output (5) to (8) based on the
following table COMPANY and CUSTOMER.
TABLE: COMPANY
TABLE: CUSTOMER
1. To display those company name which are having prize less than 30000.
2. To display the name of the companies in reverse alphabetical order.
3. To increase the prize by 1000 for those customers whose name starts
with S?
4. To add one more column totalprice with decimal (10,2) to the table
customer.
32 | P a g e
Answers:
(i)
(ii)
(iii)
(iv)
33 | P a g e
Q23.Consider the tables and write queries for the following:
TABLE: ITEM
TABLE: BRAND
34 | P a g e
Answers:
(i)
(ii)
(iii)
35 | P a g e
Q24.WAP to show MySQL connectivity with Python.
CODING:
OUTPUT:
36 | P a g e
Q25.Perform all operations with reference to table “LOANS” through MySQL-Python connectivity.
CODING:
37 | P a g e
38 | P a g e
OUTPUT:
39 | P a g e
40 | P a g e