Certified Platform Developer II Exam Prep Free – 50 Practice Questions to Get You Ready for Exam Day
Getting ready for the Certified Platform Developer II certification? Our Certified Platform Developer II Exam Prep Free resource includes 50 exam-style questions designed to help you practice effectively and feel confident on test day
Effective Certified Platform Developer II exam prep free is the key to success. With our free practice questions, you can:
- Get familiar with exam format and question style
- Identify which topics you’ve mastered—and which need more review
- Boost your confidence and reduce exam anxiety
Below, you will find 50 realistic Certified Platform Developer II Exam Prep Free questions that cover key exam topics. These questions are designed to reflect the structure and challenge level of the actual exam, making them perfect for your study routine.
A lead developer is creating tests for a Lightning web component. The component re-renders when a property called bypassSelection changes its value. What should the developer use to test that the component re-renders successfully when the property changes?
A. Window.setInterval()
B. Window.setState()
C. dispatchEvent (new CustomEvent(‘bypassSelection’))
D. Promise.resolve()
A developer is writing a Visualforce page to display a list of all of the checkbox fields found on a custom object. What is the recommended mechanism the developer should use to accomplish this?
A. Schema Class
B. Apex API
C. Schema Builder
D. Metadata API
Which scenario requires a developer to use an Apex callout instead of Outbound Messaging?
A. The target system uses a REST API.
B. The callout needs to be asynchronous.
C. The target system uses a SOAP API.
D. The callout needs to be invoked from a Workflow Rule.
In an organization that has multi-currency enabled, a developer is tasked with building a Lightning Component that displays the top ten Opportunities most recently accessed by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user’s locale. What is the most effective approach to ensure values displayed respect the user’s locale settings?
A. Use a wrapper class to format the values retrieved via SOQL.
B. Use the FORMAT() function in the SOQL query.
C. Use the FOR VIEW clause in the SOQL query.
D. Use REGEX expressions to format the values retrieved via SOQL.
A developer has generated Apex code from a WSDL for an external web service. The web service requires Basic authentication. What code should the developer use to authenticate?
A. Http.setHeader (‘Authorization’ , ‘Basic QthZGprjpchVulHNchFtZQ’)
B. stub.inputHttpHeaders_x.put(‘Authorization’ , ‘Basic QthZGprjpchVulHNchFtZQ’)
C. Http.setAuthentication(‘Basic QthZGprjpchVulHNchFtZQ’)
D. stub.authentication.put (‘Authorization’,’Basic QthZGprjpchVulHNchFtZQ’)
Invokable methods accept sObjects as parameters.
A. True
B. False
When developing a Visualforce page that will be used by a global organization that does business in many languages and many currencies, which feature should be used? (Choose three.)
A. Custom Labels
B. convertCurrency()
C. Global Labels
D. Translation Workbenc
E. getLocalCurrency()
A developer is building a Visualforce page that interacts with external services. Which interface should the developer implement to test this functionality? (Choose two.)
A. HTTPCalloutMock
B. HTTPRequestMock
C. HTTPResponseMock
D. StaticResourceCalloutMock
A developer needs to send Account records to an external system for backup purposes. The process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web service. The web service can only receive, at most, one record per call. Which feature should be used to implement these requirements?
A. @future
B. Queueable
C. Process Builder
D. Workflow
A developer is asked to build a solution that will automatically send an email to the Customer when an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The criteria to send the email should be evaluated after all Workflow Rules have fired. What is the optimal way to accomplish this?
A. Use a MassEmailMessage() with an Apex Trigger.
B. Use a Workflow Email Alert.
C. Use an Email Alert with Process Builder.
D. Use a SingleEmailMessage() with an Apex Trigger.
A developer is building a Lightning web component that displays quantity, unit price, and the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit price.What must be added to display the total?
A. Add calculateTotal() { return quantity * unitPrice; } to the JavaScript and Total: {calculateTotal()}in the template.
B. Add get total() { return quantity * unitPrice; } to the JavaScript and Total: {total} in the template.
C. Add Total: {multiply{quantity, unitPrice}} in the template.
D. Add Total: {quantity * unitPrice} in the template.
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
After a Platform Event is defined in a Salesforce org, events can be published via which two mechanisms? (Choose two.)
A. Internal Apps can use outbound messages.
B. External Apps require the standard Streaming API.
C. Internal Apps can use entitlement processes.
D. External Apps use an API to publish event messages.
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.
A developer is asked to find a way to store secret data with an ability to specify which profiles and users can access which secrets. What should be used to store this data?
A. Static resources
B. Custom metadata
C. Custom settings
D. System.Cookie class
A developer has created a Lightning web component that uses the getRecord wire adapter. Which three things should the developer do in a Jest test to validate the wire method is working as expected? (Choose three.)
A. Use an assert statement to validate results.
B. Import wire from lwc.
C. Use the emit() API.
D. Create a JSON file with mock data.
E. Import getRecord from lightning/uiRecordApi.
Which two objects can be inserted in the same transaction? (Choose two.)
A. Opportunity and User
B. Account and AccountShare
C. Case and CaseComment
D. Account and Group
A large company uses Salesforce across several departments. Each department has its own Salesforce Administrator. It was agreed that each Administrator would have their own sandbox in which to test changes. Recently, users notice that fields that were recently added for one department suddenly disappear without warning. Also, Workflows that once sent emails and created tasks no longer do so. Which two statements are true regarding these issues and resolution? (Choose two.)
A. The administrators are deploying their own Change Sets, thus deleting each other’s fields from the objects in production.
B. A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production.
C. Page Layouts should never be deployed via Change Sets, as this causes Workflows and Field-level Security to be reset and fields to disappear.
D. The administrators are deploying their own Change Sets over each other, thus replacing entire Page Layouts and Workflows in Production.
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. A final class with multiple methods
C. An interface and implementing classes
D. Apex Describe Schema methods
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.
Universal Containers uses Big Objects to store almost a billion customer transactions called Customer_Transaction__b. These are the fields on Customer_Transaction__b: Account__c - Program__c - Points_Earned__c - Location__c - Transaction_Date__c - The following fields have been identified as Index Fields for the Customer_Transaction__b object: Account__c, Program__c, and Transaction_Date__c. Which SOQL query is valid on the Customer_Transaction__b Big Object?
A. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__b WHERE Account__c = ‘001R000000302D3′ AND Program__c =’Shoppers’ AND Transaction_Date__c=2019-05-31T00:00Z
B. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__b WHERE Account__c = ‘001R000000302D3’ AND Program__c LIKE ‘Shop%’ AND Transaction_Date__c=2019-05-31T00:00Z
C. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__b WHERE Account__c = ‘001R000000302D3’ AND Program__c INCLUDES (‘Shoppers’, ‘Womens’) AND Transaction_Date__c=2019-05-31T00:00Z
D. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__b WHERE Account__c = ‘001R000000302D3’ AND Program__c EXCLUDES (‘Shoppers’, ‘Womens’) AND Transaction_Date__c=2019-05-31T00:00Z
A developer encounters an error that states that the Apex heap size is exceeded. Which technique may reduce heap size?
A. Add the transient keyword to the variable definition
B. Move the variable definition inside the scope of the function
C. Use static variables instead of instance variables
D. Use SOQL for loops instead of standard SOQL queries
Universal Container needs to integrate with an external system. Every time an Account record is updated to meet certain criteria, a SOAP message must be sent to a third party end-point with the following information: Name, Industry, AccountNumber, and Rating. The lead developer for the org is considering using Workflow rules instead of Apex triggers to fulfill the above requirements. What are three benefits of using Workflow rules as opposed to Apex triggers? (Choose three.)
A. A SOAP message can send more than 100 notifications
B. Two-way SSL is supported by including a client certificate
C. Outbound messages prevent circular changes out-of-the-box
D. Retry logic for outbound messages is enabled out-of-the-box
E. Tracking outbound message delivery is enabled out-of-the-box
A company has the Lightning Component above that allows users to click a button to save their changes and redirects them to a different page. Currently, when the user hits the Save button the records are getting saved, but they are not redirected. Which three techniques can a developer use to debug the JavaScript? (Choose three.)
A. Enable Debug Mode for Lightning components for the user.
B. Use console.log() messages in the JavaScript.
C. Use Developer Console to view debug log.
D. Use the browser’s dev tools to debug the JavaScript.
E. Use Developer Console to view checkpoints.
Which statement is true regarding both Flow and Lightning Process? (Choose two.)
A. Can use Apex methods with the @InvocableMethod annotation
B. Are both server-side considerations in the Order of Execution
C. Can use Apex that implements the Process.Plugin interface
D. Are able to be embedded directly into Visualforce pages
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 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
A customer has a single Visualforce page that allows each user to input up to 1500 sales forecasts and instantly view pivoted forecast calculations. Users are complaining that the page is loading slowly, and they are seeing error messages regarding heap and view state limits. What are three recommendations to optimize page performance? (Choose three.)
A. Segregate calculation functionality from input functionality
B. Specify the list of sales forecasts as transient
C. Implement pagination and reduce records per page
D. Create formula fields to compute pivoted forecast calculations
E. Use JavaScript Remoting instead of controller actions
A developer writes a Lightning web component that displays a dropdown list of all custom objects in the org from which a user will select. An Apex method prepares and returns data to the component. What should the developer do to determine which objects to include in the response?
A. Check the getObiectType() value for ‘Custom’ or ‘Standard’ on the sObject describe result.
B. Import the list of all custom objects from @salesforce/schema.
C. Use the getCustomObjects() method from the Schema class.
D. Check the isCustom() value on the sObject describe result.
A developer has created a Visualforce page that uses a third-party JavaScript framework. The developer has decided to supply data to the JavaScript functions using JavaScript Remoting for Apex Controllers. What is the correct syntax to declare a remote method in Apex? (Choose two.)
A. @RemoteAction global static String getTable()
B. @RemoteAction global String getTable()
C. @RemoteAction public static String getTable()
D. @RemoteObject global static String getTable()
A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration is periodically reporting errors. Which change should the developer make to ensure the integration is not affected with minimal impact to business logic?
A. Remove the Apex Class from the Integration User’s Profile.
B. Use the Database method with allOrNone set to False.
C. Use a Try/Catch block after the insert statement.
D. Deactivate the Trigger before the Integration runs.
An org contains two custom objects: Building__c and Office__c. Office__c has a Lookup field to Building__c. A developer is asked to automatically populate the Number_of_Offices__c field on the Building__c object with the count of related Office__c records anytime an Office__c record is created or deleted. The developer cannot modify the field types. Which solutionmeets the requirements?
A. Flow
B. Workflow
C. Apex Trigger
D. Process Builder
Refer to the following code snippet:A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces information about Leads by wire calling getFetchLeadList when certain criteria are met. Which three changes should the developer implement in the Apex class above to ensure the LWC can display data efficiently while preserving security? (Choose three.)
A. Use the WITH SECURITY_ENFORCED clause within the SOQL query.
B. Annotate the Apex method with @AuraEnabled(Cacheable=true).
C. Implement the with sharing keyword in the class declaration.
D. Annotate the Apex method with @AuraEnabled.
E. Implement the without sharing keyword in the class declaration.
An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary' to control this feature. The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters. What is the optimal way to implement these requirements?
A. Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger on Contact for the last name logic.
B. Write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic.
C. Write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic.
D. Write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.
A developer must create a custom pagination solution. While users navigate through pages, if the data is changed from elsewhere, users should still see the cached results first accessed. How can the developer meet these requirements?
A. Use @Cache annotation
B. Use a StandardSetController
C. Use OFFSET in SOQL queries
D. Use OFFSET WITH CACHE in SOQL queries
Consider the Apex controller above, that is called from a Lightning Aura Component. What is wrong with it?
A. Line 1: class must be global
B. Lines 1 and 6: class and method must be global
C. Line 6: method must be static
D. Line 8: method must first serialize the list to JSON before returning
A developer wrote the following method to find all the test accounts in the org:However, the test method below fails.
What should be used to fix this failing test?
A. Test.loadData to set up expected data
B. @isTear(SeeAllData=true) to access org data for the test
C. Test.fixedSearchResults() method to set up expected data
D. @testSetup method to set up expected data
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
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 tool in the Developer Console contains information on SOQL query Cardinality?
A. Checkpoints tab
B. Query Editor
C. Query Plan Tool
D. Log Inspector
E. View State Tab
A software company uses a custom object, Defect__c, to track defects in their software. Defect__c has organization-wide defaults set to private. Each Defect__c has a related list of Reviewer__c records, each with a lookup field to User that is used to indicate that the User will review the Defect__c. What should be used to give the User on the Reviewer__c record read only access to the Defect__c record on the Reviewer__c record?
A. Apex managed sharing
B. View All on Defect__c
C. Lightning web component
D. Criteria-based sharing
If the "PageReference.setRedirect" Apex function is set to True, what type of request is made?
A. Get request
B. Postback request
C. If PageReference points to the same controller and subset of extensions, postback request, otherwise get request
What is a consideration when testing batch Apex? (Choose two.)
A. Test methods must execute the batch with a scope size of less than 200 records
B. Test methods must call the batch execute() method once
C. Test methods must use the @isTest (SeeAllData=true) annotation
D. Test methods must run the batch between Test.startTest() and Test.stopTest()
A developer is tasked by Universal Containers to build out a system to track the container repair process. Containers should be tracked as they move through the repair process, starting when a customer reports an issue and ending when the container is returned to the customer. Which solution meets these business requirements while following best practices?
A. Build a mobile application using Platform Events and RFID integration to ensure proper tracking of the containers and keep the customer informed.
B. Involve a Salesforce administrator and build out a declarative solution that will be easy to maintain and likely cost less than customized development.
C. Build a customized Lightning Application using Application Events to ensure data integrity.
D. Develop a new system with automated notification to move the containers through the repair process while notifying the customer that reported the issue.
A developer is creating unit tests for code that makes SOAP web service callouts. The developer needs to insert some test data as a part of the unit tests setup. What are three actions to enable this functionality? (Choose three.)
A. Surround the callout with Test.startTest(), Test.stopTest()
B. Surround the data insertion with Test.startTest(), Test.stopTest()
C. Implement the WebServiceMock interface
D. Update code to call Test.setMock()
E. Implement the HttpCalloutMock interface
Universal Containers stores user preferences in a Hierarchy Custom Setting, User_Prefs_c, with a Checkbox field, Show_Help_c. Company-level defaults are stored at the organizational level, but may be overridden at the user level. If a user has not overridden preferences, then the defaults should be used. How should the Show_Help_c preference be retrieved for the current user?
A. Boolean show = User_Prefs__c.getValues(UserInfo.getUserId()).Show_Help__c;
B. Boolean show = User_Prefs__c.getInstance().Show_Help__c;
C. Boolean show = User_Prefs__c.Show_Help__c;
D. Boolean show = User_Prefs__c.getValues().Show_Help__c;
[FIND 'map' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead] What is a valid return type for the following SOSL query?
A. List
B. List<List>
C. List
D. List
UC Loans is a small company with a part time Salesforce administrator. UC Loans wants to create a Loan__c record whenever an Opportunity is won. What is the optimal solution for UC Loans to accomplish this?
A. Process Builder
B. Quick Action
C. Workflow Rule
D. Apex Trigger
A developer must perform a complex SOQL query that joins two objects in a Lightning component. How can the Lightning component execute the query?
A. Invoke an Apex class with the method annotated as @AuraEnabled to perform the query
B. Use the Salesforce Streaming API to perform the SOQL query
C. Create a Process Builder to execute the query and invoke from the Lightning component
D. Write the query in a custom Lightning web component wrapper and invoke from the Lightning component
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.
B.
C.
D.
Access Full Certified Platform Developer II Exam Prep Free
Want to go beyond these 50 questions? Click here to unlock a full set of Certified Platform Developer II exam prep free questions covering every domain tested on the exam.
We continuously update our content to ensure you have the most current and effective prep materials.
Good luck with your Certified Platform Developer II certification journey!