Which of the following are NOT Java primitive data types?
-String
-float
-Random
-boolean
-char
-int
-Array
-Math
-double
-class correct answers String, Random, Array, Math, class
What is a logic error?
a. an error that occurs when a program is running because, for example, the wrong operator was
used.
b. an error in a statement that does not conform to the syntax of the programming language.
c. an error in the hardware from overheating
d. an error introduced by the compiler when it guesses at how to fix a syntax error correct
answers a
Which of the following errors represents a part of a program that is incorrect according to the
rules of the programming language?
a. syntax errors
,b. run-time errors
c. logic errors
d. out-of-memory errors correct answers a
Which one of the following statements can be used to convert a string str to a double?
a. double n = str.parseDouble();
b. double n = Integer.parseDouble(str);
c. double n = Double.parseDouble(str);
d. double n = double.parseDouble(str); correct answers c
Which of the following java literals have the data type boolean?
-123
-3f
-3.14
- -3
-'a'
-"3.0"
-'\n'
-3.14f
-true
-false
-"true"
, -3.0 correct answers true, false
Which of the following Java literals have the data type String?
-123
-3f
-3.14
- -3
-'a'
-"3.0"
-'\n'
-3.14f
-true
-false
-"true"
-3.0 correct answers "3.0", "true"
When the following expression is evaluated, the result will be what Java data type?
5/3
int
float
double
boolean
char
String