Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
A function that is defined within another function
A function that can be called recursively
A function that is defined using the lambda keyword and has no name
A function that is defined using the def keyword and has no name
There is no difference
Parameters are values passed to a function, whereas arguments are variables defined within a function
Arguments are values passed to a function, whereas parameters are variables defined within a function
Parameters and arguments are both variables defined within a function
It specifies the function name
It returns a value from the function
It defines the function arguments
It ends the function execution
What is the output of the following code?def my_function(a, b, c=0, d=0):return a + b + c + dresult = my_function(1, 2, 3, 4)print(result)
3
6
10
5
What is the output of the following code?def my_function(x, y):return x + yresult = my_function(y=2, x=3)print(result)
2
1
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
It allows the function to accept a variable number of keyword arguments
It allows the function to accept a variable number of positional arguments
It defines the default arguments for a function
It defines the required arguments for a function
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
What is the output of the following code?def my_function(x, y):return x * ynumbers = [1, 2, 3, 4]result = 1for number in numbers:result = my_function(result, number)print(result)
24
8
What is the keyword used to define a function in Python?
define
function
def
create