GATE | Gate IT 2008 | Question 80
Consider the code fragment written in C below :
Which of the following implementations will produce the same output for f(173) as the above code?
(A) Both P1 and P2
(B) P2 only
(C) P1 only
(D) Neither P1 nor P2
Here, basically the function f prints the binary representation of the number.
function f1 also prints the binary representation of the number
function f2 prints the binary representation but in reverse order.
Output of f is:- 10101101
Output of f1 is:- 10101101
Output of f2 is:- 10110101
So, the answer is option (C) which is P1 only. This solution is contributed by Anil Saikrishna Devarasetty.
Quiz of this Question
This solution is contributed by Anil Saikrishna Devarasetty.
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.