What is the output of the following code ?
print(round(234.56789))
What is the output of the following code ?
print(bin(37))
How many numbers of keyword arguments can be passed to a function in a single function call ?
Example:
def foo(**kwargs):
pass
What is the output of the following code ?
def foo():
return var + 1
var = 2
print(foo())
What is the output of the following code ?
def f(a, L=[]):
L.append(a)
return L
for i in range(3):
print(f(i))
Which of the following is correct ?
Which keyword is used to define a function ?
What is the output of the following code ?
x = 100
def scope_test():
global x
print('x == ', x)
x = 2
print('X is changed to == ', x)
scope_test()
print('x is at outer scope', x)
What is the output of the following code ?
x = 100
def scope_test(x):
global x
print('x == ', x)
x = 2
print('X is changed to == ', x)
scope_test(x)
print('x is at outer scope', x)
What is the output of the following code ?
def foo(x, y=13, z=35):
print('x = ', x, 'y = ', y, 'z = ', z)
foo(7, 9)
foo(12, z=83)
foo(z=78, x=300)
What is the output of the following code ?
def foo(a):
return a * a * a
x = foo(2)
print(x)
What does lambda function/expression returns ?
A variable that is defined outside of a function is generally referred as
A variable that is declared inside a function is know as ?
What is the output of the following code ?
def foo(x):
x += [5]
d = [1, 2, 3, 4]
foo(d)
print(len(d))
What is the output of the following code ?
def foo(p=5, e=6):
p += e
e += 1
print(p, e)
foo(e=8, p=9)
What is the output of the following code ?
def foo(x):
print(x+2)
x = -5
x = 10
foo(12)