Ask Question
23 October, 14:54

Which of the following would compile without error? A. int a = Math. abs (-5); B. int b = Math. abs (5.0); C. int c = Math. abs (5.5F); D. int d = Math. abs (5L);

+3
Answers (1)
  1. 23 October, 16:18
    0
    int a = Math. abs (-5)

    Explanation:

    Math. abs () is the function which gives the absolute value of the integer.

    syntax:

    Math. abs (int name);

    the argument enter must be integer (int).

    int b = Math. abs (5.0) : here, 5.0 is not the integer, it is float. So, it gives error.

    int c = Math. abs (5.5F) : here, 5.5F is not the integer, it is float. So, it gives error.

    int d = Math. abs (5L) : L stand for long but it is not int. So, it also gives error.

    Therefore, the correct result is int a = Math. abs (-5), - 5 is integer.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following would compile without error? A. int a = Math. abs (-5); B. int b = Math. abs (5.0); C. int c = Math. abs (5.5F); D. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers