Salesforce PDII Online Practice
Questions and Exam Preparation
PDII Exam Details
Exam Code
:PDII
Exam Name
:Salesforce Certified Platform Developer II (Plat-Dev-301)
Certification
:Salesforce Certifications
Vendor
:Salesforce
Total Questions
:445 Q&As
Last Updated
:Jun 19, 2026
Salesforce PDII Online Questions &
Answers
Question 51:
A company's support process dictates that any time a Case is closed with a Status of 'Could not fix,' an Engineering Review custom object record should be created and populated with information from the Case, the Contact, and any of the Products associated with the Case.
What is the correct way to automate this using an Apex trigger?
A. An after upsert trigger that creates the Engineering Review record and inserts it B. A before update trigger that creates the Engineering Review record and inserts it C. An after update trigger that creates the Engineering Review record and inserts it D. A before upsert trigger that creates the Engineering Review record and inserts it
C. An after update trigger that creates the Engineering Review record and inserts it
Explanation
In Salesforce Apex triggers, choosing the correct context (before vs. after) is critical for performance and data integrity. When the business requirement involves creating or modifying related records (records other than the one that fired the trigger), an after trigger is the platform-standard choice.
An after update trigger (Option C) is ideal here because it ensures that the Case record has been successfully validated and saved to the database (obtaining a valid timestamp and state) before the child Engineering_Review__c record is generated. Furthermore, an after trigger provides access to the read-only Trigger.new and Trigger.old maps, which contain the final field values after system validation rules and flows have run. Performing DML operations to insert a new object within a before trigger is technically possible but discouraged, as it can lead to issues if the primary record fails a subsequent system validation, potentially leaving orphaned data or causing complicated rollback scenarios.
Options A and D are incorrect because "upsert" is not a valid trigger event; the valid events are insert, update, delete, and undelete. Option B is incorrect because before triggers should primarily be used for updating fields on the same record that initiated the trigger to avoid redundant DML calls. Therefore, an after update trigger provides the most stable and scalable context for cross-object record creation.
Question 52:
Consider the following code snippet:
The Apex method is executed in an environment with a large data volume count for Accounts, and the query is performing poorly.
Which technique should the developer Implement to ensure the query performs optimally, while preserving the entire result set?
A. Annotate the method with the @Future annotation. B. Create a formula field to combine the CreatedDate and RecardType value, then filter based on the formula. C. Use the Database.queryLocator method to retrieve the accounts. D. Break down the query into two individual queries and Join the two result sets.
D. Break down the query into two individual queries and Join the two result sets.
Question 53:
A developer wants to use an Aura component with a custom action. What should be considered in order to do this?
A. A default value must be provided for each component attribute marked as required B. The class "slds-modal__container" must be added to the top-level element of the component C. The component must implement the flexipage:availableForRecordHome interface D. The component's JavaScript controller must handle a method on initialization
C. The component must implement the flexipage:availableForRecordHome interface
Question 54:
Universal Containers allows customers to log into a Salesforce Community and update their orders via a custom Visualforce page. Universal Containers' sales representatives can edit the orders on the same Visualforce page.
What should a developer use in an Apex test class to test that record sharing is enforced on the Visualforce page?
A. Use System.profllels() to test as an administrator and a community user, B. Use System.profilels() to test as a sales rep and a community user. C. Use System.runAs() to test as a sales rep and a community user. D. Use System.runAs() to test as an administrator and a community user.
C. Use System.runAs() to test as a sales rep and a community user.
Question 55:
As part of a new integration, a developer is asked to implement a new custom search functionality that is capable of performing unrestricted queries and can account for all values within a custom picklist field, type__z, on the Opportunity object. The search feature must also account for NULL values.
The organization-wide default for the Opportunity object is set to Public Read-Only, and a new custom index has been created for the Type__c field. There are more than 5 million Opportunity records within the environment and a considerable amount of the existing records have NULL values for the picklist
Which technique should the developer implement to maximize performance when querying NULL values?
A. Create a formula field that substitutes NULL values for a string of text, create an index for the formula field, then use the formula within the WHERE clause. B. Perform two SOQL queries; one to query Opportunities where Type__c - NULL, and another to query where Type_: - HBLL, then join the result set using Apex. C. Use a SOSL query to return ALL opportunities that have a value of NULL in any field. D. Use the OS operator to combine WHERE clauses to strictly search for each value within the picklist, including Type__c ` NULL.
B. Perform two SOQL queries; one to query Opportunities where Type__c - NULL, and another to query where Type_: - HBLL, then join the result set using Apex.
Question 56:
if the "PageReference.setRedirect" Apex function is set to False, 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
C. If PageReference points to the same controller and subset of extensions, postback request, otherwise get request
Question 57:
A company has code to update a Request and Request Lines and make a callout to their external ERP system's REST endpoint with the updated records.
The CalloutUtil. makeRestCallout fails with a 'You have uncommitted work pending. Please commit or rollback before calling out' error. What should be done to address the problem?
A. Change the CalloutUtil.makeRestCallout to an @InvocableMethod method. B. Remove the Database.setSavepoint and Database.rollback. C. Move the CalloutUtil.makeRestCallout method call below the catch block. D. Change the CalloutUtil.makeRestCallout to an @future method
D. Change the CalloutUtil.makeRestCallout to an @future method
Explanation
Salesforce has a strict rule: You cannot perform a synchronous web service callout after performing a DML operation in the same transaction. In the provided code, the insert operations (DML) occur first, creating "uncommitted work" in the database. When the code then tries to execute makeRestCallout, the platform throws the error to prevent a long-running callout from holding database locks open.
To resolve this, the callout must be moved to its own separate transaction. The most straightforward way to do this is to change the callout method to an @future(callout=true) method (Option D). When an @future method is called, the request is queued and executed in a new, independent transaction with its own governor limits. This decouples the database "work" from the external "callout."
Option C is incorrect because simply moving the line doesn't change the transaction context. Option B (removing savepoints) doesn't help because the DML itself is the blocker. Option A (@InvocableMethod) is used for Flow/Process Builder and doesn't inherently solve the transaction boundary issue. Using an @future method (or a Queueable class) is the standard platform-aligned solution for this error.
Question 58:
What is the optimal technique a developer should use to programmatically retrieve Global Picklist options in a Test Method?
A. Perform a callout to the Metadata API. B. Use the Schema namespace. C. Perform a SOQL Query. D. Use a static resource.
B. Use the Schema namespace.
Question 59:
A developer receives a LimitException: Too many query rows: 50001 error when running code. What debugging approach using the Developer Console provides the fastest and most accurate mechanism to identify a specific component that may be returning an unexpected number of rows?
A. Count the number of Row Limit warning messages in the Debug Logs B. Add System.debug(System.getQueryRows()) to the code to track SOQL usage C. Filter the Debug Log on SOQL_EXECUTE_END statements to track the results of each SOQL Query D. Use the Execution Overview to see the number of rows returned by each Executed Unit
C. Filter the Debug Log on SOQL_EXECUTE_END statements to track the results of each SOQL Query
Question 60:
REST uses___________.
A. The HTTP class B. The HTTPRequest class C. The HTTPResponse class D. All of the above
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Salesforce exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your PDII exam preparations
and Salesforce certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.