Question: I need help with the following assingment in Java. Match the following terms to the definition below. Note that there are more terms than definitions.
I need help with the following assingment in Java.
Match the following terms to the definition below. Note that there are more terms than definitions.
!
&&
||
<
=
break
continue
else
dowhile
for
if
static
switch
while
Which term from the above word bank matches each description below?
1) This operator can be used to ensure that two conditions must both be true
2) These methods perform common tasks and do not require objects
3) This statement selects among multiple actions based on the possible values of an integer variable or expression, or a String
4) This statement specifies all the details of counter-controlled repetition in its header
5) The body of this loop always executes at least once
6) This unary operator reverses the value of a condition
7) A cases statements typically end with what statement
Answer the following questions:
8) What errors are present in the following code snippet:
int j;
For (j = 10, j >= 1, j++)
System.out.println(j);
9) How many times does the following loop execute?
int i;
for ( i = 19; i >= 1; i -= 2 )
System.out.println( i );
10) What does the following code output?
int i;
int j;
for (i = 1; i < 3; i++)
for (j = 1; j < 4; j++)
System.out.print("%d ", (i * j));
11) What is the output of the following code?
int x = 0;
do
{
System.out.println(x);
x++;
} while (x > 10);
12) What is the output of the following code?
int value = 0;
switch ( value )
{
case 0:
System.out.println( "zero" );
case 1:
System.out.println( "one" );
}
13) Let i = 1, j = 2, k = 3 and m = 2.Evaluate each of the following (true or false).
a) i == 1
b) ( i >= 1 ) && ( j < 4 )
c) ( j >= i ) || ( k == m )
d) ( k + m < j ) | ( 3 - j >= k )
e) !( k > m )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
