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

Computer Science File Kavya

The document contains 13 questions related to Python programming tasks. The questions cover topics like string manipulation, list operations, dictionary usage, file handling, and SQL queries. The questions provide space for input and output to be filled for each programming task.

Uploaded by

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

Computer Science File Kavya

The document contains 13 questions related to Python programming tasks. The questions cover topics like string manipulation, list operations, dictionary usage, file handling, and SQL queries. The questions provide space for input and output to be filled for each programming task.

Uploaded by

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

FR.

AGNEL SCHOOL, NEW DELHI


Session
2023-24

Computer Science Practical File

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

17. Julie has created a dictionary containing names


and marks as key value pairs of 6 students. Write a
program, with separate user defined functions to perform
the following operations:
 Push the keys (name of the student) of the dictionary

into a stack, where the corresponding value (marks) is


greater than 75.
 Pop and display the content of the stack.

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

numbers into a stack.


 Pop and display the content of the stack.

INPUT

20
OUTPUT

a)Display all information from movie.

21
b)Display the type of movies.

c) Display move id , movie name, total earning by


showing the business done by the
movies. Calculate the business done by movie using
the sum of production cost and business cost.

d) Display movieid, moviename and productioncost


for all movies with productioncost
greater thatn 150000 and less than 1000000.

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.

(ii) To display NAME and DESIG of those EMPLOYEEs whose SALGRADE is


either S02 or S03.

25
(iii) To display the content of the entire EMPLOYEEs table, whose DOJ is
in between ’09-Feb-2006’ and ’ 08-Aug-2009’.

(iv) To add a new row with the following content: 109,’Harish


Roy’,’HEAD- IT’,’S02’,’9-Sep-2007’,’21-Apr-1983’

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

You might also like