Online Training
Vijayalakhmi Parthiban :9080221422
Nithya :9003196863/7092863796
Computer
Science- Python Questions For Chapter 1 and Chapter 2
Class:XII
Total Marks 20
1. write a program to find the factorial value using
function. 2
2. Write a program to find the no of vowels,lower
case letters,digits from one string
S1=”Hello
World contact 98458544” 3
3. Write a program to generate the prime no from 1 to
100 using function 3
4. Find and write the output of the following python
code: 2
def
fun(s):
k=len(s)
m=" "
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'bb'
print(m)
fun('school2@com')
5.
Find and write the output of the following python code: 2
def Change(P ,Q=30):
P=P+Q
Q=P-Q
print( P,"#",Q)
return (P)
R=150
S=100
R=Change(R,S)
print(R,"#",S)
S=Change(S)
6.
What possible outputs(s) are expected to be displayed on screen at the time of
execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables FROM and TO 2
import
random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for
K in range(FROM,TO+1):
print (AR[K],end="#")
7.
Which is the correct form of declaration of dictionary? 1
(i)
Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii)
Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]
8.
Identify the valid declaration of L: 1
L = [1, 23, ‘hi’, 6].
(i) list
(ii) dictionary (iii)
array (iv) tuple
9.
Find and write the output of the following python code: 2
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
10. Find and write the output of the
following python code 2
a=10
def call():
global a
a=15
b=20
print(a)
call()
Online Training
Contact Us
Vijayalakhmi Parthiban :9443344955
Nithya :9003196863
No comments:
Post a Comment