Vidyalelo
Python · Q50

Python Introduction and basic

Programming · Python · question 50

Q50

The following python program can work with . . . . . . . . parameters. def f(x): def f1(*args, **kwargs): print("Examveda") return x(*args, **kwargs) return f1

A.
any number of
Answer
B.
0
C.
1
D.
2

Answer: Option A

Solution

Answer: Option A
Solution:
The program defines a function f that takes another function x as an argument.
Inside f, there is a nested function f1 defined with variable-length arguments *args and keyword arguments **kwargs.
The use of *args allows f1 to accept any number of positional arguments, and **kwargs allows it to accept any number of keyword arguments.
Inside f1, "Examveda" is printed, and then the function x is called with the received arguments using (*args, **kwargs).
Therefore, the program can work with any number of parameters.