Data Structures | Stack | Question 1 Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) { Stack S; // Say it creates an empty stack S while (n > 0) { // This line pushes the value of n%2 to stack S push(&S;, n%2); n = n/2; } // Run while Stack S is not empty while (!isEmpty(&S;)) printf("%d ", pop(&S;)); // pop an element from S and print it } What does the above function do in general? (A) Prints binary representation of n in reverse order (B) Prints binary representation of n (C) Prints the value of Logn (D) Prints the value of Logn in reverse order Answer: (B) Explanation: See method 2 of https://www.geeksforgeeks.org/binary-representation-of-a-given-number/ for explanation. Last Updated : 08 Jan, 2013 Like Article Save Article Previous Data Structures | Graph | Question 3 Next Data Structures | Stack | Question 2 Share your thoughts in the comments Add Your Comment Please Login to comment...