Free Certified Platform Developer II Exam Braindumps (page: 27)

Page 26 of 107

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;

  1. SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity
  2. The code will result in a System.LimitException : Too many script statements error
  3. The code will result in a System.DmlException:Entity_is_Deleted error
  4. The code will result in a System.LimitException: Apex CPU time limit exceeded error

Answer(s): D



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<Contact> contactsToBeInserted=new List<Contact>(); Contact contactInstance= new Contact(LastName='Smith', Department='Tech', Zone_c='IAD'); contactsToBeInserted.add(contactInstance); contactInstance= new Contact (LastName='Sm1th', Department='Tech', Zone_c='PITT'); contactsToBeInserted.add (contactInstance); Database.insert(contactsToBeInserted,true);

  1. Both inserts succeed and the contact record that has the Zone value of 'PI'I'I' is set to NULL
  2. A partial insert succeeds and the contact record that has the Zone value 'IAD' is inserted
  3. Both inserts succeed and the contact record that has the Zone value of 'PITT' is truncated
  4. An unhandled DML exception is thrown and no contact records are inserted

Answer(s): D



Which statement is true regarding the use of user input as part of a dynamic SOQL query?

  1. Free text input should not be allowed, to avoid SOQL injection
  2. The String.format() method should be used to prevent injection
  3. Quotes should be escaped to protect against SOQL injection
  4. The string should be URL encoded by the input form to prevent errors

Answer(s): C



A developer has written the following method:

static void processList(List<sobject> input){

Which code block can be used to call the method?

  1. processList (acc)
  2. processList ([FIND 'Acme" 'RETURNING Account])
  3. processList([SELECT Id, Name FROM sObject WHERE Type = 'Account'])
  4. for Account acc : [SELECT Id, Name FROM Account])

Answer(s): D






Post your Comments and Discuss Salesforce Certified Platform Developer II exam with other Community members:

Exam Discussions & Posts