A) double x = 0;
Double s = 1;
For (int k = 1; s > 0.01; k++)
{
S = 1.0 / (k * k) ;
X = x + s;
}
B) double x = 0;
Double s = 1;
For (int k = 1; k < 100; k++)
{
S = 1.0 / (k * k) ;
X = x + s;
}
C) double x = 0;
Double s = 1;
Int k = 10;
While (s > 0.01)
{
S = 1.0 / (k * k) ;
X = x + s;
K++;
}
D) double x = 0;
Double s = 10;
Int k = 1;
While (s > 0.01)
{
S = 1.0 / (k * k) ;
X = x + s;
K++;
Correct Answer
verified
Multiple Choice
A) The code fragment will display the interest calculated for nine years.
B) The code fragment will continue to display the calculated interest forever because the loop will never end.
C) The code fragment will not display the calculated interest and halt abruptly.
D) The code fragment will not display any output because it will not compile.
Correct Answer
verified
Multiple Choice
A) 1 time
B) 2 times
C) 3 times
D) 4 times
Correct Answer
verified
Multiple Choice
A) I only
B) II only
C) I and II only
D) I, II, and III
Correct Answer
verified
Multiple Choice
A) abcd
B) bcde
C) bcbcd
D) cdef
Correct Answer
verified
Multiple Choice
A) for (i = 1; i != n; i++)
B) for (years = n; years < 0; years--)
C) for (i = 1; i <= n; i++)
D) for (int i = 1; i <= 10; i++)
Correct Answer
verified
Multiple Choice
A) 1 End
B) 1 End (infinite loop)
C) 1 2 3 4 5 6 7 8 End
D) 1 2 3 4 5 6 7 8 End (infinite loop)
Correct Answer
verified
Multiple Choice
A) 10 9 8 7 6 5
B) 10 8 6 4
C) 10 8 6
D) 10 8
Correct Answer
verified
Multiple Choice
A) It is usually faster than just running the code.
B) It is the best way to design an algorithm.
C) You must already have a working program in order to do it.
D) It gives valuable insight that you do not get by running the code.
Correct Answer
verified
Multiple Choice
A) No output
B) No output (infinite loop)
C) 12345
D) 2345
Correct Answer
verified
Multiple Choice
A) The average of all the integers in the input
B) The sum of all the positive integers in the input divided by the number of integers in the input
C) The average of all the positive integers in the input
D) The second smallest value in the input
Correct Answer
verified
Multiple Choice
A) 4
B) 5
C) 10
D) 15
Correct Answer
verified
Multiple Choice
A) Yes, it is legal but does not print anything.
B) Yes, it is legal and prints "Do you think in Java?" once.
C) Yes, it is legal and prints "Do you think in Java?" twice.
D) No, it is not legal and gives a compilation error.
Correct Answer
verified
Multiple Choice
A) No output.
B) Hello will be displayed 10 times.
C) Hello will be displayed 9 times.
D) Hello will be displayed infinite times.
Correct Answer
verified
Multiple Choice
A) 1 3 5
B) 1 3 9
C) 1 3 5 7 9
D) 1 3 5 9
Correct Answer
verified
Multiple Choice
A) 0 and 20
B) 1 and 20
C) 0 and 19
D) 1 and 19
Correct Answer
verified
Multiple Choice
A) r = 16.0
B) r = 128.0
C) r = 4096.0
D) r = 65536.0
Correct Answer
verified
Multiple Choice
A) sum != 0
B) sum <= 100
C) sum > 100
D) sum == 100
Correct Answer
verified
Multiple Choice
A) j=27
B) j=12
C) j=13
D) j=14
Correct Answer
verified
Multiple Choice
A) Between 1 and 49
B) Between 0 and 50
C) Between 0 and 49
D) Between 1 and 50
Correct Answer
verified
Showing 1 - 20 of 128
Related Exams