Exam CRT-450 Topic 2 Question 16 Discussion

Actual exam question for Salesforce's CRT-450 exam
Question #: 16
Topic #: 2
Management asked for opportunities to be automatically created for accounts with annual revenue greater than $1, 000,000. A developer created the following trigger on the Account object to satisfy this requirement.
for (Account a : Trigger.new) {
if (a.AnnualRevenue > 1000000) {
List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE AccountId = :a.Id]; if (oppList.size() == 0) { Opportunity oppty = new Opportunity(Name = a.Name, StageName = 'Prospecting', CloseDate = System.
today().addDays(30));
insert oppty;
}
}
}
Users are able to update the account records via the UI and can see an opportunity created for high annual revenue accounts. However, when the administrator tries to upload a list of 179 accounts using Data Loader, it fails with system, Exception errors.
Which two actions should the developer take to fix the code segment shown above?
Choose 2. answers

Suggested Answer: A,C Vote an answer

This is a classicbulkification problem, covered under"Apex Development Best Practices"in the PD1 guide.
Reference:Apex Developer Guide - Bulk Design Patterns
D (Correct):DML operations (like insert) in a loop can cause theDML 151 limiterror. Moving them outside the loop and collecting records in a list before performing a single DML operation is best practice.Reference:
Salesforce Platform Developer I Study Guide - Process Automation and Logic (30%)

by Molly at Jun 17, 2026, 01:39 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10