VELAMMAL VIDHYASHRAM
BHAGAT SINGH WING
GRADE 12 – OUTPUT BASED QUESTIONS
CODE – 083 – COMPUTER SCIENCE
1. Find the output of the following code.
s=”Be Good”
s=[Link](“g”)
print(“*”.join(s))
2. What will be the output for the following Python statements?
T = (10,20, [30,40,50],60,70)
T [2][1] = 100
print (T)
3. What will be the output for the following Python statements?
L= [10,20,30,40,50]
L=L+5
print(L)
4. What will be the output for the following Python statements?
D= {“AMIT”:90, “RESHMA”:96, “SUKHBIR”:92, “JOHN”:95}
print (“JOHN” in D, 90 in D, sep =”#”)
5. Find the output of the following code.
Suppose the content of a text file [Link] is:
“The way to get started is to quit talking and begin doing”
What will be output of the following Python code?
F=open (“[Link]”)
[Link](29)
S=[Link]()
print (S)
6. Identity the output of the following Python statements
S=” GOOD MORNING”
print([Link](), [Link](), end=”!”)
7. Identify the output of the following Python statements.
L= [ ]
for i in range (4):
[Link](2*i+1)
print (L[: : -1])
8. Identify the output of the following Python statements:
D={ }
T=(“ZEESHAN”, “NISHANT”,”GURMEET”,”LISA”)
for i in range(1,5):
D[i] = T[i-1]
print(D)
9. Identify the output of the following Python statements.
L1, L2 = [10,15,20,25], [ ]
for i in range (len(L1)):
[Link](i,[Link]())
print (L1, L2, sep=”&”)
10. What will be the output of the following Python code?
S=”WELCOME”
def Change(T):
T=” HELLO”
print(T, end=’@’)
Change(S)
print(S)
11. Identify the correct possible output for the following Python code:
import random
for N in range(2,5,2):
print([Link](1,N), end=”#”)
12. What will be the output of the following Python code?
def FunStr(S):
T=” “
For I in S:
If [Link]() :
T=T+i
Return T
X=”PYTHON 3.9”
Y=FunStr(X)
print(X, Y, sep=”*”)
13. What will be the output of the following Python code?
V=50
def Change(N):
global V
V, N = N, V
print(V, N, sep=”#”, end=”@”)
Change(20)
print(V)
14. Which of the following option can be the output for the following Python code?
L1 = [10,20,30,40,50]
L2= [ ]
for i in L1:
if i not in L2:
[Link](i)
print (L1, L2, sep=”&”)
15. What is the output of the following Python code?
def ListChange() :
for I in range (len(L)):
if L[i]%2 ==0:
L[i] = L[i]*2
If L[i]%3 ==0:
L[i]=L[i]*3
Else:
L[i]=L[i]*5
L= [2,6,9,10]
ListChange()
for i in L:
print(i,end=”#”)
16. Suppose the content of a text file “[Link]” is as follows:
Jack & Jill
went up the hill
What will be the output of the following Python code?
F=open(“[Link]”)
L=E=[Link]()
for i in L:
S=[Link]()
print(len(S), end=”#”)
17. What possible output(s) will be obtained when the following code is executed? Also write
the minimum and maximum values of Low and High.
Import random as ran
Low=2+[Link](1,3)
High=5+[Link](0,3)
C=”ABCDEFGHIJ”
for I in range(Low,High):
print(C[I],end=” “)
18. What will be the output of the following code?
def alter(num):
num+=a
print(a,end=” “)
a=5
num = 10
num=alter(a)
print(num,a)
19. Find the output of the following code
L=[1,2,3,4,5,6]
L[2:4]=”CBSE”
print(L)
print(L[:-1:2])
20. Write the output of the following code
def outer_fun(a,b):
def inner_fun(c,d):
return c+d
return inner_fun(a,b)
return a
result = outer_fun(15,10)
print(result)
21. Suppose the content of “[Link]” is
Good Morning Madam
What will be the output of the following Python code?
F=open(“[Link]”)
L=[Link](). Split()
For W in L:
If [Link]() == W[: : -1].lower():
print(W)
22. Suppose the content of “[Link]” is
Hickory Dickory Dock
The mouse went up the clock
What will be the output of the following Python code?
F=open(“[Link]”)
L=[Link]()
X=[“the,”ock”]
for i in L:
for W in [Link]():
If W in X:
print(W, end=”*”)
23. What will be the output of the following Python code?
S=”UVW” ; L=[10,20,30] ;D={ }
N=len(S)
for I in range(N):
D[L[I] = S[I]
for K,V in [Link]():
print (K,V, sep =”*”, end=” “)
24. What will be the output of the following Python code?
L=[10,20]
L1=[30,40]
L2=[50,60]
[Link](L1)
[Link](L2)
print(L)
25. What possible output(s) will be obtained when the following code is executed?
Import random
myNumber = [Link](0,3)
COLOR=[“YELLOW”,”WHITE”,”BLACK”,”RED”]
for I in COLOR:
for j in range (1,mynumber):
print(I, end = “ “)
print ()
26. Write the output as well as the number of times the loop runs?
s="cbse"
a=0
for x in s[3:8]:
print(x)
a+=1
print(a)
27. Predict the output of the following code:
def Changer(P,Q=10):
P=P/Q
Q=P%Q
return P
A=200
B=20
A=Changer(A,B)
print(A,B,sep=”$”)
B=Changer(B)
print(A,B,sep=”$”,end=”###”)
28.
29.
30.