Salesforce Platform Developer I (legacy) — Question 277
What are two use cases for executing Anonymous Apex code? (Choose two.)
Answer options
- A. To run a batch Apex class to update all Contacts
- B. To schedule an Apex class to run periodically
- C. To delete 15,000 inactive Accounts in a single transaction after a deployment
- D. To add unit test code coverage to an org
Correct answer: A, C
Explanation
The correct answers, A and C, are valid use cases for Anonymous Apex because it allows for immediate execution of code without the need for a separate class or trigger. Options B and D are incorrect as scheduling Apex classes and adding unit test coverage are not functions performed through Anonymous Apex.