0% found this document useful (0 votes)
44 views3 pages

GGGGG

The document contains 15 multiple choice questions about Python programming. It tests concepts like operators, loops, strings, lists, tuples, dictionaries and more. The questions have answers like output values, True/False or variable contents after code execution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views3 pages

GGGGG

The document contains 15 multiple choice questions about Python programming. It tests concepts like operators, loops, strings, lists, tuples, dictionaries and more. The questions have answers like output values, True/False or variable contents after code execution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

GRADE:11 REVISION SUB:COMPUTER SCIENCE

1 What will be the output for the following Python statement ? print(20//3*2+(35//7.0))
Ans:17.0
2 What is printed by the following statements ?
ANIMAL={"dog":10,"tiger":5,"elephant":15,"Cow":3}
print("Tiger" not in ANIMAL)
Ans:True
3 EXAM="COMPUTER SCIENCE"
print(EXAM[:12:-2])
Ans: EN
4 What will be the output of the following code ?
Tuple1=(10,)
Tuple2=Tuple1*2
print(Tuple2)
Ans: (10,10)
5 What possible outcome will be produced when the following code is executed ?
a) APPLE##
import random b) APPLE#
value=random.randint(0,3) ORANGE##
fruit=["APPLE","ORANGE","MANGO","GRAPE"] c) APPLE##
for i in range(value): ORANGE##
print(fruit[i],end='##')
print() d) ORANGE##
MANGO##
APPLE##
6 State True or False “break keyword skips remaining part of an iteration in a loop and compiler goes to starting
of the loop and executes again”
Ans:False
7 True OR NOT False AND True
Ans:True
8 str="I will Succeed"
lis=str.split(" ")
print(lis[-1]) Ans:Succeed
9 dictcount={"age1":26,"age2":32,"age3":40}
sum=0
for key in dictcount:
sum=sum+dictcount[key]
print(sum)
Ans:98
10 tuple1 = (33, 24, 44, 42, 54 ,65)
lst=[2,4,6,8,10]
list1 =list(tuple1)
new_list = [] for i in range(1,5):
for i in list1:
lst[i-1]=lst[i]
if i>40:
new_list.append(i) for i in range(0,5):
new_tuple = tuple(new_list)
print(lst[i],end=' ')
print(new_tuple)

Ans: (44, 42, 54, 65) Ans:4 6 8 10 10


11 sub = "083 Comp. Sc. & 065 Info. Prac."
n = len(sub) lst = [1, 2, 9, 5, 12, 6, 7]
s=' ' for i in range(len(lst)):
for i in range(n): if lst[i]%2==0:
if sub[i].isupper(): lst[i]+=1
s = s + sub[i].lower() elif lst[i]%3==0:
elif sub[i].islower(): lst[i]+=2
s = s + sub[i] elif lst[i]%5==0:
elif sub[i].isdigit(): lst[i]+=4
s = s + '$' else:
elif sub[i].isspace(): lst[i]=0
pass print(lst)
else: Ans: [0, 3, 11, 9, 13, 7, 0]
s = s + '@'
print(s)

Ans: $$$comp@sc@@$$$info@prac@
12 tuple1=("Jayesh","Ramya","Taruna","Suraj")
list1=list(tuple1) TXT = ["20","50","30","40"]
for Name in list1: CNT = 3 47.0
if Name[0]=='T': TOTAL = 0
for C in [7,5,4,6]: 35.0
break
T = TXT[CNT]
else: TOTAL = float (T) + C 54.0
print("Finished") print (TOTAL)
print("Got it!") 26.0
CNT-=1

Ans: Finished
Finished
Got it!
13 myexam="@@Pre Board 2022@@"
print(myexam[15:11:-1])
Ans:2202
14 L=[1,2,3,4,5]
List=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
List.append(t)
print(List) Ans: [(2, 4), (4, 16)]
15
16 string="aabbcc" L=[]
count=0 L1=[]
while True: L2=[]
if string[0]=='a': for i in range(1,10): [1, 2, 3, 4, 5, 6, 7, 8, 9]
string=string[2:]
L.append(i)
elif string[-1]=='b': [10, 8, 6, 4, 2]
print(L)
string=string[:2]
for i in range(10,1,-2): [11, 4, 10, 4, 9, 4, 8, 4, 7, 4]
else:
count+=1 L1.append(i)
break print(L1)
print(string) for i in range(len(L1)):
print(count) L2.append(L1[i]+L[i])
Ans:bbcc L2.append(len(L)-len(L1))
1 print(L2)

T= 'green' # ---- Statement 1


(a) Statement 2 and 4
T[0]='G' #---- Statement 2 (b) Statement 2
T=[1 , 'B' ,14.5 ] #---- Statement 3 (c) Statement 3 and 4
T[3]=15 #---- Statement 4 (d) Statement 1 and 3

You might also like