Option C.
Since the programming language in the syllabus for GATE is: C. So, I would try to write the closest program for the given construct.
Pass by Value:(which is more likely the case here)
#include<stdio.h>
int x, result;
int f(int x)
{
x = x+1;
return x;
}
int main()
{
x = 5;
result = f(x)*f(x);
printf("final result : %d\n",result );
return 0;
}
Output:
final result : 36
But I would also write the closest program to pass by reference, just for overall analysis.
Pass by reference:
#include <stdio.h>
int x =5;
int f(int *p)
{
(*p)++;
return *p;
}
int main(int argc, char const *argv[])
{
int *ptr = &x;
int out;
out = f(ptr) * f(ptr);
printf("output : %d\n",out );
return 0;
}
Output:
output : 42