Zed-King Study app · Free
O Level students across India practise here, free
Google login · no Play Store needed
About this PDF
Model test paper 4 for O Level M3-R5.1 — a full-length set with more questions on functions, scope and modules. Useful once the whole syllabus has been read once.
This is part of the free O Level M3-R5.1 study material in the Zed-King Study Zone. You can read every page above in your browser, or download the file and study offline. Zed-King Group of Institute is a NIELIT Study Centre in Kaithal, Haryana, and all of this material follows the current NIELIT syllabus.
- Course
- O Level — NIELIT Foundation Diploma
- Module
- M3 — M3-R5.1: Programming and Problem Solving through Python
- Section
- Model Test Papers
- Format
- PDF — read online or download
- Price
- Free, no sign-up required
Text from this PDF
The opening pages as plain text — open the reader above for tables, diagrams and the full file.
1 .What will be the output of the following Python code?
odd=lambda x: bool(x%2)
numbers=[n for n in range(10)] print(numbers)
n=list()
for i in numbers:
if odd(i):
continue else:
break
2 .What will be the output of the following Python code?
import functools print(functools.reduce(lambda x,y:x*y,l))
Model Test Paper 4
3 .What will be the output of the following Python code?
def f1(x):
return x<-1 m1=map(f1, l)
print(list(m1))
A)[False, True, True, False, False]
B)[True, True, True, True, True]
C)[True, False, False, True, True]
D)[False, False, False, False, False]
4 .What will be the output of the following Python code?
import functools m=functools.reduce(lambda x, y:x if x>y else y, l)
print(m)
B)Address of m
C)1
D)5
5 .What will be the output of the following Python code?
m=reduce(lambda x: x-3 in range(4, 10))
print(list(m))
C)No output
6 .What will be the output of the following Python code?
elements = [0, 1, 2] def incr(x):
return x+1 print(list(map(incr, elements)))
7 .What will be the output of the following Python code?
def to_upper(k):
return k.upper()
x = ['ab', 'cd'] print(list(map(upper, x)))
A)[‘AB’, ‘CD’]
B)[‘ab’, ‘cd’]
8 .What will be the output of the following Python code?
x = ['ab', 'cd'] print(map(len, x))
A)[‘ab’, ‘cd’]
9 .What will be the output of the following Python code?
x = ['ab', 'cd'] print(len(list(map(list, x))))
A)0
B)2
C)4
10 .What will be the output of the following Python code?
print((' '.join(list(map(str, x))),))
11 .What will be the output of the following Python code?
print((''.join(list(map(str, x)))),)
212 .What will be the output of the following Python code?
x = 'abcd' print(list(map(list, x)))
A)[‘abcd’]
213 .Is Python code compiled or interpreted? · A)Python code is both compiled and interpreted · B)Python code is neither compiled nor interpreted · C)Python code is only interpreted · D)Python code is only compiled
214 .Which of these is false about a package? · A)A package can have subfolders and modules · B)Each import package need not introduce a namespace · C)import folder.subfolder.mod1 imports packages · D)from folder.subfolder.mod1 import objects imports packages
215 .Which of the following is not an advantage of using modules? · A)Provides a means of dividing up tasks · B)Provides a means of reuse of program code · C)Provides a means of reducing the size of the program · D)Provides a means of testing individual parts of the program
216 .______ is a string literal denoted by triple quotes for providing the specifications of certain program elements. · A)Interface · B)Client · C)Modularity · D)Docstring
217 .Which of the following is true about top-down design process? · A)Only the design of the program is addressed · B)Only the details of the program are addressed · C)The overall design of the program is addressed before the details · D)The details of a program design are addressed before the overall design
218 .What will be the output of the following Python code?
from math import factorial print(math.factorial(5))
B)Nothing is printed
C)Error, method factorial doesn’t exist in math module
D)Error, the statement should be: print(factorial(5))
219 .What will be the output of print(math.copysign(3, -1))? · D)1
220 .What is math.factorial(4.0)? · A)1
221 .What will be the output of the following Python code?
import datetime d=datetime.date(2016,7,24)
print(d)
222 .What will be the output of the following Python code if the system date is 18th August, 2016?
tday=datetime.date.today()
print(tday.month())
A)8
C)Aug
D)August
223 .Which of the following will throw an error if used after the following Python code?
tday=datetime.date.today()
bday=datetime.date(2017,9,18)
t_day=bday-tday
A)print(t_day.max)
B)print(t_day.months)
C)print(t_day.seconds)
D)print(t_day.resolution)
224 .To include the use of functions which are present in the random library, we must use the option: · A)import random · B)import.random · C)random.random · D)random.h
225 .What will be the output of the following Python code?
import random random.choice(2,3,4)
A)3 only
B)Either 2, 3 or 4
C)An integer other than 2, 3 and 4
226 .What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')
A)u
B)sun
C)either s, u or n
227 .What will be the output of the following Python code?
random.seed(3)
random.randint(1,5)
A)2
B)3
C)Any integer between 1 and 5, including 1 and 5
D)Any integer between 1 and 5, excluding 1 and 5
More model test papers for M3-R5.1
Run these Python programs yourself — free
Reading code is not the same as writing it. Type any program from these notes into our free online Python compiler (real Python 3 with NumPy, input() works), or study one of the explained programs with its output.
Prepare for O Level with expert guidance
Classroom training, practical labs and exam registration at Zed-King Institute, Kaithal.
