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
Read the following Python code carefully and point out the global variables? y, z = 1, 2 def f(): global x x = y+z
Q4
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.
Q5
What will be the output of the following Python code? def sayHello(): print('Hello World!') sayHello() sayHello()
Q6
What is the value stored in sys.argv[0]?
Q7
Which of the following data structures is returned by the functions globals() and locals()?
Q8
What will be the output of the following Python code? def f1(x): global x x+=1 print(x) f1(15) print("hello")
Q9
What will be the output of the following Python code? def foo(): total += 1 return total total = 0 print(foo())
Q10
What is the type of sys.argv?
Q11
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
Q12
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))
Q13
On assigning a value to a variable inside a function, it automatically becomes a global variable.
Q14
What will be the output of the following Python code? l=[-2, 4] m=map(lambda x:x*2, l) print(m)
Q15
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
Q16
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))
Q17
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
Q18
What will be the output of the following Python code? y = 6 z = lambda x: x * y print z(8)
Q19
How can you pass multiple arguments to a function as a tuple?
Q20
What will be the output of the following Python code? x = [12, 34] print(len(''.join(list(map(int, x)))))
Q21
Lambda is a statement.
Q22
Which are the advantages of functions in python?
Q23
Does Lambda contains return statements?
Q24
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)
Q25
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))