次のコード スニペットの結果は何でしょうか? public word doWork(Account acct) { for (Integer i = 0; i <= 2007 i++) { insert acct; }
正解:D
* The doWork method inserts an account for every iteration of the for loop, which runs from i = 0 to i <= 200, inclusive. * This results in 201 iterations, and hence 201 accounts are inserted into the org. Explanation of Code Behavior: * The loop condition i <= 200 runs 201 times (0 to 200). * The insert acct; statement is executed 201 times. References: * Apex Developer Guide - Loop Constructs