CS - XI PRACTICAL FILE QUESTIONS - Term 2
CS - XI PRACTICAL FILE QUESTIONS - Term 2
CS - XI PRACTICAL FILE QUESTIONS - Term 2
PRASHANT VIHAR, OUTER RING ROAD, ROHINI, DELHI – 110085 COMPUTER SCIENCE
PRACTICAL LIST CLASS XI – TERM 2
LIST
1. Input a list of elements, search for a given element in the list.
2. Input a list of numbers and find the smallest and largest number from the list.
3. Write a program to find the number of times an element occurs in a list.
4. Write a program to read a list of N integers (positive as well as negative). Create two new lists, one
having all positive numbers and one having all negative numbers from the given list. Print all three
lists.
5. Write a program to find the largest and the second largest elements in a given list of elements.
6. Write a program to read a list of N integers and find their median.
NOTE: The median values of a list is the middle one when they are arranged in an order. If there are
two middle values, take their average. Hint: Use inbuilt function to sort the list.
7. Write a program to read a list of elements. Modify the list so that it does not contain any duplicate
elements i.e. all elements occurring multiple times in the list should appear only once.
8. Write a program to create a list of elements. Input an element from the user that has to be inserted
in the list. Also input the position at which it is to be inserted.
9. Write a program to perform linear search on a given list.
10. Write a program to input name and marks of 5 students. Print the name and marks of the student
with the highest and the lowest marks.
TUPLES
11. Write a program to perform the following using tuples:
a. Input a tuple of elements, search for a given element in the tuple.
b. Find the largest/smallest number in a tuple.
c. Add an element to a tuple.
12. Write a program to find the frequency of occurrences of maximum and minimum elements in a
tuple.
13. Write a program to input user ID’s of any 5 users in a tuple T1, and passwords of 5 users in a tuple
T2. Now create a tuple T3, where every element contains user ID and password in a concatenated
manner as follows-: userid@password. (Hint: concatenation of tuples).
14. Write a program to input two tuples tup1 and tup2, and print True if every element in T1 is also an
element in T2, else print false.
15. Given a tuple pair = ((2,15), (14,2), (9,80), (12,10)). Count the number of pairs (a,b) such that both a
and b are even. (Hint: concept of nested tuples)
16. Write a program to input a tuple, print it and check whether the sum of first half of elements of a
tuple is equal to the sum of the second half of the elements of the tuple. If sum is same, print
“Balanced”, else print “Unbalanced”.
DICTIONARY
17. Create a dictionary with roll number, name and marks of N students in a class and display the
names of students who have scored marks above 75.
18. Write a Python program to create a dictionary from a string accepted from the user, such that each
individual character makes a key, and its index value(of the string) for first occurrence makes the
corresponding value in dictionary. Example if string is ‘w3resource’
Expected output: {‘3’:1, ‘s’: 4, ‘r’: 2, ‘u’:6, ‘w’:0, ‘c’:8, ‘e’:3, ‘o’:5}
19. Write a program to input your friend's names and their phone numbers and store them in the
dictionary as the key value pair. Perform the following operations on the dictionary:
a. Display the Name and Phone number for all your friends
b. Add a new key-value pair in this dictionary and display the modified dictionary.
c. Delete a particular friend from the dictionary.
d. Modify the phone number of an existing friend.
e. Check if a friend is present in the dictionary or not and display the result.
f. Display the dictionary in sorted order of names
20. Create a dictionary for month and number of days for a year and perform the following operations:
a. User will enter the month name and system will display the number of days in that month.
b. Display month names having 30 days.
c. Display month names having 31 days.
21. Write a program to input the roll number, name and percentage of marks for N students of class XI
and perform the following operation:
a. Accept details of N students (N means number of students)
b. Search the details of a student based on their roll number and display the name and
percentage.
c. Display the result of all the students. (Hint: traversing dictionaries).
d. Find the topper amongst all students.
Hint: key is the roll number, name and percentage are stored as any mutable datatype.
MODULES
22. Write a program for generating random numbers to imitate a dice.
23. Write a program to find the mean, median and mode from the sequence [3,4,2,3,5,1,1,35,6,84,90].
24. Write a program to illustrate the use of ceil() and floor().