6. What is the output of following program? # include void fun(int x) x = 25 8.
ID: 3874641 • Letter: 6
Question
6. What is the output of following program? # include void fun(int x) x = 25 8. Self-referential structures contain a member field that. (a) uses typedef (b) is an array (c) point to the same structure type (d) is another structure int main0 int y -20 fun(y) printf("%d", y); return 0; (a) 25 (b) 20 (c) Unknown value (d) Compiler error 7. Assume that float takes 4 bytes, predict the output of following program. 9. x>>2 is the same as (a) multiplying x by2 (b) multiplying x by 2 (c) dividing x by 4 (d) dividing x by 4 include int main0 10 is used to open a pipe for formatted piping float arr[5] 12.5, 10.0, 13.5, 90.5, 0.5); float *ptrl- &arr;[0] float ptr2 -ptrl+3; (a) popen() (b) pipe() (c) pformat() (d) none of the above printf("%f", *ptr2); printf("%d", ptr2 _ ptr1); return 0 (a) 90.500000 3 (b) 90.500000 12 (c) 0.5000000 3 (d) 10.000000 12Explanation / Answer
6. The correct option is (b) 20
Explanation :
The fun(y) is calling with y=20 to
fun function. The fun takes the y into x valu by
pass by value. The values calling pass by value do
not alter the value out of function.
In main, the y remains the same.
----------------------------------------------------------
7)The correct option is (a) 90.50000 3
Explanation :
The ptr1 is pointer to store the starting address of the array,arr.
The ptr2 stores the address of the 3 index address of the ptr1.
The *ptr2 display the value at 3rd index in the array,arr.
The ptr2-ptr1 is calculated as follows
assume the address of array,arr stored in ptr1
is as follows ptr1=00
ptr2=ptr1+3=00+3x4=12
ptr2-ptr1=12-00=12(3x4 bytes ) or 12/4 bytes=3
----------------------------------------------------------
8. The correct option is (c) point to the same structure type
Explanation :
The self referential structures conain a member field that
point to the same structure type.
----------------------------------------------------------
9. The correc option is (c) dividing x by 4
Explanation :
x>>2 means x=x/2^2
That is dividing the x by 4
----------------------------------------------------------
10. The correct option is (a) popen()
Explanation :
The function popen() is used to open a pipe for
formatted piping.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.