Home / Programming MCQs / JAVA MCQs / Question

R

Ram Sharma • 189.43K Points
Coach

Q. What does this Java code snippet prints?

Code:
int b=45;
String str="";
while(b > 0)
{
  str = str + b%2;
  b = b/2;
}
StringBuilder sb = new StringBuilder(str);
sb.reverse();
System.out.println(sb.toString());
(A) Prints the remainder of a number
(B) Prints Binary representation of a number
(C) Prints Octal representation of a number
(D) Prints Hexadecimal representation of a number

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.