Question 1 of 25
Hints left: 3
Q1
Which of the following is the use of function in python?
Q2
Which of the following refers to mathematical function?
Q3
Which of these is not true about recursion?
Q4
What will be the output of the following Python code? def change(i = 1, j = 2): i = i + j j = j + 1 print(i, j) change(j = 1, i = 2)
Q5
Recursion and iteration are the same programming approach.
Q6
What will be the output of the following Python code? x = abcd print(list(map(list, x)))
Q7
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(list, x)))
Q8
What will be the output of the following Python code? x = [34, 56] print(len(map(str, x)))
Q9
What will be the output of the following Python code? def foo(x): x[0] = ['def'] x[1] = ['abc'] return id(x) q = ['abc', 'def'] print(id(q) == foo(q))
Q10
What will be the output of the following Python code and state the type of copy that is depicted? l1=[2, 4, 6, 8] l2=[1, 2, 3] l1=l2 l2
-
A
-
B
-
C
-
D
Q11
What will be the output of the following Python code? def f1(): x=15 print(x) x=12 f1()
Q12
What will be the output of the following Python code? def foo(): return total + 1 total = 0 print(foo())
Q13
What will be the output of the following Python code? x = 50 def func(x): print('x is', x) x = 2 print('Changed local x to', x) func(x) print('x is now', x)
Q14
What is the output of the following code: def multiply(a, b=2): return a * b result = multiply(4) print(result)
Q15
How can you define a function that accepts an arbitrary number of keyword arguments?
Q16
What will be the output of the following Python code? x = [34, 56] print((''.join(list(map(str, x)))),)
Q17
What is the output of the following code: def power(x, n=2): return x ** n result = power(3) print(result)
Q18
What will be the output of the following Python code? a=10 globals()['a']=25 print(a)
Q19
What will be the output of the following Python code? def find(a, **b): print(type(b)) find('letters',A='1',B='2')
Q20
What will be the output of the following Python code? def f1(): x=100 print(x) x=+1 f1()
Q21
What will be the output of the following Python code? x = 5 def f1(): global x x = 4 def f2(a,b): global x return a+b+x f1() total = f2(1,2) print(total)
Q22
What is the length of sys.argv?
Q23
What will be the output of the following Python code? i=0 def change(i): i=i+1 return i change(1) print(i)
Q24
What will be the output of the following Python code? def a(b): b = b + [5] c = [1, 2, 3, 4] a(c) print(len(c))
Q25
What will be the output of the following Python code? def ram(x): print(x+1) x=-2 x=4 ram(12)