Salesforce Certified Platform Developer II practice exam

Try 5 Platform Developer II practice questions with the answer, a plain-language explanation, and a link to the official source for each one.

Try the sample questionsJoin the beta free

Free during the beta: practice this exam and 20 others for 60 days.

The real exam: 60 questions, 120 minutes, 70% to pass. Official exam guide

Try 5 sample questions

One question from each of the most heavily weighted topics. Pick an answer and check it, the way you would inside TrailScout.

  1. Question 1 of 5

    Advanced Developer Fundamentals

    A maximum discount percentage needs an org-wide default, a different value for everyone on the Sales Manager profile, and overrides for a few named users. Apex code must get the value that applies to the user who runs it, and a cleanup class must delete a user's override in Apex when that user changes teams. Which configuration store should the developer use?

    Show the answer and explanation

    Correct answer: B. A hierarchy custom setting with a default value plus values for the profile and each named user

    Custom settings can be configured as a hierarchy where values are made available to specific users, profiles, or org levels, and custom settings support full CRUD operations in Apex, so the cleanup class can delete an override. Custom metadata types handle list data and don't support hierarchy type data based on user, profile, or org level, and Apex can create, read, and update their records but not delete them. The list custom setting is the tempting choice because Apex can delete its records, but it's the hierarchy configuration that makes custom settings values available to specific users, profiles, or org levels.

    Read from the source: Trailhead : Get Started with Custom Metadata Types
  2. Question 2 of 5

    Performance

    To see Lightning web component changes right away, a developer deselected "Enable secure and persistent browser caching to improve performance" in a sandbox's Session Settings. Those Session Settings were later deployed to production with a release. Since the release, users report that Lightning Experience pages load noticeably slower. What should the developer do?

    Show the answer and explanation

    Correct answer: D. Select the setting again in production and keep it selected there, deselecting it only in development

    Lightning Experience uses secure data caching in the browser to improve page performance by avoiding additional round trips to the server. Disabling secure and persistent browser caching has a significant negative performance impact on Lightning Experience, so the setting should always be enabled in production orgs; turning it off is a development convenience for seeing code changes without emptying the cache or waiting for it to expire. Turning it off for a short window after each release is the tempting compromise, but the guidance is to always enable it in production.

    Read from the source: Trailhead : Work with Salesforce Data
  3. Question 3 of 5

    Process Automation, Logic, and Integration

    Cloud Kicks' onboarding class, saved at API version 59.0, inserts an Account for each new sales territory. For each new sales rep, the team wants to add one more DML operation to the same method and transaction, without moving any work to another transaction. Which operation can run in the same transaction as the Account insert without a mixed DML error?

    Show the answer and explanation

    Correct answer: B. Insert a User record for the new sales rep with its UserRoleId field set to null

    DML on certain setup sObjects can't be mixed with DML on non-setup sObjects such as Account in the same transaction, and the page lists GroupMember, PermissionSetAssignment, and UserRole among them. For User, the page allows an insert in a transaction with other sObjects in Apex code saved using API version 15.0 and later when UserRoleId is specified as null. GroupMember is the tempting choice, but a group member can be inserted with other sObjects only in legacy code saved using API version 14.0 and earlier.

    Read from the source: Salesforce Developers : sObjects That Can’t Be Used Together in DML Operations
  4. Question 4 of 5

    Testing, Debugging, and Deployment

    AccountSync.pushAccounts() builds an HttpRequest and sends it with Http.send(). For its test, the developer wrote AccountSyncMock, a class that implements HttpCalloutMock and returns a canned 200 response from respond(HTTPRequest). Which sequence in the test method makes pushAccounts() receive the canned response?

    Show the answer and explanation

    Correct answer: C. Call Test.setMock(HttpCalloutMock.class, new AccountSyncMock()), then call AccountSync.pushAccounts()

    Test.setMock takes HttpCalloutMock.class as its first argument and a new instance of the mock class as its second, and the test calls it before the method that makes the callout. After that point, if an HTTP callout is invoked in test context, the callout isn't made and the test receives the response built in AccountSyncMock's respond() method. The most tempting wrong choice passes AccountSyncMock.class first, but the first argument is HttpCalloutMock.class, and the implementing class goes in only as the new instance in the second argument.

    Read from the source: Salesforce Developers : Testing HTTP Callouts by Implementing the HttpCalloutMock Interface
  5. Question 5 of 5

    User Interface

    A Lightning web component calls createRecord to insert an Account and, after that promise resolves, calls createRecord again to insert an Opportunity for the new Account. When the Opportunity insert fails a validation rule, the Account stays in the org. Both inserts must now succeed or fail together in a single transaction. What should the developer do?

    Show the answer and explanation

    Correct answer: A. Move both inserts into one Apex method and call it from the component

    The Data Guidelines page says each createRecord, updateRecord or deleteRecord call is an independent transaction and that to work with multiple records in a single transaction you use Apex; its example of a transactional operation is creating an Account and an Opportunity associated with it, where if either create fails, the entire transaction is rolled back. Moving only the Opportunity insert into Apex is the tempting fix, but the Account's createRecord call is still its own transaction, so the Account is saved even when the Opportunity fails. Running the createRecord calls in Promise.all() or deleting the Account afterward still leaves separate transactions.

    Read from the source: Salesforce Developers : Data Guidelines

175 more questions are waiting.

The full Platform Developer II practice exam has 180 questions, study sessions, full-length exam simulations, and a Detour Deck that collects the questions you miss.

One free beta pass covers this exam and 20 others for 60 days.

Join the beta free today

Practice, review, and know what to study next.

  1. 1

    Answer first

    Choose an answer, then compare it with the explanation and official source.

  2. 2

    Read from the source

    Every explanation links to the official documentation it is based on.

  3. 3

    Focus where you missed

    Your results show accuracy by topic, and missed questions go to your Detour Deck.

TrailScout practice question with one answer ruled out
TrailScout explanation card with the official source and a Detour Deck button
TrailScout session result showing 75 percent and accuracy by topic
1. AnswerRule out choices, then pick your answer.2. ReviewRead why, with the official source one tap away.3. FocusSee your score by topic and what to study next.

Example screens from the Slack Administrator practice exam.

Platform Developer II exam topics

Topic weights from the official exam guide. TrailScout practice follows the same weights.

  • Process Automation, Logic, and Integration27%
  • User Interface20%
  • Testing, Debugging, and Deployment20%
  • Performance18%
  • Advanced Developer Fundamentals15%

About the Platform Developer II exam

How many questions are on the Salesforce Certified Platform Developer II exam?
The official exam guide lists 60 multiple-choice questions, and you have 120 minutes to finish.
What score do you need to pass the Platform Developer II exam?
The official exam guide sets the passing score at 70%.
Are these real exam questions?
No. TrailScout writes original practice questions from the official exam guide and official product documentation, and every explanation links to the official page it is based on. They are built to practice the way the exam asks, not to copy it.
What is in the full TrailScout Platform Developer II practice exam?
180 practice questions across the topics in the exam guide, study sessions and full-length exam simulations, an explanation for every choice, source links, and a Detour Deck for the questions you miss.

Ready for the full Platform Developer II practice exam?

Join free during the beta to save your progress, see your score by topic, and keep practicing until exam day.

Join the beta free today

Studying for something else? See every exam TrailScout supports

Salesforce Platform Developer II Practice Exam: Free Sample Questions | TrailScout