Class 12 Computer Science Python Functions – Working with Functions MCQs Set – 6


By Anjeev Kr Singh – Computer Science Educator
Published on : December 19, 2021 | Updated on : December 20, 2021

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

Answer : b) 49 25 9 1

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

Answer : a) 6

13

12

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

Answer : c) 35

9

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#

Answer : a) ES#NE#IO# & 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:

Answer : a) 20:10: & c) 10:

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$

Answer : a) 10$50$75$

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

Answer : b) 1

108. What is the maximum value of N?

a) 0

b) 1

c) 2

d) 3

Answer : 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

Answer : d) 3#41


More MCQ’s are by 19-12-2021 11:00 pm
Keep Visiting www.mycstutorial.in
Important for Term 1 Examination


Python Functions – Working with Functions (MCQ’s)



Python Revision Tour – Multiple Choice Questions (MCQ’s)



Python File Handling (MCQ’s)



Class 12 Computer Science NCERT Book Exercise Solutions


About the Author

Anjeev Kr Singh

Anjeev Kr Singh

Computer Science Educator, Author, and HOD. Guiding CBSE students in CS, IP, IT, WA & AI via mycstutorial.in. Creator of Question Bank for Class 10 & 12 students.

You cannot copy content of this page

Scroll to Top