Computer Programming Exam 2
Questions and Answers Graded A+
What will the following code print?: int count; for (count = 10; count > 6; count--)
System.out.print(count + " "); - Correct answer-10 9 8 7
What is the value of the expression (x > 3) || (y < 3) if x has the value 1 and y has
the value 5? - Correct answer-The value of this expression is False
The body of any while loop will be executed at least once. - Correct answer-False
(body will be executed at least once)
Every statement with if must also include else - Correct answer-False, every if
statement will not also include "else".
What is output by the following code?
int p = 4; int m = 30, j; for (j = 1; j < p; j++);
{ m = m + j * j; } System.out.println(m); - Correct answer-34
An ! in an expression means: - Correct answer-Not
A do-while loop will loop at least once. - Correct answer-(false) do while
©COPYRIGHT 2025, ALL RIGHTS RESERVED 1
Questions and Answers Graded A+
What will the following code print?: int count; for (count = 10; count > 6; count--)
System.out.print(count + " "); - Correct answer-10 9 8 7
What is the value of the expression (x > 3) || (y < 3) if x has the value 1 and y has
the value 5? - Correct answer-The value of this expression is False
The body of any while loop will be executed at least once. - Correct answer-False
(body will be executed at least once)
Every statement with if must also include else - Correct answer-False, every if
statement will not also include "else".
What is output by the following code?
int p = 4; int m = 30, j; for (j = 1; j < p; j++);
{ m = m + j * j; } System.out.println(m); - Correct answer-34
An ! in an expression means: - Correct answer-Not
A do-while loop will loop at least once. - Correct answer-(false) do while
©COPYRIGHT 2025, ALL RIGHTS RESERVED 1