1.Consider the following C function named fact. Trace the call fact( 5 ). Show how you reached thereturn value of this call by drawing a function call tree.[.. points]
int fact(int a)
{
if (a < 1) {
return 1;
}
else {
return(a * fact(a - 1));
}
}
6
2.What will the following program print out when run?[.. points]
int main()
{
char s[] = "Alexander Graham Bell";
char *p ;
p = s;
*p = 'F';
printf("%s\n", s);
p += 17;
*p = 'D';
printf("%s\n", s);
printf("%s\n", *p);
}
Use the code segment below for question 3 [.. points]
int x = 3;
int *y;
int *z;
y = &x;
z = y;
(*z)--;
printf("result: %d\n", *y + *z);
3.Which of the following is the output generated by the print statement in the code segment above?
A.result: 6 B.result: 5 C.result: 4 D.None of the above