New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce DEX-450 Exam - Topic 12 Question 43 Discussion

Actual exam question for Salesforce's DEX-450 exam
Question #: 43
Topic #: 12
[All DEX-450 Questions]

A developer uses a before insert trigger on the Lead object to fetch the Territory__c object, where the Territory__c.PostalCode__c matches the Lead.PostalCode. The code fails when the developer uses the Apex Data Loader to insert 10,000 Lead records. The developer has the following code block: Line-01: for (Lead l : Trigger.new){Line-02: if (l.PostalCode != null) {Line-03: List<Territory__c> terrList = [SELECT Id FROM Territory__c WHERE PostalCode__c = :l.PostalCode];Line-04: if(terrList.size() > 0) Line-05: l.Territory__c = terrList[0].Id; Line-06: }Line-07: }Which line of code is causing the code block to fail?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Mozell
4 months ago
Really? I thought you could update it in triggers.
upvoted 0 times
...
Pamella
4 months ago
Line-05 is also a problem, you can't modify Lead in a before insert.
upvoted 0 times
...
Nettie
4 months ago
Wait, can’t you just bulkify it? Seems like a simple fix.
upvoted 0 times
...
Hyun
4 months ago
I agree, that will hit governor limits fast!
upvoted 0 times
...
Sommer
4 months ago
Line-03 is definitely the issue, SOQL in a loop is a no-go.
upvoted 0 times
...
Rory
5 months ago
I recall something about not being able to update the Lead in a before insert trigger, which makes me think Line-05 could be the culprit.
upvoted 0 times
...
Tula
5 months ago
I think Line-02 could cause a NullPointer exception if PostalCode is null, but I'm not completely confident about that.
upvoted 0 times
...
Shaquana
5 months ago
I'm not entirely sure, but I thought we learned that Trigger.new is valid in before insert triggers, so Line-01 might not be the issue.
upvoted 0 times
...
Monroe
5 months ago
I remember we discussed how placing a SOQL query inside a loop can lead to governor limit issues, so I think Line-03 is the problem.
upvoted 0 times
...
Junita
5 months ago
Option A seems like the obvious choice here. The whole point of cryptocurrency is that it's a decentralized digital currency, and that's made possible by the blockchain technology that acts as an immutable ledger. The other options don't really capture the core technical innovation behind crypto.
upvoted 0 times
...
Marvel
5 months ago
Hmm, I'm a little unsure about this one. I know MACRS is an accelerated depreciation method, but I can't quite recall how that impacts the total depreciation compared to straight-line. I'll need to review my notes on this topic before answering.
upvoted 0 times
...

Save Cancel