The modulus operator (%) in Java can be used only with variables of integer type.

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, you need to understand the modulus operator (%) in Java and the types of variables it can be used with.

The modulus operator (%) in Java calculates the remainder of one number divided by another. While it is commonly used with integer types, it can also be used with other data types such as floating-point numbers (e.g., double and float).

So, the statement "The modulus operator (%) in Java can be used only with variables of integer type" is incorrect.

Let's go through each option to understand why it is correct or incorrect:

Option A) True - This option is incorrect because the modulus operator (%) in Java can be used with variables of other types, not just integer types.

Option B) False - This option is correct because the statement "The modulus operator (%) in Java can be used only with variables of integer type" is false.

The correct answer is B) False.

Find more quizzes: