What does a %= 5 do to the variable a?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

What does a %= 5 do to the variable a?

Explanation:
Modulus assignment uses the remainder after division. a %= 5 replaces a with the remainder of a divided by 5, which is the same as a = a % 5. So after this operation, a holds only the part that remains when you divide by 5. For example, if a is 13, a becomes 3; if a is 20, a becomes 0. It doesn’t divide, multiply, or set a to 5 modulo a—it's specifically the remainder of a divided by 5.

Modulus assignment uses the remainder after division. a %= 5 replaces a with the remainder of a divided by 5, which is the same as a = a % 5. So after this operation, a holds only the part that remains when you divide by 5. For example, if a is 13, a becomes 3; if a is 20, a becomes 0. It doesn’t divide, multiply, or set a to 5 modulo a—it's specifically the remainder of a divided by 5.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy