Question 1 · 279 in bank
A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
Show answer
Answer: C
Salesforce Certified Platform Developer II279 questions across 28 pages are complete and free, with no account or card.
279 questions in this bank
Free access · progress saved on this device
A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
Answer: C
A custom object Trainer_c has a lookup field to another object Gym_c. Which SOQL query will get the record for the Viridian Gym and all it’s trainers?
Answer: D
A 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?
Answer: A
Before Trigger: In case of validation check in the same object. Update the same object. After Trigger: Insert/Update related object, not the same object. Notification Email.
Source: Adapted from community discussion — rufusroffie
Given the following Apex statement: Account myAccount = [SELECT Id, Name FROM Account]; What occurs when more than one Account is retuned by the SOQL query?
Answer: B
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<Survey_c> createSurveys = new List<Survey_c>(); 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?
Answer: C
Answer is C. As the workflow field update, makes the trigger to run again, and in the same transaction instance, so trigger creates second record.
Source: Adapted from community discussion — Sri_Vathsa
The OrderHelper class is a utility class that contains business logic for processing orders. Consider the following code snippet: public class without sharing OrderHelper( //code implementation } A developer needs to create a constant named DELIVERY_MULTIPLIER with a value of 4.15. The value of the constant should not change at any time in the code. How should the developer declare the DELIVERY_MULTIPLIER constant to meet the business objectives?
Answer: B
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;
Answer: D
Here is a better format of the code in case someone else wants to compare: 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;} The design flaw is that neither loop is necessary, a proper query could have collected the correct records to begin with and then delete them.
Source: Adapted from community discussion — lorenac2
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);
Answer: D
no contacts will be inserted: System.DmlException: Insert failed. First exception on row 1; first error: STRING_TOO_LONG, Zone: data value too large: PITT (max length=3): [Zone__c]
Source: Adapted from community discussion — drwebber
Which annotation should a developer use on an Apex method to make it available to be wired to a property in a Lightning web component?
Answer: C
Which statement is true regarding the use of user input as part of a dynamic SOQL query?
Answer: C
Keyboard:J Kmove between questionsA–Dselect an answerRshow or hide the answer← →change page
PD2 practice, question 1. 279 questions available.
Version 1.0.0. How we source questions