0% found this document useful (0 votes)
16 views

ClassTest 3

The document contains 12 computational questions related to Python programming. It tests concepts like lists, tuples, strings, loops, conditional statements, dictionaries etc. Detailed code snippets and their expected outputs are provided for each question.

Uploaded by

seemabhatia392
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

ClassTest 3

The document contains 12 computational questions related to Python programming. It tests concepts like lists, tuples, strings, loops, conditional statements, dictionaries etc. Detailed code snippets and their expected outputs are provided for each question.

Uploaded by

seemabhatia392
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

COMPUTER SCIENCE- XII CLASS TEST-3

[1] Find the output for the following:


list = [6 , 3 , 8 , 10 , 4 , 6 , 7]
print( '@', list[3] - list[2])
for i in range (len(list)-1,-1,-2) :
print( '@',list[i],end='' )
[2] Evaluate the following expressions:
a) 6 * 3 + 4**2 // 5 – 8
b) 10 > 5 and 7 > 12 or not 18 > 3
[3] Rewrite the following code in Python after removing all syntax error(s).
Underline each correction done in the code.
Value=30
for VAL in range(0,Value)
If val%4==0:
print (VAL*4)
Elseif val%5==0:
print (VAL+3)
else
print(VAL+10)
[4] Predict the output of the Python code given below:
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
[5] Predict the output of the code given below:
s="welcome2cs"
n = len(s)
m=""
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'&'
print(m)
[6] Find and write the output of the following python code :
for Name in ['John', 'Garima','Seema','Karan']:
print(Name)
if Name[0]=='S':
break
else:
print('Completed!')
print('Weldone!')
[7] Find the output of the following:
values = [10,20,30,40]
for v in values:
for i in range(1, v%9):
print(i,’*’,end=’’)
print()
[8] Find and write the output of the following Python code :
Data = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add = 0
for C in range(1,6,2):
Times = Times + C
Alpha = Alpha + Data[C-1]+"$"
Add = Add + Data[C]
print (Times,Add,Alpha)
[9] Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
25=Val
for I in the range(0,Val)
if I%2==0:
print I+1
Else:
print I–1
[10] Find and write the output of the following python code :
Text1="CBSE 2023"
Text2=" "
I=0
while I<len(Text1):
if Textl[I]>="0" and Textl[I]<="9":
Val = int(Textl[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Textl[I]>="A" and Textl[I] <="Z":
Text2=Text2 + (Text1[I+1])
else :
Text2=Text2 + "*"
I=I+1
print(Text2)
[11] Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
250 = Number
WHILE Number<=1000:
if Number=>750:
print Number
Number=Number+100
else
print Number*2
Number=Number+50
[12] What will be the output of the following Python code?
S="UVW" ;L=[10,20,301]
D={}
N=len (S)
for I in range (N):
D[I] = S[I]
for K,V in D.items ():
print (K,V, sep="*" ,end="")
a) U*10,V*20,W*30,
b) 10*U, 20*v, 30*W,
c) 10,20,30,u*v*w*
d) Error

You might also like