nerdexam
Salesforce

PDII · Question #82

PDII Question #82: Real Exam Question with Answer & Explanation

Sign in or unlock PDII to reveal the answer and full explanation for question #82. The question stem and answer options stay visible for context.

Question

What is a potential design issue with the following code? trigger accountTrigger on Account (before update){ Boolean processOpportunity = false; List<opportunity> opptysClosedLost = new List<opportunity>() List<opportunity> IstAllOpp = [select StageName from Opportunity where accountId IN :Trigger.newMap.keySet()]; if(!IstAllOpp.isEmpty()) processOpportunity = true; while(processOpportunity) { for(opportunity o : IstAllOpp) if(o.StageName == 'Closed - Lost') opptysClosedLost.add(o); processOpportunity = false; if(!opptysClosedLost.isEmpty()) delete opptysClosedLost;

Options

  • ASOQL could be avoided by creating a formula field for StageName in Account from the related
  • BThe code will result in a System.LimitException : Too many script statements error
  • CThe code will result in a System.DmlException:Entity_is_Deleted error
  • DThe code will result in a System.LimitException: Apex CPU time limit exceeded error

Unlock PDII to see the answer

You've previewed enough free PDII questions. Unlock PDII for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full PDII Practice