Practical
Practical
Kendriya
Vidyalaya
SESSION: 2023-24
NAME: JIYA. S
CLASS: XII
SECTION: ‘B’
ROLL NO.: 12206
SUBJECT: COMPUTER SCIENCE
OUTPUT:
OUTPUT:
Page 2 of 25
3. Write a menu driven program to perform following in
dictionary (roll no, name) add, update, display, display
all.
OUTPUT:
Page 3 of 25
USER DEFINED FUNCTIONS
4. Write a program to calculate the factorial of an integer
using function.
OUTPUT:
OUTPUT:
Page 4 of 25
6. Write a program to print Fibonacci series using
function.
OUTPUT:
OUTPUT:
Page 5 of 25
8. Write a function to test if a string passed is a
palindrome or not.
OUTPUT:
OUTPUT:
Page 6 of 25
10. Write a menu driven program using functions that takes
a tuple as a parameter and return maximum, minimum and
sum of the elements.
OUTPUT:
Page 7 of 25
TEXT FILE
11. Write a program to read a text file and display its
contents.
OUTPUT:
Page 8 of 25
OUTPUT:
OUTPUT:
OUTPUT:
Page 9 of 25
15. Write a program to read a text file line by line and
display each word separated by “#”.
OUTPUT:
OUTPUT:
Page 10 of 25
BINARY FILE
17. Write a program to create a binary file
Student.dat [Roll no, Name, Marks] and write a menu
driven program to do the following:
• Insert record
• Search record (get roll no)
• Update record
• Display all
• Exit
Page 11 of 25
OUTPUT:
OUTPUT:
Page 12 of 25
19. Create a CSV file(Emp.csv, empno, ename,
salary)and write a menu driven Program to do the
following:
• Add a record
• Search record(get empno)
• Display all
• Exit
Page 13 of 25
OUTPUT:
Page 14 of 25
20. Write a program to show the detail of the student who
scored the highest marks. Data stored in “Data.csv” is given
below:
Roll no, Name, Marks.
1, Aman, 35 2, Kanak, 1 3, Anuj, 33 4, suman, 25
OUTPUT:
CONNECTIVITY PYTHON
Page 15 of 25
Practical 1
Aim to connect to MySQL server
To create a database Student
To create a table Student
To add 6 rows
To fetch and display the records
OUTPUT:
Practical 2
Page 16 of 25
Aim
To Connect to database student
To create a table result
To add six rows
To increase marks in Math by 5 for Sudha
To fetch and display the records
OUTPUT:
Practical 3
Page 17 of 25
Aim
To Connect to database student
To create a table result
To add six rows
To delete the rows with math mark greater or
equal to 90
To fetch and display the records
OUTPUT:
Practical 4
Page 18 of 25
Aim
To connect to database student
To create a Table staff
To add 6 rows
To fetch and display the records of all
OUTPUT:
MYSQL
Page 19 of 25
1. Create database name ‘kv2’.
Page 21 of 25
11. Display the name of those students whose city is not
found.
Page 22 of 25
16. Display the name of those students who belongs to
Delhi, Chennai or Kolkata.
Page 23 of 25
20. Display the names of different cities.
Page 24 of 25
27. Remove the column email id.
Page 25 of 25