I'm going through some of the sample exams online and I'm seeing questions that seem rather ridiculously difficult. i.e.:
class V {
public static void main (
String[] args) {
System.out.print(Float.POSITIVE_INFINITY % 2 + ",");
System.out.print(Float.NEGATIVE_INFINITY % 2 + ",");
System.out.print(2 % Float.NEGATIVE_INFINITY);
}
}
What is the result of attempting to compile and run the above program?
a. Prints: NaN,NaN,NaN
b. Prints: NaN,NaN,2.0
c. Prints: NaN,NaN,2
d. Prints: 2.0,2.0,2.0
e. Prints: 2,2,2
f. Runtime error
g. Compiler error
h. None of the above
Can I really expect questions on the exam like this?
Is this really
testing my knowledge of
Java or just how Java handles obscure number situations, ones I'm likely never to encounter???