Certified Platform Developer II Mock Test Free – 50 Realistic Questions to Prepare with Confidence.
Getting ready for your Certified Platform Developer II certification exam? Start your preparation the smart way with our Certified Platform Developer II Mock Test Free – a carefully crafted set of 50 realistic, exam-style questions to help you practice effectively and boost your confidence.
Using a mock test free for Certified Platform Developer II exam is one of the best ways to:
- Familiarize yourself with the actual exam format and question style
- Identify areas where you need more review
- Strengthen your time management and test-taking strategy
Below, you will find 50 free questions from our Certified Platform Developer II Mock Test Free resource. These questions are structured to reflect the real exam’s difficulty and content areas, helping you assess your readiness accurately.
A developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this?
A. Decorate the server-side method with @AuraEnabled(cacheable=true).
B. Set a cookie in the browser for use upon return to the page.
C. Call the setStorable() method on the action in the JavaScript client-side code.
D. Decorate the server-side method with @AuraEnabled(storable=true).
A customer requires that when the billing address field on an Account gets updated, the address field on all its related contact records should reflect the same update. How can this requirement be met with minimal customizations?
A. Create an After Trigger on Account to update its related contact records on update
B. Create a Workflow Rule on Account to update related child Contact records
C. Create a Lightning Process on Account to update related child Contact records
D. Create a scheduled batch job that updates all contact address fields based on the related account record
Universal Containers wants to use a Customer Community with Customer Community Plus licenses so their customers can track how many containers they are renting and when they are due back. Many of their customers are global companies with complex Account hierarchies, representing various departments within the same organization. One of the requirements is that certain community users within the same Account hierarchy be able to see several departments' containers, based on a junction object that relates the Contact to the various Account records that represent the departments. Which solution solves these requirements?
A. A Visualforce page that uses a Custom Controller that specifies without sharing to expose the records
B. A Custom List View on the junction object with filters that will show the proper records based on owner
C. A Custom Report Type and a report Lightning Component on the Community Home Page
D. An Apex Trigger that creates Apex Managed Sharing records based on the junction object’s relationships
The test method above calls a web service that updates an external system with Account information and sets the Account's Integration_Updated__c checkbox to True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts. " What is the optimal way to fix this?
A. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
B. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
C. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
D. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
A developer sees test failures in the sandbox but not in production. No code or metadata changes have been actively made to either environment since the sandbox was created. Which consideration should be checked to resolve the issue?
A. Ensure the sandbox is on the same release as production.
B. Ensure Workflow Rules are inactive.
C. Ensure the Apex Classes are on the same API version.
D. Ensure Process Builder processes are inactive.
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 statusMap = new Map{‘Customer’=>’Active’, ‘Prospect’=>’Pending’} List 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 statusMap = new Map{‘Customer’=>’Active’, ‘Prospect’=>’Pending’} List 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 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 accountUpdates = new List<Account>(); for ( Account a : [SELECT Id, Type FROM Account]){ a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; accountUpdates.add(a); } update accountUpdates;
A developer has been asked to create code that will meet the following requirements: Receives input of: Map<Id, Project_c), List Performs a potentially long-running callout to an outside web service Provides a way to confirm that the process executed successfully Which asynchronous feature should be used?
A. @future (callout=true)
B. Database.AllowCallouts interface
C. Schedulable interface
D. Queueable interface
What level can a hierarchy custom setting be defined for? (Choose three.)
A. Users
B. Groups
C. Profiles
D. Roles
E. Organization
A developer creates an application event that has triggered an infinite loop. What may have caused this problem?
A. The event handler calls a trigger
B. The event has multiple handlers registered in the project
C. An event is fired ‘ontouchend’ and is unhandled
D. The event is fired from a custom renderer
A developer is writing a complex application involving triggers, workflow rules, Apex classes, and processes. The developer needs to carefully consider the order of execution when developing the application. 1. Before Triggers 2. After Triggers 3. Post commit logic such as sending email 4. DML committed to the database 5. Workflow rules 6. Roll-up summary calculations In what order do the following operations execute?
A. 1, 2, 5, 6, 4, 3
B. 1, 5, 6, 2, 4, 3
C. 1, 2, 4, 5, 6, 3
D. 1, 6, 5, 2, 4, 3
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.
Universal Containers has an Apex trigger on Account that creates an Account Plan record when an Account is marked as a Customer. Recently a record-triggered flow was added so that whenever an Account is marked as a Customer, a ‘Customer Since’ date field is updated with today’s date. Since the addition of the flow, two Account Plan records are created whenever the Account is marked as a Customer. What might cause this to happen?
A. The flow is configured to evaluate when a record is created and every time it is edited.
B. The Apex trigger is not bulk safe and calls insert inside of a for loop.
C. The Apex trigger does not use a static variable to ensure it only fires once.
D. The flow is configured to use an ‘Update Records’ element.
A developer is integrating with a legacy on-premise SQL database. What should the developer use to ensure the data being integrated is matched to the right records in Salesforce?
A. Formula field
B. Lookup field
C. External Object
D. External Id field
Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity's Account?
A. List contactList = new List <Contact>(); for(Opportunity o : opportunityList){ Account a = [SELECT Id, (SELECT Id FROM Contacts) FROM Account WHERE Id = :o.AccountId] contactList.addAll(a.Contacts); )
B. List contactList = new List <Contact>(); Set accountIds = new Set (); for (Opportunity o : opportunityList){ contactIds.add(o.ContactId); } for(Contact c : [SELECT Id FROM Contact WHERE Id IN :contactIds]){ contactList.add(c); }
C. List contactList = new List <Contact>(); Set accountIds = new Set (); for(Opportunity o : opportunityList){ accountIds.add(o.AccountId); } for(Account a : [SELECT Id, (SELECT Id FROM Contacts) FROM Account WHERE Id IN :accountIds]){ contactList.addAll(a.Contacts); }
D. List contactList = new List <Contact>(); for ( Contact c : [SELECT Id FROM Contact WHERE AccountId IN :opportunityList.AccountId] ){ contactList.add(c); }
Example 1: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get('expr0')); } Example 2: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get('theAverage')); } Example 3: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get.AVG()); } Example 4: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug('Campaign ID' + ar.get('CampaignId')); System.debug ('Average amount' + ar.theAverage); } Which two of the examples above have correct System.debug statements? (Choose two.)
A. Example 1
B. Example 2
C. Example 3
D. Example 4
A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property.What must be done in the component to get the data from Salesforce?
A. Add the following code above record;@wire(getRecord, { recordId: ‘$recordId’, fields: ‘$fields’ })
B. Add the following code above record;@wire(getRecord, { recordId: ‘$recordId’ })Get the fields in renderedCallback() and assign them to record.
C. Add the following code above record;@api(getRecord, { recordId: ‘$recordId’ })Get the fields in renderedCallback() and assign them to record.
D. Add the following code above record;@api(getRecord, { recordId: ‘$recordId’, fields: ‘$fields’ })
A business requires that every parent record must have a child record. A developer writes an Apex method with two DML statements to insert a parent record and a child record. A validation rule blocks child records from being created. The method uses a try/catch block to handle the DML exception. What should the developer do to ensure the parent always has a child record?
A. Use addError() on the parent record if an error occurs on the child record.
B. Set a database savepoint to rollback if there are errors.
C. Use Database.insert() and set the allOrNone parameter to true.
D. Delete the parent record in the catch statement when an error occurs on the child record DML operation.
Universal Containers implements a private sharing model for the Convention_Attendee_ _c custom object. As part of a new quality assurance effort, the company created an Event_Reviewer_ _c user lookup field on the object. Management wants the event reviewer to automatically gain Read/Write access to every record they are assigned to. What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record?
A. Create a criteria-based sharing rule on the Convention Attendee custom object to share the records to a group of Event Reviewers.
B. Create an After Insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
C. Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers.
D. Create a Before Insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.
What is the transaction limit for the number of records using QueryLocator?
A. 50,000
B. 50,000,000
C. 100,000
D. 5,000,000
E. There is no limit
Choose the correct definition for .
A. Allows for controller methods to be called directly from Javascript. Must be encapsulated in tags. Unlike actionSupport, these functions can be called directly from Javascript code
B. Sends an AJAX request according to the time interval you specify. If this ever gets re-rendered, it resets
C. Adds AJAX support to another component (e.g. onClick, onMouseUp, onFocus, etc.)
D. Can be associated with an AJAX request (actionFunction/actionSupport/actionPoller) and shows content conditionally depending on the status of the request (in progress/complete). Use the “id” field to specify name; use “status” field on related components to connect them
E. Signifies which components should be processed by the server when an AJAX request is generated
A company requires an external system to be notified whenever an account is updated. trigger AccountTrigger on Account (after update){ for (Account updatedAccount:Trigger.new) { AccountTriggerHelper.notinyxternalSystem(updatedAccount.id); } } public class AccountTriggerHelperfuture(callout=true) { public static void notinyxternalSystem(Id accountId){ Account acc = [Select id, name from Account where accountId = :accountId]; http objectHttp h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint('http://example.org/ restService'); req.setMethod('POST'); req.setBody(JSON.serialize(acc)); HttpResponse res = h.send(req); } } What LimitException could the following code trigger?
A. System.LimitException: Too many future calls
B. System.LimitException: Too many callouts
C. System.LimitException: Too many SOQL queries
D. System.CalloutException: Callout from triggers are currently not supported
Recently a Salesforce org's integration failed because it exceeded the number of allowed API calls in a 24-hour period. The integration handles a near real-time, complex insertion of data into Salesforce. The flow of data is as follows: ✑ The integration looks up Contact records with a given email address and, if found, the integration adds a Task to the first matching Contact it finds. ✑ If a match is not found, the integration looks up Lead records with a given email address and, if found, the integration adds a Task to the first matching Lead it finds. ✑ If a match is not found, the integration will create a Lead and a Task for that newly created Lead. What is one way in which the integration can stay near real-time, but not exceed the number of allowed API calls in a 24-hour period?
A. Use the REST API as well as the SOAP API to effectively double the API calls allowed in a 24-hour period.
B. Create an Inbound Message that, using Flow, can do all of the logic the integration code was doing.
C. Write a custom Apex web service that, given an email address, does all of the logic the integration code was doing.
D. Create several Apex InboundEmailHandlers to accept calls from the third-party system, thus bypassing the API limits.
When the sales team views an individual customer record, they need to see recent interactions for the customer. These interactions can be sales, orders, phone calls, or Cases. The date range for recent interactions will be different for every customer record type. How can this be accomplished?
A. Use a Lightning component to query and display interactions based on record type that is passed in using a design:attribute from the Lightning page.
B. Use a dynamic form on the customer record page to display recent interactions.
C. Use batch Apex to query for the most recent interactions when the customer view screen is loaded.
D. Use Lightning Flow to read the customer’s record type, and then do a dynamic query for recent interactions and display on the View page.
An integration user makes a successful login() call via the SOAP API. What can be used in the SOAP header to provide server authorization for subsequent API requests?
A. Named Credentials
B. Session ID
C. OAuth access token
D. Security token
A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue?
A. Add a before insert trigger on Account to set the value of the required field.
B. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there.
C. Change the required field to be a validation rule that excludes the System Administrator profile.
D. Add the required field to the data setup for all of the unit tests.
If you wanted to create a record following the update of another (with data from the source object), what is the most customizable approach?
A. Workflow Rule
B. Process Builder
C. After update Trigger
D. Flow
A developer has a page with two extensions overriding the Standard controller for Case. Each extension has a method called Save. The page has a command button as defined: What will happen when a user clicks the command button?
A. All of the three Save methods will be executed
B. Save from Case Standard Controller will be executed
C. Save from CaseExtensionTwo will be executed
D. Save from CaseExtensionOne will be executed
Consider the following code snippet:Which two best practices should the developer implement to optimize this code? (Choose two.)
A. Query the Pricing_Structure__c records outside of the loop.
B. Use a collection for the DML statement.
C. Change the trigger context to after update, after insert.
D. Remove the DML statement.
A developer gets an error saying 'Maximum Trigger Depth Exceeded'. What is a possible reason to get this error message?
A. The SOQL governor limits are being hit.
B. A process Builder is running that sends mass emails.
C. There are numerous DML operations in the trigger logic.
D. A trigger is recursively invoked more than 16 times.
What is the optimal technique a developer should use to programmatically retrieve Global Picklist options in a Test Method?
A. Use the Schema namespace.
B. Use a static resource.
C. Perform a callout to the Metadata API.
D. Perform a SOQL Query.
A developer has created a solution using the SOAP API for authenticating Communities users. What is needed when issuing the login() Call? (Choose two.)
A. Organization Id
B. Session Id
C. Username and Password
D. Security Token
Consider the following code snippet, depicting an Aura component:Which two interfaces can the developer implement to make the component available as a quick action? (Choose two.)
A. force:hasRecordId
B. force:lightningQuickAction
C. force:hasSObjectName
D. force:lightningQuickActionWithoutHeader
What is the transaction limit for the number of SOSL queries?
A. 20
B. 2,000
C. 100 (synchronous), 200 (async)
D. 200 (synchronous), 100 (async)
E. There is no limit
A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory assignments are completed in the external system. What is the optimal way to update the Accounts from the external system?
A. Bulk API
B. SOAP API
C. Apex REST Web Service
D. Composite REST API
{!v.account.Name}
{!v.account.AccountNumber}
{!v.account.Industry}
Refer to the component code above. The information displays as expected (in three rows) on a mobile device. However, the information is not displaying as desired (in a single row) on a desktop or tablet.
Which option has the correct component changes to display correctly on desktops and tablets?
A. {!v.account.Name} {!v.account.AccountNumber} {!v.account.Industry}
B. {!v.account.Name} {!v.account.AccountNumber} {!v.account.Industry}
C. {!v.account.Name} {!v.account.AccountNumber} {!v.account.Industry}
D. {!v.account.Name} {!v.account.AccountNumber} {!v.account.Industry}
A company exposes a REST web service and wants to establish two-way SSL between Salesforce and the REST web service. A certificate signed by an appropriate certificate authority has been provided to the developer. What modification is necessary on the Salesforce side? (Choose two.)
A. Create an entry for the certificate in Certificate and Key Management
B. Update the code to use HttpRequest.setClientCertificateName()
C. Configure two-factor authentication with the provided certificate
D. Update the code to use HttpRequest.setHeader() to set an Authorization header
Which of the following elements can be members of a public group? (Choose three.)
A. Territories
B. Case Teams
C. Users
D. Roles
E. Profiles
When calling a RESTful web service, the developer must implement two-way SSL authentication to enhance security. The Salesforce admin has generated a self-sign certificate within Salesforce with a unique name of "ERPSecCertificate". Consider the following code snippet:Which method must the developer implement in order to sign the HTTP request with the certificate?
A. req.setHeader(‘certificate’, ‘ERPSecCertificate’);
B. req.setSecureCertificate(‘ERPSecCertificate’);
C. req.setSedure(‘ERPSecCertificate)’;
D. req.setClientCertificateName(‘ERPSecCertificate’);
An org has a requirement that the Shipping Address on the Account must be validated by a third-party web service, before the Account is allowed to be inserted. This validation must happen in real-time before the account is inserted into the system. Additionally, the developer wants to prevent the consumption of unnecessary SME statements. What is the optimal way to meet this requirement?
A. Make a callout to the web service from a custom Visualforce controller.
B. Make a callout to the web service from a before insert trigger.
C. Make a callout to the web service from a standard Visualforce controller.
D. Make a callout to the web service from an after insert trigger.
A developer is writing a Listener for implementing outbound messaging. Which three considerations must the developer keep in mind in this case? (Choose three.)
A. Messages are retried independent of their order in the queue.
B. The Organization ID is included only in the first outbound message.
C. Messages can be delivered out of order.
D. The sessionId in an outbound message is scoped for both API requests and UI requests.
E. The Listener must be reachable from the public Internet.
In which of the following scenarios would it be acceptable to use programmatic sharing instead of declarative sharing? (Choose three.)
A. Every record created by sales users needs to be visible to their respective manager
B. Poor performance when using native sharing components
C. Team functionality is required on custom objects
D. There is an existing, external system of truth for user access assignments which will continue to drive access and be integrated with salesforce
E. You need to change record access to read/write for all users utilising a lightning component
How can the DISTANCE and GEOLOCATION functions be used in SOQL queries? (Choose two.)
A. To filter results based on distance from a latitude and longitude
B. To get the distance results from a latitude and longitude
C. To order results by distance from a latitude or longitude
D. To group results in distance ranges from a latitude and longitude
A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page. Which feature of Apex code is required to facilitate this solution?
A. SOSL queries
B. describeSObjects()
C. Dynamic Schema binding
D. REST API
A developer is working on a set of custom Aura components that can be individually added to a home page. One of the components, c:searchAccounts, allows users to search for an Account and then select a specific found Account. Once selected, the other components should get other information related to the selected Account and display it. Which event should the c:searchAccounts component fire to make it known that an Account is selected?
A. An application event
B. A component event
C. A refreshView event
D. A publish event
A company has a custom object, Order__c, that has a required, unique, external ID field called Order_Number__c. Which statement should be used to perform the DML necessary to insert new records and update existing records in a List of Order__c records?
A. upsert orders;
B. upsert orders Order_Number__c;
C. merge orders Order_Number__c;
D. merge orders;
What is the transaction limit on the max Salesforce CPU time?
A. 100 seconds
B. 60 seconds
C. 100 seconds (synchronous); 200 seconds (async)
D. 10 seconds (synchronous); 60 seconds (async)
E. There is no limit
A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?
A. Report
B. User
C. Profile
D. RecordType
Which of the following variables are not transmitted in the view state? (Choose two.)
A. Private
B. Transient
C. Public
D. Static
What is the transaction limit on the number of @future invocations?
A. 100
B. 150
C. 50
D. 200
E. There is no limit
Which API can be used to execute unit tests? (Choose three.)
A. Streaming API
B. Test API
C. Tooling API
D. SOAP API
E. Metadata API
Access Full Certified Platform Developer II Mock Test Free
Want a full-length mock test experience? Click here to unlock the complete Certified Platform Developer II Mock Test Free set and get access to hundreds of additional practice questions covering all key topics.
We regularly update our question sets to stay aligned with the latest exam objectives—so check back often for fresh content!
Start practicing with our Certified Platform Developer II mock test free today—and take a major step toward exam success!