Bài 1-6
Bài 1-6
25 Point)
What is the exact output of the following code?
double area = 3.5;
System.out.print("area");
System.out.print(area);
A. 3.53.5
B. 3.5 3.5
*C. area3.5
D. area 3.5
2. (0.25 Point)
What is the exact output of the following code?
System.out.print(1 + 2 + “1” + 1);
*A. 311
B. Compiler error
C. 1211
D. 5
3. (0.25 Point)
Which of the following are correct names for variables according to camelCase in Java
naming conventions?
A. Radius
B. RADIUS
*C. findArea
D. FindArea
4. (0.25 Point)
Which of the following are correct ways to declare variables?
*A. int length; int width;
B. int length; width;
C. int length, int width;
D. All of the above
5. (0.25 Point)
To declare a constant MAX_LENGTH inside a method with value 99.98, you write
A. final MAX_LENGTH = 99.98;
B. final int MAX_LENGTH = 99.98;
C. double MAX_LENGTH = 99.98;
*D. final double MAX_LENGTH = 99.98;
6. (0.25 Point)
What is the result of x:
int x = 45 / 4?
A. 10
*B. 11
C. 11.25
D. 12
7. (0.25 Point)
Which of the following expression results in a value 1?
A. 2 % 1
B. 15 % 4
C. 25 % 5
*D. 37 % 6
8. (0.25 Point)
You can cast a double value to ………..
A. byte
B. short
C. int
D. long
*E. All of the above
9. (0.25 Point)
Suppose a Scanner object is created as follows: