Question 1 of 25
Hints left: 3
Q1
Which of the following is a feature of DocString?
Q2
What will be the output of the following Python code? import functools l=[1,2,3,4] print(functools.reduce(lambda x,y:x*y,l))
Q3
What will be the output of the following Python code? l=[1, 2, 3, 4, 5] m=map(lambda x:2**x, l) print(list(m))
-
A
-
B
-
C
-
D
Q4
What will be the output of the following Python code? def power(x, y=2): r = 1 for i in range(y): r = r * x return r print power(3) print power(3, 3)
Q5
What will be the output of the following Python code? def sayHello(): print('Hello World!') sayHello() sayHello()
Q6
What will be the output of the following Python code? m=reduce(lambda x: x-3 in range(4, 10)) print(list(m))
-
A
-
B
-
C
-
D
Q7
What will be the output of the following Python code? l1=[10, 20, 30, [40]] l2=copy.deepcopy(l1) l1[3][0]=90 l1 l2
-
A
-
B
-
C
-
D
Q8
Lambda is a statement.
Q9
What will be the output of the following Python code? def maximum(x, y): if x > y: return x elif x == y: return 'The numbers are equal' else: return y print(maximum(2, 3))
Q10
What will be the output of the following Python code? L = [lambda x: x ** 2, lambda x: x ** 3, lambda x: x ** 4] for f in L: print(f(3))
Q11
What will be the output of the following Python code? x = [12, 34] print(len(''.join(list(map(int, x)))))
Q12
Read the following Python code carefully and point out the global variables? y, z = 1, 2 def f(): global x x = y+z
Q13
Which are the advantages of functions in python?
Q14
Does Lambda contains return statements?
Q15
Which of the following data structures is returned by the functions globals() and locals()?
Q16
What will be the output of the following Python code? def f1(x): global x x+=1 print(x) f1(15) print("hello")
Q17
On assigning a value to a variable inside a function, it automatically becomes a global variable.
Q18
What will be the output of the following Python code? l=[-2, 4] m=map(lambda x:x*2, l) print(m)
Q19
What is the value stored in sys.argv[0]?
Q20
What is the type of sys.argv?
Q21
What will be the output of the following Python code? y = 6 z = lambda x: x * y print z(8)
Q22
In . . . . . . . . copy, the modification done on one list affects the other list. In . . . . . . . . copy, the modification done on one list does not affect the other list.
Q23
What will be the output of the following Python code? def foo(x): x = ['def', 'abc'] return id(x) q = ['abc', 'def'] print(id(q) == foo(q))
Q24
What will be the output of the following Python code? def foo(): total += 1 return total total = 0 print(foo())
Q25
How can you pass multiple arguments to a function as a tuple?