What is the output of the following code snippet?
Double a = 2;
Int n = 16;
Double r = 1;
Double b = a;
Int i = n;
While (i > 0)
{
If (i % 2 == 0) // n is even
{
B = b * b;
I = i / 2;
}
Else
{
R = r * b;
I--;
}
}
System.out.println("r = " + r) ;
A) 16.0
B) 128.0
C) 4096.0
D) 65536.0
Correct Answer:
Verified
Q4: What is the output of the following
Q13: What are the values of i and
Q40: What is the outcome of the following
Q48: What does the following code snippet display?
Char
Q49: What does the following code do?
Int sum
Q55: Which of the following for loops is
Q78: What is the output of the code
Q84: Which of the following loops executes exactly
Q102: What is the output of this loop?
Int
Q119: What is the last output line of
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents