Salesforce Platform Developer I (legacy) — Question 67
What are three techniques that a developer can use to invoke an anonymous block of code? (Choose three.)
Answer options
- A. Use the SOAP API to make a call to execute anonymous code.
- B. Create a Visualforce page that uses a controller class that is declared without sharing.
- C. Run code using the Anonymous Apex feature of the Developer's IDE.
- D. Type code into the Developer Console and execute it directly.
- E. Create and execute a test method that does not specify a runAs() call.
Correct answer: A, C, D
Explanation
The correct answers are A, C, and D because these methods directly allow the execution of anonymous blocks of code. Option B does not directly execute anonymous code, and option E refers to test methods which do not invoke anonymous execution.