Question: 1
A developer writes the following Apex trigger so that when a Case is closed, a single Survey record is created for that Case. The issue is that multiple Survey-c records are being created per Case. trigger CaseTrigger on Case (after insert, after update) { List createSurveys = new List(); for (Case c : trigger.new) { if (c.IsClosed && (trigger.isInsert ll trigger.isUpdate && trigger.oldMap.get(c.Id).IsClosed == false)) { createSurveys.add(new Survey__c(Case__c = c.Id)); insert createSurveys; } } What could be the cause of this issue?
Question: 2
What is a potential design issue with the following code? trigger accountTrigger on Account (before update) { Boolean processOpportunity = false; List opptysClosedLost = new List(); List lstAllOpp = [select StageName from Opportunity where accountId IN :Trigger.newMap.keySet()]; if(!lstAllOpp.isEmpty()) processOpportunity = true; while(processOpportunity) { for(opportunity o : lstAllOpp) { if(o.StageName == 'Closed - Lost') opptysClosedLost.add(o); processOpportunity = false; } } if(!opptysClosedLost.isEmpty() delete opptysClosedLost;
Question: 3
The Contact object has a custom field called "Zone." Its data type is "Text" and field length is 3. What is the outcome after executing the following code snippet in the org? List contactsToBeInserted=new List(); Contact contactInstance= new Contact(LastName='Smith', Department='Tech', Zone__c='IAD'); contactsToBeInserted.add(contactlnstance); contactInstance= new Contact(LastName='Sm1th', Department='Tech', Zone__c='PITT'); contactsToBeInserted.add(contactlnstance); Database.insert(contactsToBeInserted,true);
Question: 4
A developer needs to design a custom object that will be integrated into a back-end system. What should the developer do to ensure good data quality and to ensure that data imports, integrations, and searches perform well? Choose 2 answers
Question: 5
What is a consideration when testing batch Apex? Choose 2 answers