Which of the following is a value that is written into the code of a program?
A. an assignment statement
B. a variable
C. a literal
D. an operator a literal
Which of the following is a named storage location in the computer's memory?
A. a constant
B. a literal
C. an operator
D. a variable a variable
Which of the following is not a valid Java comment?
A. /** Comment one */
B. */ Comment two /*
C. /* Comment four */
D. // Comment three */ Comment two /*
A Java source file must be saved with the extension.
A. .javac
B. .class
C. .src
D. .java .java
Which of the following is not a rule that must be followed when naming identifiers?
A. Identifiers can contain spaces.
B. The first character must be one of the letters a-z, A-Z, an underscore, or a dollar sign.
C. After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or the
digits 0-9.
D. Uppercase and lowercase characters are distinct. Identifiers can contain spaces.
Character literals are enclosed in ________ and string literals are enclosed in ________.
A. double quotes, single quotes
B. single quotes, double quotes
C. double quotes, double quotes
D. single quotes, single quotes single quotes, double quotes.
Variables are classified according to their
A. names.
B. data types.
C. locations.
D. values. data types.
What is the result of the following expression?
17 % 3 * 2 - 12 + 15
A. 105
B. 7
C. 8
D. 12 7
, What is the result of the following expression?
10 + 5 * 3 - 20
A. 5
B. -5
C. 25
D. -50 5
In the following Java statement, what value is stored in the variable name?
String name = "John Doe";
A. "name"
B. John Doe
C. the memory address where "John Doe" is located
D. the memory address where name is located the memory address where "John Doe" is
located.
What is the value of z after the following statements have been executed?
int x = 4, y = 33;
double z;
z = (double) (y / x);
A. 8.0
B. 0
C. 4
D. 8.258.0
What output will be displayed as a result of executing the following code?
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ", y = " + y);
A. x = 37, y = 5
B. x = 9, y = 52
C. x = 160, y = 80
D. x = 32, y = 4 x = 37, y = 5
Which of the following statements will correctly convert the data type, if x is a float and y is a
double?
Select one:
A. x = float y;
B. x = (float)y;
C. x = <float>y;
D. x = y; x = (float)y;
Which of the following statements is invalid?
A. double r = 9.4632e15;