Computer Science File Kavya
Computer Science File Kavya
Submitted by:
Kshitij Mishra
XII C
32
Q1) Input a string and determine whether it is a palindrome or not; convert
the case of characters in a string.
INPUT
OUTPUT
1
Q2) Write a Python program to pass a string to a function
and count how many vowels and consonants are present in
the string.
INPUT
OUTPUT
2
Q3) Write a Python program to remove all duplicate numbers
from the given list of numbers
INPUT
OUTPUT
3
Q4) Write a python program to pass a list to a function and
double the odd values and half the even values of a list and
display list elements after changing.
INPUT
OUTPUT
4
Q5) Write a program to print the largest and the second
largest element from a list of numbers.
INPUT
OUTPUT
5
Q6) Write a Python program input n numbers in tuple and pass
it to function to count how many even and odd numbers are
entered.
INPUT
OUTPUT
6
Q7) Write a menu driven program to accept name and mobile
number of five of your friends and store them in the
dictionary, as name s as the key and mobile numbers as
value. And do the following operations on the dictionary:
a) Display all name and phone numbers
b) Add a new key-value pair in this dictionary
c)Delete one pair from the dictionary
d) Update the phone number of a friend
e) Search for a friend whether he/she is present
in the dictionary or not
f)Display the dictionary in ascending order of names
7
INPUT
8
OUTPUT
9
Q9) Write a program count the number of alphabets,
uppercase alphabets, lowercase alphabets, digits, spaces and
other special characters in a text file “book.txt”.
INPUT
10
OUTPUT
Q10) Read a text file line by line and display each word
separated by #
INPUT
11
OUTPUT
Q11) Write a Python program to remove all the lines that contain the
character ‘a’ in a text file and write it to another file
INPUT
12
OUTPUT
13
Q12) Write a Python program to create a binary file with
name and roll number. Search for a given roll number and
display the name, if not found display appropriate message.
INPUT
14
OUTPUT
15
Q13) Create a CSV file by entering user-id and password, read
and search the password for given user id.
INPUT
OUTPUT
16
16. Write a menu based program to perform the operation on
stack in python.
INPUT
17
OUTPUT
18
INPUT
OUTPUT
19
18. Alam has a list containing 10 integers. You need to help him
create a program with separate user defined functions to
perform the following operations based on this list.
Traverse the content of the list and push the even
INPUT
20
OUTPUT
21
b)Display the type of movies.
2
e)Display the movie of type action and romance.
f) Display the list of movies which are going to release in February, 2022.
23
24
(i) To display the details of all EMPLOYEEs in descending order of DOJ.
25
(iii) To display the content of the entire EMPLOYEEs table, whose DOJ is
in between ’09-Feb-2006’ and ’ 08-Aug-2009’.
26
27
28
29
24. Write a MySQL connectivity program in Python to
• Create a database school
• Create a table students with the specifications -
ROLLNO integer, STNAME character(10) in MySQL and
perform the following operations:
Insert two records in it
30
Display the contents of the table.
INPUT
OUTPUT
In Python
In MySQL
31
26. Program to update the records of employees by increasing
salary by 10000 of all those employees who are getting less
than 100000.
INPUT
OUTPUT
32
33