1.

Differentiate between actual parameter(s) and a formal parameter(s) with a suitable example for each.

Answer»

The list of identifiers used in a function call is called actual parameter(s) whereas the list of parameters used in the function definition is called formal parameter(s). 

Actual parameter may be value / variable or expression. 

Formal parameter is an identifier. 

Example: 

def area(side):           # line 1 

return side*side; 

print(area(5))         # line 2 

In line 1, side is the formal parameter and in line 2, while invoking area() function, the value 5 is the actual parameter.

A formal parameter, i.e. a parameter, is in the function definition. An actual parameter, i.e. an argument, is in a function call.



Discussion

No Comment Found

Related InterviewSolutions