Looking for more? Click here to get the full PDF with 231+ practice questions for $10 for offline study and deeper preparation.
Question 1
A developer is tasked with creating an application-centric feature on which end-users can access and update information. This feature must be available in Lightning Experience while working seamlessly in multiple device form factors, such as desktops, phones, and tables. Additionally, the feature must support Addressable URL Tabs and interact with the Salesforce Console APIs. What are two approaches a developer can take to build the application and support the business requirements? (Choose two.)
A. Create the application using Lightning Web Components wrapped in Aura Components
B. Create the application using Aura Components wrapped in Lightning Web Components
C. Create the application using Lightning Experience Builder
D. Create the application using Aura Components
Show Answer
Correct Answer:
A. Create the application using Lightning Web Components wrapped in Aura Components
D. Create the application using Aura Components
Question 2
Which of the follow be used together in DML operations (transaction)? (Choose two.)
A. Account - AccountShare
B. Case - CaseComment
C. Opportunity - User
D. Account - Order
Show Answer
Correct Answer:
A. Account - AccountShare
B. Case - CaseComment
Question 3
A Salesforce org has more than 50,000 contacts. A new business process requires a calculation that aggregates data from all of these contact records. This calculation needs to run once a day after business hours. Which two steps should a developer take to accomplish this? (Choose two.)
A. Use the @future annotation
B. Implement the Schedulable interface
C. Implement the Database.Batchable interface
D. Implement the Queuable interface
Show Answer
Correct Answer:
B. Implement the Schedulable interface
C. Implement the Database.Batchable interface
Question 4
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;
A. SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity
B. The code will result in a System.LimitException : Too many script statements error
C. The code will result in a System.DmlException:Entity_is_Deleted error
D. The code will result in a System.LimitException: Apex CPU time limit exceeded error
Show Answer
Correct Answer:
D. The code will result in a System.LimitException: Apex CPU time limit exceeded error
Question 5
Employee_c is a Child object of Company_c. The Company_c object has an external Id field Company_Id_c. How can a developer insert an Employee_c record linked to Company_c with a Company_Id_c of '999'?
A. Employee_c emp = new Employee_c(Name='Developer'); emp.Company_r = '999' insert emp;
B. Employee_c emp = new Employee_c(Name='Developer'); emp.Company_c = '999' insert emp;
C. Employee_c emp = new Employee_c(Name='Developer'); emp. Company_c = new Company_c(Company_Id_c='999') insert emp;
D. Employee_c emp = new Employee_c(Name='Developer'); emp.Company_r = new Company_r(Company_Id_c='999') insert emp;
Show Answer
Correct Answer:
C. Employee_c emp = new Employee_c(Name='Developer'); emp. Company_c = new Company_c(Company_Id_c='999') insert emp;
Question 6
The Account edit button must be overridden in an org where a subset of users still uses Salesforce Classic. The org already has a Lightning Component that will do the work necessary for the override, and the client wants to be able to reuse it. How should a developer implement this?
A. Override the edit button for both Lightning and Classic with a Lightning Component
B. Override the edit button for both Lightning and Classic with a new Visualforce page
C. Override the edit button for Lightning with a Lightning Page, and for Classic, override the edit button with a Visualforce page that contains the Lightning Component
D. Override the edit button for Lightning with a Lightning Component, and for Classic, override the edit button with a Visualforce page that contains the Lightning Component
Show Answer
Correct Answer:
C. Override the edit button for Lightning with a Lightning Page, and for Classic, override the edit button with a Visualforce page that contains the Lightning Component
Question 7
An org has a requirement that addresses on Contacts and Accounts should be normalized to a company standard by Apex code any time that they are saved. What is the optimal way to implement this?
A. Apex trigger on Contact that calls the Account trigger to normalize the address
B. Apex triggers on Contact and Account that normalize the address
C. Apex trigger on Account that calls the Contact trigger to normalize the address
D. Apex triggers on Contact and Account that call a helper class to normalize the address
Show Answer
Correct Answer:
D. Apex triggers on Contact and Account that call a helper class to normalize the address
Question 8
A developer has a requirement to query three fields (Id, Name, Type) from an Account and First and Last names for all Contacts associated with the Account. Which option is the preferred optimized method to achieve this for the Account named ‘Ozone Electronics’?
A. Account a = [SELECT ID, Name, Type FROM Account WHERE name=‘Ozone Electronics’]; list lContacts = [SELECT firstname, lastname FROM Contact WHERE accounted=:a.ID];
B. Account a = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts) FROM Account WHERE name=‘Ozone Electronics’ LIMIT 1];
C. list lContacts = new list(); for (Contact c :[SELECT firstname, lastname, Account.Name, Account.ID, Account.Type FROM Contact WHERE Account.Name=‘ozone electronics’]) ( lContacts.add(c); )
D. list lAccounts = [SELECT ID, Name, Type FROM Account JOIN (SELECT ID, firstname, lastname FROM Contact WHERE contact.account.name = ‘ozone electronics’)];
Show Answer
Correct Answer:
B. Account a = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts) FROM Account WHERE name=‘Ozone Electronics’ LIMIT 1];
Question 9
The Account edit button must be overridden in an org where a subset of users still use Salesforce Classic. The org already has a Lightning Component that will do the work necessary for the override, and the client wants to be able to reuse it. How should a developer implement this?
A. Override the edit button for both Lightning and Classic with a Lightning Component
B. Override the edit button for both Lightning and Classic with a new Visualforce page
C. Override the edit button for Lightning with a Lightning Page, and Classic with a Visualforce page that contains the Lightning Component
D. Override the edit button for Lightning with a Lightning Component, and Classic with a Visualforce page that contains the Lightning Component
Show Answer
Correct Answer:
C. Override the edit button for Lightning with a Lightning Page, and Classic with a Visualforce page that contains the Lightning Component
Question 10
Which three Visualforce components can be used to initiate Ajax behavior to perform partial page updates? (Choose three.)
A. <apex:actionSupport>
B. <apex:commandLink>
C. <apex:actionStatus>
D. <apex:commandButton>
E. <apex:form>
Show Answer
Correct Answer:
A. <apex:actionSupport>
B. <apex:commandLink>
D. <apex:commandButton>
Question 11
Ursa Major Solar has a custom object, ServiceJob_c, with an optional Lookup field to Account called Partner_Service_Provider_c. The TotalJobs_c field on Account tracks the total number of ServiceJob_c records to which a partner service provider Account is related. What should be done to ensure that the TotalJobs_c field is kept up to date?
A. Create an Apex trigger on ServiceJob_c
B. Change TotalJobs_c to a roll-up summary field
C. Implement a workflow cross-object field update
D. Build a Process Builder with an invocable action
Show Answer
Correct Answer:
A. Create an Apex trigger on ServiceJob_c
Question 12
Universal Containers (UC) calculates commissions on their Opportunities in different ways base on complex rules that vary depending on the line of business of the Opportunity. Whenever a new line of business is added to Salesforce at UC, it is likely that a different calculation will need to be added too. When an Opportunity's stage is changed to Closed/Won, its commission should be calculated in real time. What should a developer use so that different implementations of the commission calculation can be invoked on the stage change?
A. An Apex class with a custom enum
B. final class with multiple methods
C. An interface and implementing classes
D. Apex Describe Schema methods
Show Answer
Correct Answer:
C. An interface and implementing classes
Question 13
A developer is asked to update data in an org based on new business rules. The new rules state that Accounts with the type set to 'Customer' should have a status of 'Active', and Accounts with the type set to 'Prospect' should have a status of 'Pending'. No other changes to data should be made. Which code block will accurately meet the business requirements?
A. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( statusMap.containsKey(a.Type) ) { a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; } accountUpdates.add(a); } update accountUpdates;
B. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account WHERE Status IN :statusMap.keySet()]){ a.Status = statusMap.get(a.Type); accountUpdates.add(a); } update accountUpdates;
C. List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( String.isNotBlank(a.Type) && a.Type == 'Customer' ){ a.Status = 'Active'; } if ( String.isNotBlank(a.Type) && a.Type == 'Prospect' ){ a.Status = 'Pending'; } accountUpdates.add(a); } update accountUpdades;
D. List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; accountUpdates.add(a); } update accountUpdates;
Show Answer
Correct Answer:
A. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'} List<Account> accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( statusMap.containsKey(a.Type) ) { a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; } accountUpdates.add(a); } update accountUpdates;
Question 14
Which annotation exposes an Apex class as a RESTful web service?
A. @AuraEnabled
B. @HttpInvocable
C. @RestResource
D. @RemoteAction
Show Answer
Correct Answer:
C. @RestResource
Question 15
A company wants to incorporate a third-party web service to set the Address fields when an Account is inserted, if they have not already been set. What is the optimal way to achieve this?
A. Create a Process, call an Apex @future(callout=true) method from it, and make the callout from that Apex method
B. Create a Process, call an Apex @InvocableMethod from it, and make the callout from that Apex method
C. Create an after insert trigger, call an Apex @InvocableMethod method from it, and make the callout from that Apex method
D. Create an after insert trigger, call an @future(callout=true) method from it, and make the callout from that Apex method
Show Answer
Correct Answer:
D. Create an after insert trigger, call an @future(callout=true) method from it, and make the callout from that Apex method
Question 16
Invokable methods accept sObjects as parameters.
A. True
B. False
Show Answer
Correct Answer:
A. True
Question 17
Choose the correct definition for <apex:pageMessage>.
A. Standard Salesforce formatting, throws a specific message on a page
B. Standard Salesforce formatting, shows all errors that occur on page. Can add more messages through the "ApexPages.addMessage" function
C. single message, without formatting, that can be associated with a specific component on the page
D. No formatting; displays all errors on a page
Show Answer
Correct Answer:
A. Standard Salesforce formatting, throws a specific message on a page
Question 18
What is a benefit of JavaScript remoting over Visualforce Remote Objects?
A. Allows for specified re-render targets
B. Does not require any Apex code
C. Does not require any JavaScript code
D. Supports complex server-side application logic
Show Answer
Correct Answer:
D. Supports complex server-side application logic
Question 19
A developer created a custom component to display an HTML table. The developer wants to be able to use the component on different Visualforce Pages and specify different header text for the table. Which tag should the developer use inside the component?
A. <apex:variable>
B. <apex:define>
C. <apex:param>
D. <apex:attribute>
Show Answer
Correct Answer:
D. <apex:attribute>
Question 20
A company recently deployed a Visualforce page with a custom controller that has a data grid of information about Opportunities in the org. Users report that they receive a `Maximum view state size limit` error message under certain conditions. According to Visualforce best practice, which three actions should the developer take to reduce the view state? (Choose three.)
A. Use the transient keyword in the Apex controller for variables that do not maintain state
B. Use the final keyword in the controller for variables that will not change
C. Use the private keyword in the controller for variables
D. Refine any SOQL queries to return only data relevant to the page
E. Use filters and pagination to reduce the amount of data
Show Answer
Correct Answer:
A. Use the transient keyword in the Apex controller for variables that do not maintain state
D. Refine any SOQL queries to return only data relevant to the page
E. Use filters and pagination to reduce the amount of data
Aced these? Get the Full Exam
Download the complete Certified Platform Developer II study bundle with 231+ questions in a single printable PDF.