Question Detail

COM 101 COM 101 Past Questions Objective Question

Question

The statement i = i - 1 means
Options
A i equal i-1
B i-1 goes to i
C i is equivalent to i-1
D i-1 is assigned to i
Correct Answer
Correct Answer

Option D is the correct answer.

Detailed Explanation

In programming, the assignment operator '=' means 'assign the value on the right to the variable on the left'. So 'i = i - 1' calculates the value of 'i - 1' and then assigns that result back to the variable 'i'.

Hint

It's an assignment, not a mathematical equality.

Question Info