Java Test 3 Part A

32 Questions | Attempts: 55
Please wait...
Question 1 / 33
🏆 Rank #--
Score 0/100

1. Int x = -7;
int y = 3;
!(3*x < 4*y) && (5*x >=y)

The result of this expression will be

Submit
Please wait...
About This Quiz
Java Test 3 Part A - Quiz

This section consists of 20 questions.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. An expression containing the || operator is true if either or both of its operands are true.

Submit

3. An else must always have a corresponding if.

Submit

4. 0.025 >= 0.333

The result of relational operations will be

Submit

5. The loop counter in a for loop is altered after the loop body is executed in a given iteration.

Submit

6. The expression ((x > y) && (a < b)) is true if either x > y is true or a < b is true.

Submit

7. Consider the following switch statement:

int x = 3;
switch (power)
{
   case 0 : io.writeInfo("1");
                break;
   case 1 : io.writeInfo(x);
                break;
   case 2 : io.writeInfo(x * x);
                break;
   case 3 : io.writeInfo(x * x * x);
                break;
   case 4 : io.writeInfo(x * x * x * x);
                break;
   default : io.writeInfo("No match exists for this power");
}//END switch

What will be displayed by the code if power = 1?

Submit

8. The loop body of the do/while loop will be executed at least ___ time(s).

Submit

9. The continue statement is used to immediately terminate a loop.

Submit

10. Consider the following switch statement:

int x = 3;
switch (power)
{
   case 0 : io.writeInfo("1");
                break;
   case 1 : io.writeInfo(x);
                break;
   case 2 : io.writeInfo(x * x);
                break;
   case 3 : io.writeInfo(x * x * x);
                break;
   case 4 : io.writeInfo(x * x * x * x);
                break;
   default : io.writeInfo("No match exists for this power");
}//END switch

What will be displayed by the code if power = 2?

Submit

11. The continue statement is used to skip over a single loop iteration.

Submit

12. (-6<0) && (12 >= 10)

The result of this operation will be

Submit

13. A do/while loop is a post-test loop.

Submit

14. Consider the following segment of code:

if (x>=0)
   if (x<10)
   {
       y = x * x;
       if (x<=5)
           x = x - 2;
    } //END if x < 10
    else
       y = 10 + x;
else
   y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);

What will be displayed by the program if x = 4?

Submit

15. When using a switch statement in Java, a no-match condition results in an error.

Submit

16. (5!=5)&&(3<6)

The result of this operation will be

Submit

17. Consider following program segment.

int a = 1;
while (17 % a != 5)
{
    System.out.println(a + "  " + 17 % a);
    ++a;
}// END while

How many times will the loop be executed?

Submit

18. Consider the following switch statement:

int x = 3;
switch (power)
{
   case 0 : io.writeInfo("1");
                break;
   case 1 : io.writeInfo(x);
                break;
   case 2 : io.writeInfo(x * x);
                break;
   case 3 : io.writeInfo(x * x * x);
                break;
   case 4 : io.writeInfo(x * x * x * x);
                break;
   default : io.writeInfo("No match exists for this power");
}//END switch

What will be displayed by the code if power = 0?

Submit

19. How many times is the following loop executed?

for (int x=0; x <= 10; ++x)
     System.out.println("This is a for loop.");

Submit

20. Consider the following segment of code:

if (x>=0)
   if (x<10)
   {
       y = x * x;
       if (x<=5)
           x = x - 2;
    } //END if x < 10
    else
       y = 10 + x;
else
   y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);

What will be displayed by the program if x = -5?

Submit

21. The default case is required in the switch selection statement.

Submit

22. Which of the following is NOT an iteration control structure in Java?

Submit

23. How many times will the following loop execute?

int x = 1;
do
{
   System.out.println("This is a do/while loop");
   ++x;
}while(x >= 0);

Submit

24. Consider the following segment of code:

if (x>=0)
   if (x<10)
   {
       y = x * x;
       if (x<=5)
           x = x - 2;
    } //END if x < 10
    else
       y = 10 + x;
else
   y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);

What will be displayed by the program if x = 6?

Submit

25. Consider the following program segment

int b = 2;
do {
    System.out.println(b + "  " + b/5);
    b = b + 2;
}while ( b != 20);

How many times will the loop be executed?

Submit

26. A statement that can be inserted at the end of a switch statement to protect against invalid entries is the ___________ statement

Submit

27. The loop body of the while loop will be executed at least ____ time(s)

Submit

28. Suppose that you have two nested loops. The inner loop executes five times and the outer loop executes ten times. How many total iterations are there within the nested loop structure?

Submit

29. Consider the following segment of code:

if (x>=0)
   if (x<10)
   {
       y = x * x;
       if (x<=5)
           x = x - 2;
    } //END if x < 10
    else
       y = 10 + x;
else
   y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);

What will be displayed by the program if x = 0?

Submit

30. How many times is the following loop executed?

for ( int x = 0; x > 0; ++x)
    System.out.println("This is a for loop.");

Submit

31. Determine the output generated by the following program segment.

int number = 1;
int product = 1;
do {
   ++ number;
   product = product * number;
} while ( number < 5);
io.writeInfo("The product is: " + product);

Submit

32. Consider the following segment of code:

if (x>=0)
   if (x<10)
   {
       y = x * x;
       if (x<=5)
           x = x - 2;
    } //END if x < 10
    else
       y = 10 + x;
else
   y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);

What will be displayed by the program if x = 10?

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (32)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Int x = -7;int y = 3;!(3*x < 4*y) && (5*x >=y)The result...
An expression containing the || operator is true if either or both of...
An else must always have a corresponding if.
0.025 >= 0.333The result of relational operations will be
The loop counter in a for loop is altered after the loop body is...
The expression ((x > y) && (a < b)) is true if either x...
Consider the following switch statement:int x = 3;switch (power)...
The loop body of the do/while loop will be executed at least ___...
The continue statement is used to immediately terminate a loop.
Consider the following switch statement:int x = 3;switch (power)...
The continue statement is used to skip over a single loop iteration.
(-6<0) && (12 >= 10)The result of this operation...
A do/while loop is a post-test loop.
Consider the following segment of code:if (x>=0)   if...
When using a switch statement in Java, a no-match condition results in...
(5!=5)&&(3<6)The result of this operation will be
Consider following program segment.int a = 1;while (17 % a !=...
Consider the following switch statement:int x = 3;switch (power)...
How many times is the following loop executed?for (int x=0; x <=...
Consider the following segment of code:if (x>=0)   if...
The default case is required in the switch selection statement.
Which of the following is NOT an iteration control structure in Java?
How many times will the following loop execute?int x = 1;do...
Consider the following segment of code:if (x>=0)   if...
Consider the following program segmentint b = 2;do {   ...
A statement that can be inserted at the end of a switch statement to...
The loop body of the while loop will be executed at least ____ time(s)
Suppose that you have two nested loops. The inner loop executes five...
Consider the following segment of code:if (x>=0)   if...
How many times is the following loop executed?for ( int x = 0; x >...
Determine the output generated by the following program segment.int...
Consider the following segment of code:if (x>=0)   if...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!