Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? def to_upper(k): return k.upper() x = ['ab', 'cd'] print(list(map(to_upper, x)))
Q2
What will be the output of the following Python code? x = [12.1, 34.0] print(' '.join(list(map(str, x))))
Q3
What will be the output of the following Python code? e="butter" def f(a): print(a)+e f("bitter")
Q4
What will be the output of the following Python code? l=[2, 3, [4, 5]] l2=l.copy() l2[0]=88 l l2
-
A
-
B
-
C
-
D
Q5
Where is function defined?
Q6
What will be the output of the following Python code? x = [12, 34] print(len(' '.join(list(map(int, x)))))
Q7
What will be the output of the following Python code? x=1 def cg(): global x x=x+1 cg() x
Q8
How can you use a module in Python?
Q9
What is the output of the following code: def greet(name="User"): print(f"Hello, {name}!") greet()
Q10
What is a Python module?
Q11
What will be the output of the following Python code? x = 1234 print(list(map(list, [x])))
Q12
Which is the most appropriate definition for recursion?
Q13
What is the output of the following code: def my_function(a, b): return a * b result = my_function(4, 0) print(result)
Q14
What will be the output of the following Python code? x = [12, 34] print(len(list(map(len, x))))
Q15
What will be the output of the following Python code? l1=[1, 2, 3, (4)] l2=l1.copy() l2 l1
-
A
-
B
-
C
-
D
Q16
What will be the output of the following Python code? elements = [0, 1, 2] def incr(x): return x+1 print(list(map(incr, elements)))
Q17
What will be the output of the following Python code? def change(one, *two): print(type(two)) change(1,2,3,4)
Q18
What are the two main types of functions?
Q19
In . . . . . . . . copy, the base address of the objects are copied. In . . . . . . . . copy, the base address of the objects are not copied.
Q20
What will be the output of the following Python code? def foo(k): k[0] = 1 q = [0] foo(q) print(q)
Q21
Which of the following numbers will not be a part of the output list of the following Python code? def sf(a): return a%3!=0 and a%5!=0 m=filter(sf, range(1, 31)) print(list(m))
Q22
What will be the output of the following Python code? def writer(): title = 'Sir' name = (lambda x:title + ' ' + x) return name who = writer() who('Arthur')
Q23
What is called when a function is defined inside a class?
Q24
What will be the output of the following Python code? x = [12, 34] print(len(''.join(list(map(str, x)))))
Q25
What will be the output of the following Python code? def f(p, q, r): global s p = 10 q = 20 r = 30 s = 40 print(p,q,r,s) p,q,r,s = 1,2,3,4 f(5,10,15)