nerdexam
Salesforce

PDI · Question #20

Given the following Anonymous Block: Which one do you like? What should a developer consider for an environment that has over 10,000 Case records?

The correct answer is A. The transaction will fail due to exceeding the governor limit. When processing over 10,000 Case records in an anonymous block, the transaction will likely fail due to exceeding Salesforce governor limits, as LimitExceptions are uncatchable and cause transaction rollback.

Submitted by lucia.co· Apr 18, 2026Logic and Process Automation

Question

Given the following Anonymous Block:

Which one do you like? What should a developer consider for an environment that has over 10,000 Case records?

Exhibit

PDI question #20 exhibit

Options

  • AThe transaction will fail due to exceeding the governor limit.
  • BThe try/catch block will handle any DML exceptions thrown.
  • CThe transaction will succeed and changes will be committed.
  • DThe try/catch block will handle exceptions thrown by governor limits.

How the community answered

(38 responses)
  • A
    76% (29)
  • B
    16% (6)
  • C
    3% (1)
  • D
    5% (2)

Why each option

When processing over 10,000 Case records in an anonymous block, the transaction will likely fail due to exceeding Salesforce governor limits, as `LimitException`s are uncatchable and cause transaction rollback.

AThe transaction will fail due to exceeding the governor limit.Correct

Salesforce governor limits impose restrictions, such as a DML row limit of 10,000 records per transaction. Processing more than 10,000 Case records in a single anonymous block transaction will exceed this limit, causing the transaction to fail and roll back.

BThe try/catch block will handle any DML exceptions thrown.

While try/catch blocks can handle many types of Apex exceptions, they specifically cannot catch `LimitException` or `System.LimitException` which are thrown when governor limits are exceeded.

CThe transaction will succeed and changes will be committed.

A transaction attempting to modify or query over 10,000 records without proper batching or limits is almost guaranteed to hit governor limits and therefore will not succeed and commit changes.

DThe try/catch block will handle exceptions thrown by governor limits.

Try/catch blocks are ineffective against governor limit exceptions; these exceptions are uncatchable and lead to the immediate termination and rollback of the entire transaction.

Concept tested: Apex governor limits (DML, large data volumes)

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm

Topics

#Governor Limits#DML Operations#Large Data Volume#Apex Best Practices

Community Discussion

No community discussion yet for this question.

Full PDI Practice