CS Ann Sample Paper
CS Ann Sample Paper
NAVI MUMBAI
ANNUAL EXAMINATION SAMPLE PAPER 2024-2025
Page 1 of 7
(a) List (b) Tuple (c) Dictionary (d) String
9. Lalit is a game programmer and he is designing a game where he has to use different
python functions as much as possible. Apart from other things, following functionality is to
be implemented in the game.
The players have to input their names and Lalit has to remove the unnecessary blank
spaces from the name
Which python module and function should be used for the same:
print(s.count('e',20))
(a) [10, 20, 30, 40, 50, 5] (b) [15, 25, 35, 45, 55]
(c) Error (d) [5, 10, 20, 30, 40, 50]
14. Identify the output of the following Python statements
S = "GOOD MORNING"
print(S.capitalize(),S.title(),end="!")
Page 2 of 7
a) 0 b) 1 c) 4 d) 2
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
17.
18. Assertion(A): Assigning a list name to a new name does not create a true copy of a list
rather it just creates an alias.
Reasoning(R): An alias simple refers to the old list with a new name, while a true copy
creates a new list with a different memory location.
SECTION B
19. Rao has written a code to generate Fibonacci series in a tuple. His code is having some
errors. Correct the syntax and logical errors and rewrite the corrected code.
p1=0, p2=1
fib=(p1,p2)
for i in range(3,10):
n=p1+p2,
fib+=n
p1= =p2
p2=n
print(fib)
b. p=10
q=20
p*=q//3
p=q**2
q+=p
print(p,q)
Page 3 of 7
21. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To delete the first occurrence of the value 450 from a list L1.
(ii) To convert all the values in a dictionary D to a list.
22. Write a python program to accept a dictionary . Count the number of values in the
dictionary which is a list.
Ex : d= { 1:[25,78], 2:’amit’ , 3:67, 4:[67,89,90] } then the output should be
Number of lists in the dictionary is 2
25. a. What will be the output for the following Python statements ?
T =(10,20,[30,40,50],60,70)
T[2][1]= 100
print(T)
SECTION C
Page 4 of 7
Options :
(I) Pencil:Book
(II) Pencil:Book
Eraser:Bag
(III) Pen:Book
Bag:Book
(IV) Bag:Eraser
27. Write a program in python to accept a multiline string S. It has to display the lines having
the word India in it. It also has to display the total count of the lines having India in it.
For example:
If the string S is
__________________________________________________________________
INDIA is a famous country all over the world.
Geographically, India is located to the
south of Asia continent. India is a high
population country and well protected
from all directions naturally.
India is a famous country for
its great cultural and traditional
values all across the world.
Output :
INDIA is a famous country all over the world.
Geographically, India is located to the
south of Asia continent. India is a high
India is a famous country for
Total count : 4
OR
Write a program that accepts a string S from the user and counts the number of words in the
string S which are less than 4 characters. The words and the total count has to be displayed.
Ex : S= “An apple a day”
Output:
An
a
day
Total count : 3
Page 5 of 7
29. Write the output of the code given below
s="Abc2@xYz"
m=""
for i in range(len(s)):
if s[i].isupper():
m+=s[i].lower()
if s[i].islower():
m+=s[i].upper()
if s[i].isdigit():
m+=s[i-1]
else:
m = m +'#'
print(m)
SECTION-D
33. (i) Accept a dictionary from the user. Count the number of keys that are tuples. Display
the count. [2+3]
Ex : d={(1,5,6):'ram',2:'sam',(3,4):'ram',4:'pam',5:'sam'}
Output : 2
(ii) Write a program which accepts a string . Make a new string by replacing all vowels in
the string with ‘*’ and print the new string.
Ex : S= “An apple”
Newstring = “*n *ppl*”
Page 6 of 7
SECTION E
34. a. Write the output of the following :
my_lst=['P','R','O','B','L','E','M']
my_lst[2:4]=[]
print(my_lst)
my_lst[2:5]=[3,'RAM']
print(my_lst)
35. a. Explain the difference between pop and popitem methods in dictionaries. Explain with
examples.
b. Explain the find method in a string with examples.
Page 7 of 7