The correct answer is D. 2000.
The code will first check if num is less than or equal to 100. Since 1000 is greater than 100, the code will then check if num is greater than 500. Since 1000 is also greater than 500, the code will assign num * 3 to num, which is 2000.
Option A is incorrect because the code will not execute the first statement, which assigns num * 2 to num, since num is not less than or equal to 100.
Option B is incorrect because the code will not execute the second statement, which assigns num * 3 to num, since num is not greater than 500.
Option C is incorrect because the code will assign num * 3 to num, which is 2000.