Xii CS
Xii CS
SUB : C S
CLASS - XII
Q.1
1. Suppose a tuple T is declared as T = (10, 20, 30, 40)
what will be the output of print(T*2).
2. In key- value pair, each key is separated from its value by a………………………
3. Name the python Library modules which need to be imported to invoke the following
functions: (i) ceil() (ii) mean()
4. What will be output of following expression:
(5<10) AND (10<5) OR (3<18) AND NOT (8<18)
5. What is the output of following code :
names = ['Kirti', 'Srikhar', 'Yaksh', 'Prakhar']
print(names[-1][-1])
6. Identify the valid declaration of X :
X = [20, 20.19, ‘Dec_pre_board’, “KVS”]
(i) list (ii) dictionary (iii) invalid list (iv) tuple
7. What is the output of following code :
( i) >>> 2 < 3 (ii) >>> True+5
8. Declare a dictionary as x and display only all values.
Q.2
1. What is output from the following code:
(i) range(6) (iii) range (5,20,4)
(ii) range (7,10) (iv) range (12, 1, -2)
2. Declare a dictionary as d, then display it and update any one value again display it.
3. Write a program to count total number of words present in an string.
4. What will be output of following:
word=’AMAZING’
print(word[0:3])
print(word[-5:-1])
print(word[ : :-2])
print(word[1: 10: 2])
5. Rewrite the following code in python after removing all errors. Underline each
correction done in the code.
M =int(“enter number”)
for in loop(0,11):
if M = = K :
print(M+K)
Else :
Print(M-k)
6. Different between append() and extend() with example.
7. Find and write the output of the following Python code:
Def output( ):
str='Fun@Python3.0'
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
print(“bye bye”)
outout()
print(“welcome”)