nerdexam
SalesforceSalesforce

PDI · Question #101

PDI Question #101: Real Exam Question with Answer & Explanation

The correct answer is B: Use the System,Limit classto monitor the current CPU governor limit consumption.. To manage governor limits and ensure data integrity in resource-intensive Apex operations, a developer should monitor CPU consumption and use savepoints for transaction control.

Submitted by packet_pusher· Apr 18, 2026Logic and Process Automation

Question

A developer has identified a method in an Apex class that performs resource intensive actions in memory by iterating over the result set of a SOQL statement on the account. The method also performs a DML statement to save the changes to the datadase. Which two techniques should the developer implement as a best practice to ensure transaction control and avoid exceeding governor limits? Choose 2 answers

Options

  • AUse partial DML statements to ensure only valid data is committed.
  • BUse the System,Limit classto monitor the current CPU governor limit consumption.
  • CUse the Database,Savepoint method to enforce database integrity.
  • DUse the Reedonly annotation to bypass the number of rows returned by a SOQL.

Explanation

To manage governor limits and ensure data integrity in resource-intensive Apex operations, a developer should monitor CPU consumption and use savepoints for transaction control.

Common mistakes.

  • A. Partial DML statements (e.g., Database.insert with allOrNone=false) can commit valid data but do not inherently ensure transaction control for preceding operations or prevent governor limits.
  • D. The @readonly annotation (not Reedonly) is used for Visualforce pages to bypass SOQL row limits but is not applicable for general Apex methods performing DML and resource-intensive actions in memory to avoid CPU limits or ensure transaction control.

Concept tested. Apex governor limits, transaction control, DML

Reference. https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_limits.htm

Topics

#Governor Limits#Apex DML#Transaction Control#Savepoint API

Community Discussion

No community discussion yet for this question.

Full PDI PracticeBrowse All PDI Questions