2
1
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
What will be the output of the following Python code?
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]
Error
[6,5J,2]
break
pass
continue
none of these
What is the output of the following code?
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
procedure
function
bug
None of these
Lists
Dictionary
String
All of the mentioned
In Module
In Class
In Another function
All of these
A built-in Python function
A one-line anonymous function
Lambda is a function in python but user can not use it.