Java - Java.lang Class

Java - Java.lang Class
1. What is the value of "d" after this line of code has been executed?
double d = Math.round ( 2.5 + Math.random( ));
  • 2
  • 3
  • 4
  • 2.5
Show Answer
2. Which of the following would compile without error?
  • int a = Math.abs(-5);
  • int b = Math.abs(5.0);
  • int c = Math.abs(5.5F);
  • int d = Math.abs(5L);
Show Answer
3.  Which of the following are valid calls to
Math.max?
Math.max(1,4)
Math.max(2.3, 5)
    Math.max(1, 3, 5, 7)
    Math.max(-1.5, -2.8f)
  • 1, 2 and 4
  • 2, 3 and 4
  • 1, 2 and 3
  • 2, 3 and 4
Show Answer
4. public class Myfile
{
    public static void main (String[] args)
    {
        String biz = args[1];
        String baz = args[2];
        String rip = args[3];
        System.out.println("Arg is " + rip);
    }
}

Select how you would start the program to cause it to print: Arg is 2
  • java Myfile 222
  • java Myfile 1 2 2 3 4
  • java Myfile 1 3 2 2
  • java Myfile 0 1 2 3
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test