You are on page 1of 3

1. Which of the following functions is a built-in function in python?

a) seed() b) sqrt() c) factorial() d) print()

2. What is the output of the expression: round(5.576)

a) 5.5 b) 5 c) 6 d) 5.6

3.Which of the following is the use of function in python?

a) Functions are reusable pieces of programs


b) Functions don‘t provide better modularity for your application
c) you can‘t also create your own functions
d) All of the mentioned

4. Suppose there is a list such that: l=[2,3,4]. If we want to print this list in reverse order, which of
the following methods should be used?

a) reverse(l) b) list(reverse[(l)]) c) list(reversed(l)) d) reversed(l)

5. Which of the following is the use of function in python?

a) Functions are reusable pieces of programs


b) Functions don‘t provide better modularity for your application
c) you can‘t also create your own functions
d) All of the mentioned

6. Where is function defined?

a) Module b) Class c) Another function d) All of the mentioned

7. What is called when a function is defined inside a class?

a) Module b) Class c) Another function d) Method

8. The output of the code shown below is:

def f1():
x=20
print(x)
x=30
f1()
a) Error b) 20 c) 30 d) 2030

9. What is the output of the code shown below?


def f1():
x=100
print(x)
x=+1
f1()
a) Error b) 100 c) 101 d) 99

10. Which type of copy is shown in this code?


l1=[[10, 20], [30, 40], [50, 60]]
ls=list(l1) ls [[10, 20], [30, 40], [50, 60]]

a) Shallow copy b) Deep copy c) memberwise d) All of the mentioned

11. What is the output of the code shown below?

l=[2, 3, [4, 5]]


l2=l.copy()
l2[1]=88
print(l2)

a) [2, 88, [4, 5]]


b) [88, 2, 3, [4, 5]]
c) [2, 88,3, [4, 5]]
d) [2, 3, [4, 5]]

12. What is the output of the following?


elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(incr,elements)))
a) [1, 2, 3]. b) [0, 1, 2]. c) error d) none of the mentioned

13. What is the output of the following?


elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(incr, elements)))
a) [1, 2, 3]. b) [0, 1, 2]. c) error d) none of the mentioned

14.Which of these definitions correctly describes a module?

a)Denoted by triple quotes for providing the specification of certain program elements

b)Design and implementation of specific functionality to be incorporated into a program

c)Defines the specification of how it is to be used

d)Any program that reuses code

15.Which of the following is not an advantage of using modules?

a)Provides a means of reuse of program code

b)Provides a means of dividing up tasks


c)Provides a means of reducing the size of the program

d)Provides a means of testing individual parts of the program

16. What is returned by math.ceil(3.4321)?

a) 4 b) 3.5 c) 4.0 d) 3.0

17. What is the value returned by math.floor(3.4321)?

a) 3.3 b) 4 c) 3.4 d) 3

18. What does the function math.frexp(x) return?

a) a tuple containing of the mantissa and the exponent of x

b) a list containing of the mantissa and the exponent of x

c) a tuple containing of the mantissa of x

d) a list containing of the exponent of x

19 What is the result of math.fsum([.1 for i in range(3)])?

a) 0.3 b) 3.0 c) 0.3000000000000004 d) 3

20. To include the use of functions which are present in the random library, we must use the option:
a) import random b) random.h c) import.random d) random.random

You might also like