SF-PD2 Testing, Debugging, and Deployment Practice Question
Exhibit
Error: System.LimitException: Too many SOQL queries: 101 Line: 45, Column: 1 Stack Trace: MyTriggerHandler.processData(MyTriggerHandler.java:45) MyTriggerHandler.afterInsert(MyTriggerHandler.java:12) MyTriggerHandler.execute(MyTriggerHandler.java:5)
Refer to the exhibit. A developer encounters this LimitException in a bulkified trigger. What is the most likely cause based on the provided stack trace?
⚠ Common exam trap
Candidates often blame the data volume or the complexity of the query, missing the fundamental architectural flaw of placing a query inside a trigger iteration loop.
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
✓
A SOQL query is being executed inside a 'for' loop that iterates over the Trigger.new collection.
The LimitException indicating 'Too many SOQL queries' signifies that the code is executing a SOQL query inside a loop. This is a common performance bottleneck in Apex. Proper bulkification requires moving queries outside of loops by gathering IDs into a Set or List, then performing a single query. Mastering bulkification is essential for passing the PD2 exam and writing scalable enterprise applications.
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 trigger is running on a massive dataset, exceeding the total record processing limit of 50,000 records.
Why it's wrong here
The error specifically references the SOQL query limit, which is 100 queries per transaction, not a record processing limit. While processing many records can lead to governor limit issues, the specific '101' count points directly to repetitive query execution within the logic flow.
- ✓
A SOQL query is being executed inside a 'for' loop that iterates over the Trigger.new collection.
Why this is correct
Performing a SOQL query inside a loop is the primary cause for exceeding the 100-query governor limit. Each iteration triggers a new database request, and after 100 iterations, the transaction terminates. Moving the query outside the loop and utilizing Map-based retrieval is the standard solution.
- ✗
The trigger is calling a static method that is performing a DML operation on the same object causing recursion.
Why it's wrong here
Recursion typically causes 'Maximum stack depth' errors or DML limit exceptions. While recursion can lead to multiple query executions, the specific error 'Too many SOQL queries: 101' is the definitive signature of placing queries inside an iterative loop structure during a transaction.
- ✗
The system is experiencing temporary resource contention due to excessive concurrent users in the organization.
Why it's wrong here
Governor limits in Salesforce are per-transaction, not aggregate metrics based on concurrent user load. The limit is enforced regardless of external traffic, meaning code that works for one record will fail if it violates the per-transaction limit when processing multiple records or loops.
About these practice questions
Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.