aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Practice Test - 10
  • Which statement is true given the following? Double d = M...
Multiple choice

Which statement is true given the following? Double d = Math.random();

  1. 0.0 < d <= 1.0

  2. 0.0 <= d < 1.0

  3. Compilation fail

  4. Cannot say.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Math.random() method returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0

Keep practicing — related questions

  • What two statements are true about the result obtained from calling Math.random()? 1. The result is less th...
  • What values can be generated by the following code: (int) (Math.random() * 3)
  • What will be the output of the program? int i = (int) Math.random();
  • What is the value of d that will be printed out. public class Test { public final static void main(String[]...
  • What will be the output of the program? public class SqrtExample { public static void main(String [] args) ...
  • Which statement below is true?
  • What happens when this is in your code? double x; x=24.0/0;
  • class C { public static void main(String[] args) { double d1 = Math.floor(0.5); double d2 = Math.floor(1.5)...
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy