Methods


  1. What is the process of defining more than one method in a class differentiated by method signature?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Function overloading is a process of defining more than one method in a class with same name differentiated by function signature i:e return type or parameters type and number.


  1. What is the return type of a method that does not returns any value?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Return type of an method must be made void if it is not returning any value.



  1. Which of these methods can be used to check whether the given value is a number or not?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    isNaN() methods returns true if num specified is not a number, otherwise it returns false.


  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    double num0 = 205;
    double num1 = 2;
    double num2 = Math.IEEEremainder(num0, num1);
    System.out.print(num2);

    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    IEEEremainder() returns the remainder of dividend / divisor. Here dividend is 205 and divisor is 2 therefore remainder is 1.0. It is similar to modulus – ‘%’ operator of C/C++ language.



  1. What is the output of this program?
    public class Result
    {
    public static void main(String args[])
    {
    double num =3.14;
    int p = (int) Math.toRadians(num);
    System.out.print(p);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    0