Python Functions – Working with Functions MCQ’s
Multiple Choice Questions [MCQs] Set – 6
101. Find the output:
def cal():
i = 9
while i> 1:
if i%2==0:
x = i%2
i = i-1
else:
i = i-2
x = i
print (x**2, end= ' ')
cal()
a) 64 36 16 4
b) 49 25 9 1
c) 7 5 3 1
d) None of these
102. Find the output:
def sum(*a):
s=0
for i in a:
s=s+i
print(s)
sum(2, 4)
sum(1,5, 7)
sum(2, 4, 6)
a) 6
13
12
b) 2
5
10
c) 12
13
6
d) None of these
103. Find the output:
def Revert(Num,Last=2):
if Last%2==0:
Last=Last+1
else:
Last=Last-1
for C in range(1,Last+1):
Num+=C
print(Num)
A,B=20,4
Revert(A,B)
B=B-1
Revert(B)
a) 35
b) 9
c) 35
9
d) None of these
104. Find the possible output(s):
import random
STRING=”CBSEONLINE”
NUMBER=random.randint(0,3)
N=9
while STRING[N]!=”L”:
print (STRING[N] +STRING[NUMBER] + “#”,end=””)
NUMBER=NUMBER+1
N=N-1
a) ES#NE#IO#
b) LE#NO#ON#
c) NS#IE#LO#
d) EC#NB#IS#
105. Find the possible output(s):
import random
PLAY=[40,50,10,20]
ROUND=random.randint(2,3)
for J in range(ROUND,1,-1):
print (PLAY[J],":",end="")
a) 20:10:
b) 20:10:50:
c) 10:
d) 40:50:20:
106. Find the possible output (s):
import random
x = [10, 50, 75, 100]
n = random.randint(0,3)
for i in range(n):
print(x[i], "$', end="")
a) 10$50$75
b) 75$100$
c) 50$100$
d) 10$50$75$100$
Directions: Answer the questions number 107 , 108 & 109
import random
X=3
N=random.randint(1,X)
for i in range(N):
print (i,”#”,i+1)
107. What is the minimum value of N?
a) 0
b) 1
c) 2
d) 3
108. What is the maximum value of N?
a) 0
b) 1
c) 2
d) 3
109. Which of the output(s) is/are not expected from the given (above) code?
a) 0#1
b) 1#2
c) 2#3
d) 3#4
Python Functions – Working with Functions (MCQ’s)
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 1
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 2
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 3
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 4
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 5
- Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 6
Python Revision Tour – Multiple Choice Questions (MCQ’s)
- Class 12 Computer Science MCQs Python Revision Tour Set – 1
- Class 12 Computer Science MCQs Python Revision Tour Set – 2
Python File Handling (MCQ’s)
- Class 12 Computer Science File Handling in Python MCQs Set 1
- Class 12 Computer Science File Handling in Python MCQs Set 2
- Class 12 Computer Science File Handling in Python MCQs Set 3
- Class 12 Computer Science File Handling in Python MCQs Set 4
- Class 12 Computer Science File Handling in Python MCQs Set 5
- Class 12 Computer Science File Handling in Python MCQs Set 6
- Class 12 Computer Science File Handling in Python MCQs Set 7
- Class 12 Computer Science File Handling in Python MCQs Set 8
- Class 12 Computer Science File Handling in Python MCQs Set 9
Class 12 Computer Science NCERT Book Exercise Solutions
- Interface Python with MySQL – Important Questions – Answer
- Class 12 Computer Science – Exception Handling in Python NCERT Exercise Solutions
- Class 12 Computer Science File Handling in Python NCERT Exercise solution
- Class 12 Computer Science Stacks NCERT Exercise Solution
- Class 12 Computer Science Queues NCERT Exercise Solution