Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
floating-point
:
Content language: English
Русский
What is the result of the following code execution? public class Main { public static void main(String[] args) { String value = "29.1"; System.out.println((Float.valueOf(value) + 1.0) == 30.1); System.out.println((Double.valueOf(value) + 1.0) == 30.1); System.out.println(Float.valueOf(value) / 0); System.out.println(Double.valueOf(value) / 0); } }
floating-point
What is the result of the following code compilation and execution? public class Test { public static void main(String[] args) { float f = 1.0 + 1.0f; f = f + 1; System.out.println(f / 0); } }
floating-point
As a result of compiling of which lines there will be a compilation error: public class Main { public static void main(String[] args) { int v1 = 081; //1 int v2 = 0x81; //2 float v3 = 0x81; //3 float v4 = 0.81; //4 byte v5 = 0x81; //5 } }
floating-point
What lines will not cause a compilation error?
floating-point
What will be the result of the following code execution? public class Main { public static void main(String[] args) { double d = Math.sqrt(-1); System.out.println(Double.NaN == d); d = d / 0; System.out.println(Double.isNaN(d)); } }
floating-point
What will be the result of the following program compilation and execution? import java.text.NumberFormat; class Main { public static void main(String[] args) { float f = 123.45678f; NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(2); System.out.println(numberFormat.format(f)); } }
floating-point
What will be the result of compilation of the following code: double big = 1.0e307 * 2000 / 2000; System.out.println( big == 1.0e307 );
floating-point
What will be the result of execution of following statements? double x = 2./0; double y = -1/0.; System.out.print(x + y);
floating-point
What will be the result of running the following code? public class Test { public static void main(String[] args){ float x = 0, y = 0; x = (float) (0.3 + 0.4); y = 0.3f + 0.4f; System.out.println(x==y); } }
floating-point
Variables of which types can have value NaN?
floating-point
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes