Q4 a) Which among the following list of operators has the highest precedence ?
+,-, **%, l, «, »,
(b) What is the difference between the formal parameters and actual parameters? What is their a
name? Also give a suitable Python code to illustrate both
Answers
Answered by
3
Explanation:
the difference between the formal parameters and actual parameters? What is their a
name? Also give a suitable Python code to illustrate both.
Answered by
3
Operator Precedence :
** : highest
%
+ , -
<< , >>
| : lowest
So, among the given list of operators ** (exponent) has the highest precedence.
Formal Parameters :
- The parameters / arguments in the function definition.
- Data types needs to be mentioned.
- It is specified when function is defined.
- They are in the called function.
Example :
int square (int a)
{
int s;
s = a*a;
return(s);
}
a is formal parameter.
Actual Parameters :
- The arguments are passed in a function call.
- Data type is not required but it should match with the corresponding data type of the formal parameters.
- Parameters which are specified when a Functions or Procedures is called.
- They passed by the calling function.
Example :
void main()
{
int a;
a = square(5); //function call
}
5 is an actual parameter.
Similar questions