nerdexam
Salesforce

PDII · Question #303

The following code segment is called from a trigger handler class from the Opportunity trigger: Which two changes should improve this code and make it more efficient? (Choose two.)

The correct answer is A. Move the DML outside of the for loop. C. Move the SOQL to fetch the account record outside of the for loop. See the full explanation below for the reasoning.

Question

The following code segment is called from a trigger handler class from the Opportunity trigger:

Which two changes should improve this code and make it more efficient? (Choose two.)

Exhibit

PDII question #303 exhibit

Options

  • AMove the DML outside of the for loop.
  • BUse Trigger.old instead of Trigger.new.
  • CMove the SOQL to fetch the account record outside of the for loop.
  • DMove the business logic inside the Opportunity trigger.

How the community answered

(22 responses)
  • A
    82% (18)
  • B
    9% (2)
  • D
    9% (2)

Community Discussion

No community discussion yet for this question.

Full PDII Practice