Questions and CORRECT Answers
Which of the following are valid Java Identifiers? Choose all that apply.
00xTrick
Test Variable
a555c
java_&_point
SpEcIaL_vAlUe
sum & difference
Tax
a-javapoint
age1
1AGE - CORRECT ANSWER - a555c
SpEcIaL_vAlUe
Tax
age1
What will be the output of this code?
int x = 10;
int y = 13;
int a = y;
y = x;
x = a;
System.out.print(x); - CORRECT ANSWER - 13
Given the following int (integer) variables, a = 7, b = 1, c = 4, d = 15, evaluate the expression:
,a * (b + c) / d + 2 - CORRECT ANSWER - 4
Evaluate this logical expression:
false || true - CORRECT ANSWER - True
Evaluate this expression:
8 + 6 <= 10 || 10 - 10 > 3 - CORRECT ANSWER - False
Which of the following are NOT Java primitive data types?
class
Random
Math
char
real
int
String
float
boolean
Array - CORRECT ANSWER - class
Random
Math
real
String
Array
, When the following expression is evaluated, the result will be what Java data type?
-61f + 49
1) int
2) float
3) double
4) boolean
5) char
6) String
7) none of these - CORRECT ANSWER - 2) float
Which of the following would be the best data type for a variable to store the average score on
the final exam?
int
none of these
String
boolean
char
float - CORRECT ANSWER - float
Method overloading distinguishes between methods based on _____. - CORRECT
ANSWER - parameter types or number of parameters in a class
The Java keyword used to declare that a method does not return a value is _____. - CORRECT
ANSWER - void