Consider the following function. What will be the values of variables a and b re
ID: 3709274 • Letter: C
Question
Consider the following function. What will be the values of variables a and b returned by this function assuming that the function is called with the values of a- 6 and b 4 from the main function. void swap/(int a, int b) a-a+ b a-a-b return int main) swap(a, b) printf("a %d, b-%d n", a, b); Options a) a 6, b 4 b) a 4. b-e c) a 4, b 4 d) a- 6, b-6 e) None of the above. 21)Given the following declaration unsigned char value, x; One wishes to assign to the vanable "X" the value of bit 4 of the variable-value" so that x is 1ifbit 4 is set to 1 and x is 0 if bit 4 is set to zero. Bit 0 is the least significant bit Which one of the following statements would do this? Options a) x # (value & (0x81))>> 4 b) x (value | (Ox10))>4 c) x (value & (0x10))-> 4 d) x-value>>4 (0x01) e) None of the above 22)Given the declaration: double "u; double v; double "p which of the following statements is correct? Options a) "p is a double and u is a double b) v is a double and p is a double c) "u is a double and "p is a double d) u is a double and "p is a double v is a double and u is a double e)Explanation / Answer
20
a) a = 6, b = 4
the variables a and b will not be swapped back in main because the arguments are using call by value.The values of variables a and b inside the function swap is locally changed .
21
c) x = (value & 0x10) >>4;
0x10 = 0001 0000 so 4th bit is 1 starting from bit 0 from right side
22.
d. *u is double and **p is double
both are values not pointer addresses
23.
temp = 5+ 14 in funB() function
t = 19
e) None of the above
24
c) age == *q
age is an integer value . But *q is an address . This both cannot be compared. age == **q is the correct way.
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.