Question: The order of precedence for mathematical operations in Java is: Question 4 options: parenthesis, addition and subtraction followed by multiplication and division parenthesis, multiplication and
The order of precedence for mathematical operations in Java is:
Question 4 options:
|
| parenthesis, addition and subtraction followed by multiplication and division |
|
| parenthesis, multiplication and division followed by addition and subtraction |
|
| multiplication and division, addition and subtraction followed by parenthesis |
|
| addition and subtraction, multiplication and division followed by parenthesis |
When Java does integer division, the result is __________.
Question 5 options:
|
| rounded up |
|
| rounded down |
|
| rounded to the nearest tenth |
|
| rounded to the nearest one hundredth |
What will be the output of the following code?
public class Output {
public static void main(String[] args) {
int hour = 11, minute = 59;
System.out.print("The current time is ");
System.out.print(hour);
System.out.print(":");
System.out.print(minute);
System.out.println(".");
}
}
Question 6 options:
|
| The current time is 11 : 59. |
|
| The current time is 11:59. |
|
| The current time is 11:59. |
|
| 11:59 |
Question 7 (1 point)
What will be the value of z after the following statements have been executed?
int x = 4, y = 33; double z; z = (double) (y / x);
Question 7 options:
|
| 8.25 |
|
| 4 |
|
| 8 |
|
| 8.0 |
Question 8 (1 point)
Mathematical expressions in Java can contain:
Question 8 options:
|
| Numbers only |
|
| Variable names only |
|
| Operators only |
|
| Operators, Numbers and variable names |
Question 9 (1 point)
What is the result of the following expression?
10 + 5 * 3 - 20
Question 9 options:
|
| -5 |
|
| 5 |
|
| 25 |
|
| -50 |
Question 10 (1 point)
Saved
What will be displayed when the following code is executed?
public class Output {
public static void main(String[] args) {
final int x = 22;
int y = 4;
x += y;
System.out.println("x = " + x + ", y = " + y);
}
}
Question 10 options:
|
| x = 22, y = 4 |
|
| x = 22, y = 26 |
|
| x = 22, y = 88 |
|
| Nothing, this is an error |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
