Rounding Functions

1

What is the output of this program?

 
    class Output {
         public static void main(String args[]) {
             double x = 3.14;  
             int y = (int) Math.floor(x);
             System.out.print(y);
        }
    }
A. 0
B. 3
C. 3.0
D. 4

2

What is the output of this program?

 
    class Output {
         public static void main(String args[]) {
             double x = 3.14;  
             int y = (int) Math.ceil(x);
             System.out.print(y);
        }
    }
A. 0
B. 3
C. 3.0
D. 4

3

What is the output of this program?

    class Output {
         public static void main(String args[]) {
             double x = 3.14;  
             int y = (int) Math.abs(x);
             System.out.print(y);
        }
    }
A. 0
B. 3
C. 3.0
D. 3.1

4

What is the output of this program?

    class A {
         int x;
         int y;
         void display() {
              System.out.print(x + " " + y);
         }
    }
    class Output {
         public static void main(String args[]) {
             A obj1 = new A();
             A obj2 = new A();
             obj1.x = 1;
             obj1.y = 2;
             obj2 = obj1.clone();
             obj1.display();
             obj2.display();
        }
    }
A. 1 2 0 0
B. 1 2 1 2
C. 0 0 0 0
D. System Dependent

5

Which of function return absolute value of a variable?

A. abs()
B. absolute()
C. absolutevariable()
D. None of the mentioned