Sign In
Home/Salesforce/Certified Platform Developer II/Free questions

Certified Platform Developer II — Free Practice Questions

10 free sample questions from a bank of 271, with the correct answers and explanations. No signup required — start practising right now.

1A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
  • Use Javascript to move data processing to the browser instead of the controller.
  • Use the transient keywords for the List variables used in the custom controller.
  • Use lazy loading to load the data on demand, instead of the controller's constructor.
  • Use an in the page to load all of the data asynchronously.
Answer: C
2A company's support process dictates that any time a Case is closed with a Status of 'Could not fix', an Engineering Review custom object record should be created and populated with information from the Case, the Contact, and any of the Products associated with the Case. What is the correct way to automate this using an Apex trigger?
  • An after update trigger that creates the Engineering Review record and inserts it
  • A before update trigger that creates the Engineering Review record and inserts it
  • An after upsert trigger that creates the Engineering Review record and inserts it
  • A before upsert trigger that creates the Engineering Review record and inserts it
Answer: A
3A 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 II 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?
  • A user is creating the record as Closed
  • A workflow rule is firing with a Create Task action
  • A workflow rule is firing with a Field Update action
  • A user is editing the record multiple times
Answer: D
4What is a potential design issue with the following code? trigger accountTrigger on Account (before update){ Boolean processOpportunity = false; List opptysClosedLost = new List () List 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;
  • SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity
  • The code will result in a System.LimitException : Too many script statements error
  • The code will result in a System.DmlException:Entity_is_Deleted error
  • The code will result in a System.LimitException: Apex CPU time limit exceeded error
Answer: D
5The 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(contactInstance); contactInstance= new Contact (LastName='Sm1th', Department='Tech', Zone_c='PITT'); contactsToBeInserted.add(contactInstance); Database.insert (contactsToBeInserted,true);
  • Both inserts succeed and the contact record that has the Zone value of 'PI'I'I' is set to NULL
  • A partial insert succeeds and the contact record that has the Zone value 'IAD' is inserted
  • Both inserts succeed and the contact record that has the Zone value of 'PITT' is truncated
  • An unhandled DML exception is thrown and no contact records are inserted
Answer: D
6Which statement is true regarding the use of user input as part of a dynamic SOQL query?
  • Free text input should not be allowed, to avoid SOQL injection
  • The String.format() method should be used to prevent injection
  • Quotes should be escaped to protect against SOQL injection
  • The string should be URL encoded by the input form to prevent errors
Answer: C
7A developer has written the following method: static void processList(List input){ Which code block can be used to call the method?
  • processList (acc)
  • processList ([FIND 'Acme" 'RETURNING Account])
  • processList([SELECT Id, Name FROM sObject WHERE Type = 'Account'])
  • for Account acc : [SELECT Id, Name FROM Account])
Answer: D
8A 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 two.)
  • Configure a custom field as unique
  • Configure a custom field as indexed
  • Configure a custom field as external ID
  • Configure a custom field as Salesforce ID
Answer: A, C
9A developer encounters an error that states that the Apex heap size is exceeded. Which technique may reduce heap size?
  • Add the transient keyword to the variable definition
  • Move the variable definition inside the scope of the function
  • Use static variables instead of instance variables
  • Use SOQL for loops instead of standard SOQL queries
Answer: D
10A developer has a Debug method within a class, which is invoked hundreds of times. What is the optimal functionality in the Developer Console to count the number of calls made to the method?
  • The "Execution Log" Panel
  • The "Execution Stack" Panel
  • The "Executed Units" tab under the Execution Overview Panel
  • The "Execution Tree" tab under the Stack Tree Panel
Answer: C

Want the full bank of 271 questions for Certified Platform Developer II? See all practice exams.