Courseiva
← Back to Salesforce Certified Platform Developer II questions

Scenario-based practice

Refer to the Exhibit Practice Questions

Practise Salesforce Certified Platform Developer II practice questions — original exam-style scenarios covering every exam domain, with detailed explanations, wrong-answer analysis, and common exam traps.

15
scenario questions
SF-PD2
exam code
Salesforce
vendor

Scenario guide

How to approach refer to the exhibit practice questions

Practise exhibit-style questions that ask you to read a topology, table, command output or diagram before choosing the best answer.

Quick answer

Exhibit-style questions test whether you can read a topology, command output, diagram or table before choosing the best answer.

How to extract the relevant detail from an exhibit.

How topology, command output or routing information affects the answer.

How to avoid answering from memory before reading the evidence.

How to map the exhibit back to the exam objective.

Related practice questions

Related SF-PD2 topic practice pages

Scenario questions usually connect to one or more exam topics. Use these links to review the underlying concepts behind the scenario.

Practice set

Practice scenarios

Question 1mediummultiple choice
Full question →

Refer to the exhibit. A developer is reviewing a debug log for a failed transaction. What is the primary performance issue identified in the log snippet?

Exhibit

14:22:05.054 (54201234)|CUMULATIVE_LIMIT_USAGE
14:22:05.054 (54201234)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 15 out of 100
  Number of query rows: 1200 out of 50000
  Maximum CPU time: 10005 out of 10000 *CLOSE TO LIMIT*
  Maximum heap size: 2500 out of 6000000
Question 2hardmultiple choice
Full question →

Refer to the exhibit. What is the primary security advantage of using a 'Named Credential' in this callout as opposed to hardcoding the API endpoint and credentials?

Exhibit

{
  "Code": "HttpRequest req = new HttpRequest();\nreq.setEndpoint('callout:MyNamedCred/api/data');\nreq.setMethod('POST');\nreq.setBody(JSON.serialize(payload));\nHttp h = new Http();\nHttpResponse res = h.send(req);"
}
Question 3hardmultiple choice
Full question →

Refer to the exhibit. The Apex transaction is consistently hitting the CPU limit. What is the most likely cause and the best way to optimize the code?

Exhibit

{
  "apex_cpu_time": "9999ms",
  "limit": "10000ms",
  "status": "CPU_TIME_LIMIT_EXCEEDED"
}
Question 4mediummultiple choice
Full question →

Refer to the exhibit. The service is failing because the external system requires a specific 'Content-Type' header that is missing. Which addition to the code will correctly resolve this issue?

Exhibit

public class IntegrationService {
  public static void processData() {
    HttpRequest req = new HttpRequest();
    req.setEndpoint('https://api.external.com/data');
    req.setMethod('POST');
    Http h = new Http();
    HttpResponse res = h.send(req);
  }
}
Question 5hardmultiple choice
Full question →

Refer to the exhibit. A deployment is failing with this error. What is the most likely cause?

Exhibit

ERROR: [INVALID_FIELD_FOR_INSERT_UPDATE] Field: 'MyCustomField__c' is not present in target environment.
Question 6mediummultiple choice
Full question →

Refer to the exhibit. The developer needs to update this code to be more robust. What is the most critical issue to address in this code snippet?

Exhibit

{
  "apex_code": "public void updateAccount(Id accId) { 
    Account acc = [SELECT Id, Name FROM Account WHERE Id = :accId];
    acc.Name = 'New Name';
    update acc; 
  }"
}
Question 7mediummultiple choice
Full question →

Refer to the exhibit. The query is performing poorly on an object with 5 million records. What is the most likely cause, and how should it be addressed?

Exhibit

SELECT Name, Account.Name FROM Contact WHERE Account.Industry = 'Technology'
Question 8hardmultiple choice
Full question →

Refer to the exhibit. An Apex trigger is failing during a mass update of records. The developer identifies that the SOQL query is inside a loop. Which pattern must be applied to fix this error while maintaining the required functionality?

Exhibit

{
  "error": "System.LimitException",
  "message": "Too many SOQL queries: 101"
}
Question 9mediummultiple choice
Full question →

Refer to the exhibit. An integration is failing when a guest user tries to access a public-facing API. What is the most likely cause, and how should it be addressed?

Exhibit

{
  "status": 403,
  "message": "Insufficient Permissions"
}
Question 10hardmultiple choice
Full question →

Refer to the exhibit. A developer attempts a deployment using Salesforce CLI. The deployment fails with the circular dependency error shown. What is the root cause of this failure?

Exhibit

{
  "status": "failed",
  "errorCode": "CIRCULAR_DEPENDENCY_DETECTED",
  "message": "Apex Class A refers to Class B, and Class B refers to Class A.",
  "deployment_id": "0Af123456789"
}
Question 11hardmultiple choice
Full question →

Refer to the exhibit. A developer encounters this error during a unit test. What is the most likely cause, and how should it be resolved?

Exhibit

Error: System.LimitException: Too many SOQL queries: 101
Question 12hardmultiple choice
Full question →

Refer to the exhibit. The developer has implemented the security check inside the 'process' method. Why is this implementation insufficient for a secure, professional-grade enterprise application?

Exhibit

{
  "ApexClass": {
    "Name": "AccountService",
    "SharingModel": "With Sharing",
    "Method": "process(List<Account> accounts)",
    "SecurityCheck": "Schema.sObjectType.Account.isUpdateable()"
  }
}
Question 13hardmultiple choice
Full question →

Refer to the exhibit. A developer is attempting to push source code to a scratch org and encounters the error shown. The developer confirms that 'utils.js' and 'utils.js-meta.xml' exist in the 'force-app/main/default/lwc/utils/' directory. What is the most likely cause of this error?

Exhibit

sfdx force:source:push
ERROR running force:source:push: 
LWC1011: Failed to resolve import "c/utils" from "accountDetails.js". 
Please check that the file exists and is available in the workspace.
Question 14mediummultiple choice
Full question →

Refer to the exhibit. The developer observes the error above. What is the most efficient architectural change to prevent this limit from being hit?

Exhibit

{
  "apex_class": "PolicyService",
  "method": "processRecords",
  "error": "System.LimitException: Too many SOQL queries: 101"
}
Question 15mediummultiple choice
Full question →

Refer to the exhibit. A developer encounters this error while performing a bulk update of 200 Account records. What is the root cause of this exception?

Exhibit

ERROR: System.LimitException: Too many DML statements: 151
Trigger: AccountTriggerHandler
Line: 42

These SF-PD2 practice questions are part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style SF-PD2 questions with detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics.