Given the following code, what is the output?
public class MysteriousClass
{
public static void main(String[] args)
{
int i = 20;
int b = m2(i) ;
System.out.println(b + i) ;
}
public static int m1(int i)
{
int n = 0;
while (n * n <= i)
{
n++;
}
return n - 1;
}
public static int m2(int a) {
int b = 0;
for (int n = 0; n < a; n++)
{
Int i = m1(n) ;
b = b + i;
}
return b;
}
}
A) 50
B) 60
C) 70
D) 80
Correct Answer:
Verified
Q50: What is wrong with the following code?
Public
Q51: Given the following code, which method call(s)
Q52: A programmer notices that the following code
Q53: What is wrong with the following code?
Public
Q54: Which of the following is the best
Q56: What is wrong with the following code?
Public
Q57: A programmer notices that the following code
Q58: What is the problem with the definition
Q59: You need to write a method that
Q60: Which of the following code snippets can
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