Page 1 of 1

Based on this C code below answer the following questions / questions are after the code #include #define MAX

Posted: Wed Apr 27, 2022 3:43 pm
by answerhappygod
Based on this C code below answer the following questions /
questions are after the code
#include <stdio.h>
#define MAX 10
void
Alpha(double *L, int n)
{
int i;
for (i = 0; i < n; i++)
printf("%.2lf\n", *(L + i)); // 2
digits after the decimal point
}
int
main()
{
double A[MAX] = { 1.11, 2.22, 3.33, 4.44, 5.55,
6.66, 7.77, 8.88 };
// 0
1 2
3 4
5 6 7
// ASSUMPTIONS:
// 1. Assume that the address of the first
element
// &A[0] is FF88 in
hexadecimal (let's keep it simple
// by using only 4
hexadecimal digits).
// 2. Assume that the sizeof(double) is 8
bytes.
// 3. Assume that the sizeof(double *) is 8
bytes.
Alpha(A, 10); // 1st function call
to Alpha()
Alpha(A, 5); // 2nd function
call to Alpha()
Alpha(A + 5, 5); // 3rd function call to
Alpha()
return 0;
}
How many bytes will be passed corresponding to the 1st parameter
in the 1st function call to Alpha()? Your answer must be a
number in Arabic (for example, you should write 12 not the English
word twelve).
What is the value of the 1st actual parameter in the 1st
function call to Alpha()? Your answer must be a 4 digit hexadecimal
number (you may use lower or upper case for A to F).
What is the first value that will be printed based on the 3rd
function call to Alpha()? Your answer should have 2 digits
after the decimal point.
What is the value received by formal parameter L based on the
1st function call to Alpha()? Your answer must be a 4 digit
hexadecimal number (you may use lower or upper case for A to
F).
What is the last value that will be printed based on the 1st
function call to Alpha()? Your answer should have 2 digits
after the decimal point.
What is the data type of formal parameter L? Your answer
must be an actual C data type (for example, you should write int
not the English word integer).
What is the value of the expression L + 3 based on the 1st
function call to Alpha()? Your answer must be a 4 digit hexadecimal
number (you may use lower or upper case for A to F).
What is the last value that will be printed based on the 2nd
function call to Alpha()? Your answer should have 2 digits
after the decimal point.
What is the value of the expression L + 3 based on the 3rd
function call to Alpha()? Your answer must be a 4 digit hexadecimal
number (you may use lower or upper case for A to F).
What is the last value that will be printed based on the 3rd
function call to Alpha()? Your answer should have 2 digits
after the decimal point.
What will be displayed by printf() corresponding to the
expression *(L + 3) based on the 3rd function call to Alpha()?
Your answer should have 2 digits after the decimal point.
What will be displayed by printf() corresponding to the
expression *(L + 3) based on the 1st function call to Alpha()?
Your answer should have 2 digits after the decimal point.
What is the first value that will be printed based on the 1st
function call to Alpha()? Your answer should have 2 digits
after the decimal point.
What is the value of the 1st actual parameter in the 3rd
function call to Alpha()? Your answer must be a 4 digit
hexadecimal number (you may use lower or upper case for A to
F).
What is the value received by formal parameter L based on the
3rd function call to Alpha()? Your answer must be a 4 digit
hexadecimal number (you may use lower or upper case for A to
F).