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