Praxis Academy

Salesforce Certified Platform Developer II practice exam

The real exam has 60 questions, lasts 120 minutes and needs 70% to pass. Start with a free 20-question diagnostic, no account needed.

Start the free diagnostic

Exam sections and weights

Sample questions

A logistics company inserts a Shipment__c record and then, in the same synchronous Apex method, calls an external carrier API with Http.send(). The call fails with "You have uncommitted work pending. Please commit or rollback before calling out." What is the best fix?

  1. Wrap the DML statement in a try/catch block so the callout can proceed.
    Catching exceptions does not commit the DML; the pending work still blocks the callout.
  2. Call Database.setSavepoint() before the insert so the work is isolated.
    A savepoint does not commit work; the transaction still has uncommitted DML when the callout runs.
  3. Move the callout into a Queueable class that implements Database.AllowsCallouts and enqueue it after the insert. (Answer)
    Correct. The Queueable runs in a separate transaction after the DML commits, so the callout is allowed.
  4. Increase the callout timeout with req.setTimeout(120000).
    The error is about pending DML, not about the callout taking too long.

A logistics company builds an LWC for the Shipment__c record page. It must call an imperative Apex method that needs the recordId as soon as the component is inserted into the DOM. Where should the developer place the call?

  1. In the constructor(), right after calling super()
    Public properties such as recordId are not yet set by the owner when the constructor runs, so the value would be undefined.
  2. In connectedCallback(), which runs when the component is inserted into the DOM (Answer)
    Correct. connectedCallback() fires after public properties are set and the component is inserted, making it the standard place for initial data loading.
  3. In renderedCallback(), guarded by no additional logic
    renderedCallback() runs after every render, so an unguarded Apex call there would execute repeatedly.
  4. In disconnectedCallback(), so the call completes before rendering
    disconnectedCallback() runs when the component is removed from the DOM, not when it is inserted.

A logistics company has a test class with a @testSetup method that inserts 50 Shipment__c records. testA deletes 10 of them and testB counts the records. What count does testB see?

  1. 40, because testA ran first and its deletes persisted
    Test methods do not share DML changes; each method's changes are rolled back before the next one runs.
  2. 50, because each test method gets a fresh copy of the @testSetup data (Answer)
    Correct. Records created in @testSetup are rolled back to their original state after each test method, so every method starts with the same data.
  3. 0, because @testSetup data is only visible to the first test method
    @testSetup data is available to every test method in the class, not only the first.
  4. It depends on the alphabetical order in which methods run
    Execution order is not guaranteed, but it does not matter here because each method is isolated.

Questions are original and follow the official exam guide. Praxis Academy is not affiliated with Salesforce, Inc.