What is the output of the following code ?
def disp(*arg): for i in arg: print(i) disp(name="Rajat", age="20")
TypeError
Rajat 20
Name age
None of these
What is the output of the following code?
x = 50 def func (x): x = 2 func (x) print ('x is now', x)
x is now 50
x is now 2
x is now 100
Error
What will be the output of the following Python code?
example = "helle" print(example.rfind("e"))
1
2
4
5
What is the value of the following Python code?
>>>print(36 / 4)
9
9.0
4.0
0
none
What is the output of the following
y='klmn' for i in range(len(y)): print(y)
klmn klmn klmn klmn
k
kkk
None of the these
Segments
Modules
Units
All the above
from math import factorial print(math.factorial(5))
120
Nothing is printed
NameError: name 'math' is not defined
Error, the statement should be print factorial(5))
What will be the output of the following code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22) sorted_numbers = sorted(numbers) odd_numbers = [x for x in sorted_numbers if x% 2!=0] print(odd_numbers)
[7, 19, 45, 89]
[2, 4, 22, 72]
[4, 7, 19, 2, 89, 45, 72, 22]
[24, 7, 19, 22, 45, 72, 89]
Choose the correct function declaration of fun1() so that we can execute the following two function calls successfully.
fun1(25, 75, 55) fun1(10, 20)
def fun1(**kwargs)
def fun1(args*)
No, it is not possible in Python
def fun1(*data)
x='abcd' for i in x: print(i.upper())
a BCD
abcd
error
A B CD
factorial()
print()
seed()
sqrt()
What will be the output of following?
Y=[2,5J,6] Y.sort()
[2,6,5J]
[5J,2,6]
[6,5J,2]
break
pass
continue
none of these
def s(n1): print(n1) n1=n1+2 n2=4 s(n2) print(n2)
6 4
4 6
4 4
6 6
What is the output of the following?
x=123 for i in x: print(i)
1 2 3
123
Subtracting two numbers
Comparing two data values
Providing output to the user
Adding two numbers
What will be the output of the following Python code ?
def display(b,n): while n>0: print(b,end='') n=n-1 display('z',3)
zzz
zz
Infinite loop
An exception is thrown
A static variable
A global variable
A local variable
An automatic variable
A function that calls itself
A function that calls other functions
Both (A) and (B)
None of the above