Ask Question
24 December, 04:16

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);

+5
Answers (1)
  1. 24 December, 07: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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers