Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
It allows the function to accept a variable number of positional arguments
It allows the function to accept a variable number of keyword arguments
It defines the default arguments for a function
It defines the required arguments for a function
What is the output of the following code?def my_function(x, y):return x + yresult = my_function(y=2, x=3)print(result)
5
2
3
1
What is the output of the following code?def my_function(x):return x ** 2numbers = [1, 2, 3, 4]result = map(my_function, numbers)print(list(result))
[1, 4, 9, 16]
[2, 4, 6, 8]
[0, 1, 4, 9
Error
call function_name(arguments)
function_name(arguments)
function(arguments)
call function(arguments)
What is the output of the following code?numbers = [1, 2, 3, 4, 5]def square(x):return x * xsquared_numbers = map(square, numbers)print(list(squared_numbers))
[1, 4, 9, 16, 25]
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
[3, 6, 9, 12, 15]
What is the output of the following code?def my_function(x, y=2):return x ** yresult1 = my_function(2)result2 = my_function(2, 3)print(result1, result2)
2 8
4 8
4 6
2 6
What is the output of the following code?def my_function(**kwargs):return sum(kwargs.values())result = my_function(a=1, b=2, c=3)print(result)
4
6
What is the output of the following code?def my_function(x, y):return x ** yresult = my_function(2, 3)print(result)
8
What is the output of the following code?def my_function():global xx = 5x = x + 1my_function()print(x)
TypeError
None
It applies a function to each element of an iterable and returns a new iterable
It filters an iterable based on a given function
It converts an iterable to a dictionary
It sorts an iterable based on a given function