SF-PD2 Testing, Debugging, and Deployment Practice Question
Exhibit
Error: System.LimitException: Too many SOQL queries: 101
Refer to the exhibit. A developer encounters this error during a unit test. What is the most likely cause, and how should it be resolved?
⚠ Common exam trap
Candidates often focus on the specific SOQL error rather than recognizing the underlying architectural failure of non-bulkified code, which is the root cause in almost all trigger scenarios.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The trigger logic is missing a bulkified query pattern.
The 101 SOQL limit is triggered when a loop performs a query for every record in a collection. Developers should refactor code to move queries outside of loops by collecting IDs into a set and performing a single, bulkified SOQL query. This pattern is fundamental to Salesforce development, ensuring that applications remain performant and scalable regardless of the volume of data processed during transactions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The test class needs more setup data, so add more records.
Why it's wrong here
Adding more data exacerbates the issue by increasing the number of trigger executions. If the code is not bulkified, the query count will scale linearly with the number of records. The solution is not to reduce data, but to optimize the code's data access pattern.
- ✓
The trigger logic is missing a bulkified query pattern.
Why this is correct
The error indicates that the code is executing queries inside a loop, which is a classic non-bulkified anti-pattern. By refactoring to collect IDs into a collection and executing one query before the loop, the developer reduces the total SOQL count to one, staying well under the 100-query limit.
- ✗
Increase the SOQL limit by modifying the Org settings.
Why it's wrong here
Salesforce governor limits are hard-coded per transaction and cannot be increased by an administrator or developer. These limits exist to enforce multi-tenancy performance standards. Modifying the code is the only valid way to handle governor limit violations, ensuring consistent behavior across all Salesforce environments.
- ✗
Change the test class to run as a user with fewer permissions.
Why it's wrong here
Permission sets do not impact the number of SOQL queries allowed per transaction. The error is strictly related to resource consumption within the Apex execution context. Altering user permissions will not prevent the code from hitting the limit, as the logic remains inherently unoptimized for bulk operations.
Visual reference
About these practice questions
This SF-PD2 question is part of Courseiva's 226-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Salesforce exam blueprint
This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.