Question: Given that x = 7, y = 2, and z = 4, the following if block will display TRUE. if (x>y && y>z) System.out.print(TRUE); True
Given that x = 7, y = 2, and z = 4, the following if block will display "TRUE".
if (x>y && y>z)
System.out.print("TRUE");
True
False
To add number to sum, you write (Note: Java is case-sensitive)
| number += sum; | ||
| number = sum + number; | ||
| sum = Number + sum; | ||
| sum += number; |
The __________ method returns a raised to the power of b.
| Math.power(a, b) | ||
| Math.exponent(a, b) | ||
| Math.pow(a, b) | ||
| Math.pow(b, a) |
The __________ method returns a raised to the power of b.
| Math.power(a, b) | ||
| Math.exponent(a, b) | ||
| Math.pow(a, b) | ||
| Math.pow(b, a) |
Suppose a Scanner object is created as follows: Scanner input = new Scanner(System.in); What method do you use to read an int value?
| input.nextInt(); | ||
| input.nextInteger(); | ||
| input.int(); | ||
| input.integer(); |
What is the result of 45 / 4 ?
| 10 | ||
| 11 | ||
| 11.25 | ||
| 12 |
How many times the message will be displayed?
int count = 0;
while (count < 100) {
System.out.println("java");
}
count = count + 1;
| 0 | ||
| 99 | ||
| 100 | ||
| infinite times |
How many times is the println statement executed? for (int i = 0; i < 4; i++) {
for (int j = 0; j < i; j++) {
System.out.println(i * j);
}
}
| 4 | ||
| 6 | ||
| 10 | ||
| An error will occur. |
The following loop displays _______________. for (int a = 1; a <= 10; a++) {
if ( a % 2 == 1) {
System.out.print( a+ " ");
}
}
| 1 2 3 4 5 6 7 8 9 | ||
| 1 2 3 4 5 6 7 8 9 10 | ||
| 1 2 3 4 5 | ||
| 1 3 5 7 9 |
What will be displayed by the following program? int x = 0;
int a = 5;
int b = 8; int c = 6;
if ( a > c ){ x = 1;
}else {
if ( b > c ) { x = 2; }else{ x = 3;
} }
System.out.print(x);
| 1 | ||
| 2 | ||
| 3 | ||
| None of the above. |
Which of the following is a valid name for a variable?
| 2ndtest | ||
| second-test | ||
| second.test | ||
| second_test |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
