0% found this document useful (0 votes)
255 views5 pages

Q1 083 New Python For 2019-20 Board Exam PDF

This document contains a Python quiz with multiple choice and code output questions. The questions cover Python operators, data types, functions, conditionals, loops, libraries, syntax errors, random numbers, and more. For the code output questions, the possible outputs are listed as options to choose from. Maximum variable values are also specified.

Uploaded by

Ankur Solanki
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)
255 views5 pages

Q1 083 New Python For 2019-20 Board Exam PDF

This document contains a Python quiz with multiple choice and code output questions. The questions cover Python operators, data types, functions, conditionals, loops, libraries, syntax errors, random numbers, and more. For the code output questions, the possible outputs are listed as options to choose from. Maximum variable values are also specified.

Uploaded by

Ankur Solanki
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/ 5

Computer Science New 083 PYTHON

Section A
Q1. a Which of the following is valid arithmetic operator in Python: 1
1. (i) // (ii) ? (iii) < (iv) and
2. (i) in (ii) !=(iii) &(iv) %
3. (i) !=(ii) *= (iii) or (iv) **
4. (i) /(ii) not (iii) in (iv) is
5. (i) not in (ii) = (iii) << (iv) //
b Write the type of tokens from the following: 1
1. (i) else (ii) student
2. (i) break (ii) class
3. (i) age (ii) continue
4. (i) for (ii) for else
5. (i) while else (ii) lenght
c Name the Python Library modules which need to be imported to invoke the 1
following functions:
1. (i) exp() (ii) show ()
2. (i) read() (ii) xlabel()
3. (i) write() (ii) arange ()
4. (i) mkdir() (ii) title ()
5. (i) abs() (ii) randrange()
d Rewrite the following code in python after removing all syntax error(s). 2
Underline each correction done in the code.
1.
a==integer(input("enter age") )
b=integer(input("enter age"))
if a>>b:
print("1st ELDER")
else;
print("2nd ELDER")

2.
x,y=14, length('Board Exam2020 ")
if x < y:
st= "x is less than y"
el if(x>y):
st= "x is greater than y"
else if :
st= "x is = Y"
print (St)

3.
X,y="Mohan","Rahul"
name=INPUT("Enter Name of EMP: ")
if x==name;
print(x," Sal 12000/-")
else if y = "Rahul":
print(y," Sal 15000/- ' )
else
PRINT("Name Not Match")

4.
a=integer(input("Enter Any Number"))
S,c=0,0
while(a!=0):
N=a%10
a=a//10
for i in range(2,n++1):
if i%n==0:
c=c+1
if c==1
s=s+n
C=0
print(s)

5.
Str="Board Exam 2020"
For i in range(len(str)):
print(str[i:length(str)-I%2])

e Find and write the output of the following python code: 2


1.
def show( s)
l=s.split('a')
for i in l:
if len(i)>5:
print(i," : ",len(i))
s="I LoVe My INdiA"
show(s)

2.
def show( s)
r=""
for i in s:
if i.isupper():
r+=i.lower()
elif i.islower():
r+=i.upper()
else:
r=r+i
return r
s="CBSE Exam 2019-2020"
print(s)

3.
def show( s)
r=""
size=len(s)
for i in range(size):
if i%2==0:
r+=s[i].upper()
else:
r+=s[i]
return r
s="Ali Baba . com 2002"
print(show( s))

4.
def show( s)
l=len(s)
r=""
for x in range(l):
if s[x].islower():
r+=s[x].upper()
elif s[x].isupper():
if (x%2!=0):
r+=s[x-1].lower()
else:
r+=chr(ord(s[x])-1)
return r
s= "a ProFile"
print(show( s))

5.
def show(poet)
l=len(poet)
r=""
for i in range(l):
if poet[i].islower():
r+=poet[i-1]
elif poet[i].isupper():
if poet[i]=='S':
r+='X';
elif(poet[i]=='E'):
r+=poet[i-1].upper()
else:
r+=chr(ord(poet[i])-1)
return r
poet= "SakESpHerE" ;
print(show(poet))

f Find and write the output of the following python code: 3


1.
def s(a, b=7):
a+=2
b*=5
print(a,":",b)
a,b=4,8
print(a,":",b,")
s(a,b)
print(a,":",b,")
s(a)
print(a,":",b,")

2.
def FUN(a=10):
print(a)
a=4
print(a)
FUN(a)
print(a)
def FUN(a,b=10):
print(a,",",b)
a,b=4,13
print(a,",",b)
FUN(a,b)
FUN(a)
FUN(b)

3.
def switchover(A,N, split):
K=0
while K<N:
if K<split :
A[K]+= K
else:
A[K]*= K
K+=1
def display(A,N):
K=0
while K<N:
if K%2== 0:
print(A[K],end="%")
else:
print(A[K],"\n")
K+=1
H= [30,40,50,20,10,5]
switchover(H,6,3)
print(H)
display(H,6)
4.
def func(x,y=10):
if x%y==0 :
return x+2
else:
return y-1
p,q=20,23;
print(p,",",q)
q=func(p,q)
print(p,",",q)

5.
def func(x=20,y=10):
if x%y==0 :
return x+2
else:
return y-1
p,q=20,23;
print(p,",",q)
q=func(p,q)
print(p,",",q)
p=func(q)
print(p,",",q)

g What possible outputs(s) are expected to be displayed on screen at the time of 2


execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables
1.
city= [ "DEL", "CHN", "KOL", "BOM", "BNG"]
for I in range(1,4):
Fly = random.randrange(0,2) + 1 ;
print( city[Fly] ,end=":")
print()
#Output Options:
i. DEL: CHN : KOL : ii. CHN : KOL : CHN :
iii. KOL : BOM : BNG : iv. KOL : CHN : KOL :
2.
Area=["NORTH","SOUTH","EAST","WEST"]
for I in range(3):
ToGo=random.randrange(0,2) + 1
print(Area[ToGo],end=":")
print()
#Output Options:
i. SOUTH : EAST : SOUTH :ii. NORTH : SOUTH : EAST :
iii. SOUTH : EAST : WEST : iv. SOUTH : EAST : EAST :

3.
RN=random.randrange(0,4)+5;
for I in range(1,RN):
print(i,end=' ')
# Output Options:
i. 0 1 2 ii. 1 2 3 4 5 6 7 8
iii. 4 5 6 7 8 9 iv. 5 6 7 8 9 10 11 12

4.
MAX = 3;
digit =80 + random.randrange(0,MAX )
for R in range (digit,80-1,-1):
print(R,end="$")
print()
#Output Options:
i. 83$82$81$80$ ii. 80$81$82$
iii. 80$81$ iv. 81$80$

5.
LIMIT = 4
Points = 100 +random.randrange(0,LIMIT);
for p in range(Points,99,-1):
print(p,end="#")
print()
#Output Options:
i. 103#102#101#100# ii. 100#101#102#103#
iii. 100#101#102#103#104# iv. 104#103#102#101#100#

You might also like