Sunteți pe pagina 1din 3

1.

The function pow(x,y,z) is evaluated as:

a) (x**y)**z b) (x**y) / z c) (x**y) % z d) (x**y)*z

2. What is the output of the function shown below?

all([2,4,6,”A”])

a) Error b) True c) False d) 0

3. What is the output of the functions shown below?

float(‘-infinity‘)
float(‘inf‘)

a) –infinity and inf b) –inf and inf c) Error and Error d) Error and Junk value

4. What is the output of the function shown below? oct(15)

a) 17 b) 0xF c) 0o17 d) 0xf

5. Which are the advantages of functions in python?

a) Reducing duplication of code b) Decomposing complex problems into simpler pieces

c) Improving clarity of the code d) All of the mentioned

6. Which of the following is the use of id() function in python?

a) Id returns the identity of the object b) Every object doesn‘t have a unique id

c) All of the mentioned d) None of the mentioned

7. Which of the following refers to mathematical function?

a) sqrt b) rhombus c) add d) rhombus

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

def san(x):
print(x+1)
x=-2
x=4
san(15)
a) 5 b) 16 c) 2 d) -2
9. What is the output of the code shown?

def f1():
global x
x+=1
print(x)
x=12
print("x")

a) Error b) 13 c) 13 d) x

10. In _______________ copy, the base address of the objects are copied. In _______________
copy, the base address of the objects are not copied.

a) deep. Shallow b) memberwise, shallow

c) shallow, deep d) deep, memberwise

11. The nested list undergoes shallow copy even when the list as a whole undergoes deep copy.
State whether this statement is true or false.

a) True b) False

12. What is the output of the following?

x = ['AB', 'CD']

print(list(map(lower, x)))

a) [AB, CD]. b) error c) [ab, cd]. d) none of the mentioned

13. What is the output of the following?

def to_upper(k):

return k.upper()

x = ['ab', 'cd']

print(list(map(upper, x)))

a)[AB‘, CD‘]. b) [ab‘, cd‘]. c) none of the mentioned d) error

14.Program code making use of a given module is called a ______ of the module.

a)Client b)Docstring c)Interface d)Modularity

15.______ is a string literal denoted by triple quotes for providing the specifications of certain
program elements.

a)Interface b)Modularity c)Client d)Docstring


16. What is the output of print(math.copysign(3, -2))?

a) -3.2 b) 1.0 c) -3.0 d) -2.0

17. What is displayed on executing print(math.fabs(-3.4))?

a) -3.4 b) 3.4 c) 3 d) -3

18. What is the result of sum([5 for i in range(20)])?

a) 20 b) 100 c) 4 d) 2.0000000000000004

19. What is returned by math.isfinite(float(‘inf‘))?

a) False b) True c) None d) error

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

import random random.choice(2,3,4)

a) An integer other than 2, 3 and 4 b) Either 2, 3 or 4 c) Error d) 3 only

S-ar putea să vă placă și