Salesforce PDII Exam Prep Guide Prep guide for the PDII Exam [Q44-Q67]

Share

Salesforce PDII Exam Prep Guide: Prep guide for the PDII Exam

2026 New Preparation Guide of Salesforce PDII Exam

NEW QUESTION # 44
A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page. Which Apex code feature is required to facilitate this solution?

  • A. Dynamic SOQL
  • B. Variable binding
  • C. Metadata API
  • D. Streaming API

Answer: A

Explanation:
The requirement is to allow users to select which fields they want to filter by at runtime. In standard (static) SOQL, the fields in the WHERE clause must be defined at compile time (e.g., WHERE Name = :val).
Because the fields themselves are not known until the user interacts with the page, the developer cannot write a static query.
Dynamic SOQL is the required feature. It allows the developer to construct the SOQL query string as a text string at runtime, incorporating the specific field names selected by the user, and then execute that string using Database.query(queryString). This provides the flexibility to build queries on the fly based on user input. Metadata API is for configuration changes, Streaming API is for push notifications, and Variable binding (:var) is used in both static and dynamic SOQL but does not solve the issue of changing the field names themselves.


NEW QUESTION # 45
The head of recruiting at Universal Containers (UC) wants to provide all internal users the ability to search for open positions by role, department, and location via a new recruiting app. In addition to search, users of the app should be able to refer a friend, apply for a position, and review the status of their current submissions.
The app will be surfaced to UC's existing iOS and Android users via the standard mobile app that Salesforce provides. It has a custom user interface design and offline access is not required.
Given these requirements, what is the recommended approach to develop the app?

  • A. Visualforce
  • B. Lightning Experience Builder
  • C. Salesforce SDK
  • D. Lightning Web Components

Answer: D


NEW QUESTION # 46
A developer has a page with two extensions overriding the Standard controller for Case.
<apex:page standardController="Case" extension="CaseExtensionOne,CaseExtension Two" showHeader="false"> Each extension has a method called Save. The page has a command button as defined: <apex:commandButton value="Save" action="{!save}"/> What will happen when a user clicks the command button?

  • A. Save from CaseExtensionOne will be executed
  • B. Save from Case Standard Controller will be executed
  • C. Save from CaseExtensionTwo will be executed
  • D. All of the three Save methods will be executed

Answer: A


NEW QUESTION # 47
A developer is asked to look into an issue where a scheduled Apex is running into DML limits. Upon investigation, the developer finds that the number of records processed by the scheduled Apex has recently increased to more than 10,000.
What should the developer do to eliminate the limit exception error?

  • A. Use platform events.
  • B. Use the @future annotation.
  • C. Implement the Qususabls interface.
  • D. Implement the Batchable interface.

Answer: D

Explanation:
When scheduled Apex runs into DML limits due to a high number of records, implementing the Batchable interface is recommended. This allows the job to be broken down into smaller batches that are processed separately, thus avoiding hitting governor limits. References:
Using Batch Apex


NEW QUESTION # 48
Which of the following exceptions cannot be caught and will force an error? (Choose three.)

  • A. License exceptions
  • B. DMLException
  • C. AssertException
  • D. SObjectExceptions
  • E. ListException
  • F. LimitException

Answer: A,C,F

Explanation:
Explanation
Explanation/Reference:
Explanation:
SObjectException occurs when accessing a field not queried, or you try to change a field during the wrong dml statement (i.e. an edit-only field being set on insert) Custom exceptions must extend the "Exception" class


NEW QUESTION # 49
What is the transaction limit for the number of records for SOQL queries?

  • A. 10,000
  • B. There is no limit
  • C. 50,000
  • D. 5,000
  • E. 20,000

Answer: C


NEW QUESTION # 50
Which Salesforce feature allows a developer to see when a user last logged in to Salesforce if real-time notification is not required?

  • A. Calendar Events
  • B. Developer Log
  • C. Asynchronous Data Capture Events
  • D. Event Monitoring Log

Answer: D

Explanation:
The Event Monitoring Log is the best feature to use to see when a user last logged in to Salesforce if real-time notification is not required. The Event Monitoring Log provides detailed information about various events that occur in the org, such as logins, API calls, report exports, etc. The developer can query the LoginEvent object to get the timestamp, username, and other details of the login events. The Calendar Events, Asynchronous Data Capture Events, and Developer Log are not relevant for this scenario, as they do not capture the login information of the users. Reference: [Event Monitoring], [LoginEvent]


NEW QUESTION # 51
The Account after-update trigger fires whenever an Account's address is updated, and it updates every associated Contact with that address. The Contact after-update trigger fires on every edit, and it updates every Campaign Member record related to the Contact with the Contact's state. Consider the following: A mass update of 200 Account records' addresses, where each Account has 50 Contacts. Each Contact has one Campaign Member. This means there are 10,000 Contact records across th23e Accounts and 10,000 Campaign Member records across the contacts. What will happen when the mass update occurs?24252627

  • A. The mass update of Account address 28will succeed, but the Contact address updates wil29l fail due to exceeding number of records processed by DML statements.3031
  • B. There will be no32 error, since each trigger fires 33within its own context and each trigger does not exceed the limit of the number of records processed by DML statements.34
  • C. The mass update will fail, since the two triggers fire in the same35 context, thus exceeding the number of records.36

Answer: C

Explanation:
38
In Salesforce, all triggers that fire as a result of an initial DML operation ru39n within the same execution context and the same transaction. This means that all governor limits-such as the limit of 10,000 records processed by DML statements-are shared across the entire chain of events.
In this scenario, the transaction begins with the update of 200 Accounts. The Account trigger then attempts to update 10,000 related Contacts (50 Contacts per Account across 200 Accounts). This update of 10,000 Contacts then fires the Contact trigger, which attempts to update 10,000 related Campaign Members. When the system attempts to process these updates, the total number of records processed via DML in a single transaction will exceed the platform limit of 10,000 rows.
Even though the Account update is only 200 records, the subsequent cascading updates (10,000 Contacts +
10,000 Campaign Members) bring the total DML count to 20,200. This triggers a LimitException, and because Apex transactions are atomic, the entire operation will fail and roll back. To resolve this, the developer would need to handle these updates asynchronously (e.g., using Batch Apex or Queueable) to split the cascading updates into separate transactions with their own sets of governor limits.


NEW QUESTION # 52
How should a developer verify that a specific Account record is being tested in a test class for a visualforce controller?

  • A. Instantiate the page reference in the test class, insert the Account in the test class, then use seeAHData-true to view the Account.
  • B. Insert the Account in the test class, instantiate the page reference in the test class, then use System.currentPageReference().getParameters{}.put() to set the Account ID.
  • C. Insert the Account into Salesforce, instantiate the page reference in the test class, then use System.setParentRecordId().get() to set the Account ID.
  • D. Instantiate the page reference in the test class, insert the Account in the test class, then use System.setParentRecordld().get() to set the Account ID.

Answer: D


NEW QUESTION # 53
Which use case is an appropriate fit for the ©future asynchronous Apex method? (Choose two.)

  • A. A developer has long-running methods and needs to prevent delaying an Apex transaction
  • B. A developer has long-running jobs with large data volumes that need to be performed in batches
  • C. A developer needs to segregate DML operations and bypass the mixed save DML error
  • D. A developer has jobs that need larger query results than regular transactions allow

Answer: A,C


NEW QUESTION # 54
Consider the following code snippet:
How should <c-order> component communicate to the <c-order-order> component that an order has been selected by the user?

  • A. Create and fire a standard DOM event.
  • B. Created and fire an application event.
  • C. Create and dispatch a custom event
  • D. Create and fire a component event.

Answer: C


NEW QUESTION # 55
What should be added to the setup, in the location indicated, for the unit test above to create the controller extension for the test?
A)

B)

C)

D)

  • A. Option D
  • B. Option C
  • C. Option A
  • D. Option B

Answer: D


NEW QUESTION # 56
However, when the test runs, no data is returned and the assertion fails.
Which edit should the developer make to ensure the test class runs successfully?

  • A. Implement the without sharing keyword in the searchFeaturs Apex class.
  • B. Implement the seeAllData=true attribute in the @1sTest annotation.
  • C. Implement the setFixedSearchResult= method in the test class.
  • D. Enclose the method call within Test. startbest i) and @Test_stopTast |).

Answer: C

Explanation:
Implementing the setFixedSearchResult= method in the test class is a way to ensure that the test class runs successfully. The setFixedSearchResult= method is a method that can be used to specify the records to be returned by the SOSL query in the test class. The setFixedSearchResult= method can accept a list of record IDs as a parameter, and return those records when the SOSL query is executed. By using the setFixedSearchResult= method, the developer can control the data returned by the SOSL query, and avoid the dependency on the data in the org. The developer can also use the Test.loadData method to load the test data from a static resource, and pass the record IDs to the setFixedSearchResult= method. For example, the developer can use the following code to implement the setFixedSearchResult= method in the test class:
// Load test data from a static resource List<sObject> testRecords = Test.loadData(Account.sObjectType, 'testData');
// Get the record IDs List<Id> recordIds = new List<Id>(); for (sObject record : testRecords) { recordIds.add(record.Id); }
// Set the fixed search result Test.setFixedSearchResults(recordIds);
// Call the method that performs the SOSL query List<Account> results = searchFeatures.search('Acme');
// Assert the expected results System.assertEquals(testRecords.size(), results.size());


NEW QUESTION # 57
Which annotation exposes an Apex class as a RESTful neb service?

  • A. @RemoteAction
  • B. @AuraEnaWed
  • C. @HttpInvocabte
  • D. @RestRtsoorct

Answer: D


NEW QUESTION # 58
A company wants to track revenue through a related object. They need to perform a one-time seeding of data for roughly 100,000 Opportunities, creating Revenue records based on complex logic. What is the optimal way to automate this?

  • A. Use Database.executeBatch() to invoke a Queueable class.
  • B. Use Database.executeBatch() to invoke a Database.Batchable class.
  • C. Use System.scheduleJob() to schedule a Database.Scheduleable class.
  • D. Use System.enqueueJob() to invoke a Queueable class.

Answer: B

Explanation:
For high-volume data processing (such as seeding 100,000 records) involving complex logic, Batch Apex (Option A) is the standard and most robust solution. Batch Apex is designed to handle up to 50 million records by breaking the total set into smaller, manageable chunks (defaulting to 200 records per batch).
Each batch execution gets its own set of governor limits. This is crucial for "complex logic," as it prevents the transaction from hitting CPU time or heap size limits that would occur if one tried to process all 100,000 records in a single synchronous transaction. Batch Apex also provides built-in state management and error handling (via Database.RaisesPlatformEvents or the finish method).
Option B (Queueable) is better suited for smaller, chained tasks; while it can handle some volume, it is not optimized for 100,000 records in the same way the QueryLocator in Batch Apex is. Option C is a syntactical impossibility as executeBatch only accepts Batchable classes. Option D (Schedulable) is used for timing, but the actual heavy lifting for 100,000 records would still need to be handed off to a Batch class to avoid timeout errors. Therefore, Database.Batchable is the optimal tool for large-scale data seeding.


NEW QUESTION # 59
Universal Containers (LIC) wants to develop a customer community to help their customers log issues with their containers. The community needs to function for their German- and Spanish-speaking customers also.
UC heard that it's easy to create an international community using Salesforce, and hired a developer to build out the site.
What should the developer use to ensure the site is multilingual?

  • A. Use custom settings to ensure custom messages are translated properly.
  • B. Use custom metadata to translate custom picklist values.
  • C. Use custom objects to translate custom picklist values.
  • D. Use custom labels to ensure custom messages are translated properly.

Answer: D

Explanation:
Custom labels are used for translating text strings in Salesforce that need to be presented in multiple languages. They support translations and can be referenced in Aura components, Visualforce pages, and Apex code.References: Salesforce Help - Create and Edit Custom Labels


NEW QUESTION # 60
Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?

  • A. Use setSavePoint() and rollback() with a try-catch block.
  • B. Use a Database Savepoint method with a try-catch block.
  • C. Use the Database.Delete method if the Contact insertion fails.
  • D. Use the Database.Insert method with allOrNone set to false.

Answer: A

Explanation:
This requirement calls for "Transactional Atomicity," meaning either both database operations (Account creation and Contact creation) succeed, or neither is committed to the database. In Apex, each DML statement normally acts as its own individual transaction unless managed by Savepoints.
The correct approach is to use Database.setSavepoint() and Database.rollback() within a try-catch block (Option A). The developer sets a savepoint immediately before the Account is inserted. If the Account is created successfully but the subsequent Contact insertion fails (due to a validation rule, trigger error, or system exception), the code enters the catch block. Within the catch block, the developer executes Database.
rollback(sp), which reverts the database to the state it was in before the Account was ever inserted.
Option B is technically similar but "A" provides the standard programmatic pattern name. Option C (allOrNone=false) only applies to a single list of records in one DML call and cannot link the success of an Account to a Contact. Option D (manual deletion) is an unreliable "cleanup" strategy that fails if the system crashes or if there are secondary side effects from the initial insertion. Using Savepoints ensures the platform handles the rollback safely and completely.


NEW QUESTION # 61
A developer Is tasked with ensuring that email addresses entered into the system for Contacts and for a Custom Object called Survey_Response__c do not belong to a list of blacklisted domains. The list of blacklisted domains will be stored In a custom object for ease of maintenance by users. Note that the Survey_Response__c object is populated via a custom visualforce page.
What is the optimal way to implement this?

  • A. Implement the logic in a Validation Rule on the Contact and a validation Rule on the Survey_Response__c object.
  • B. Implement the logic in a helper class that is called by an Apex trigger on Contact and from the Custom Visualforce page controller.
  • C. Implement the logic in the Custom Visualforce page controller and call that method from an Apex trigger on Contact.
  • D. Implement the logic in an Apex trigger on Contact and also implement the logic within the Custom visualforce page controller.

Answer: B


NEW QUESTION # 62
A company accepts orders for customers in their ERP system that must be integrated into Salesforce as Order__c records with a lookup field to Account. The Account object has an external ID field, ERP_Customer_ID__c. What should the integration use to create new Order__c records that will automatically be related to the correct Account?1234

  • A. Insert on the Order__c object followed by an update on the Order__c object.
  • B. Merge on the Order__c object and spe13cify the ERP_Customer_ID__c for 14the 15Account relationship.
  • C. Upsert on the Order__c object and specify the ERP_Customer_ID__c for the Account relationship.5678
  • D. Upsert on the Account and specify the ERP_Customer_ID__c for the relations9hip.101112

Answer: C

Explanation:
In Salesforce integration, the Upsert operation is highly powerful because it allows you to create or update records and relate them to other records using External IDs instead of Salesforce record IDs ($001...$).
When the ERP system sends an order, it may not know the 18-character Salesforce ID for the Account, but it does know the ERP_Customer_ID__c. By performing an Upsert on the Order__c object (Option A), the integration can leverage "Foreign Key" syntax in the API payload. This essentially tells Salesforce: "Create this Order and link its Account__c lookup field to the Account that has this specific ERP_Customer_ID__c." This approach is the "Gold Standard" for integrations because:
* It eliminates the need for the external system to perform a "lookup" query in Salesforce to find an ID before creating a record.
* It reduces the total number of API calls, saving on governor limits.
* It handles "idempotency," ensuring that if the same order is sent twice, it is updated rather than duplicated.
Options B, C, and D are less efficient. Upserting the Account (Option B) doesn't create the Order. Merging (Option C) is for deduplication. The Insert-then-Update approach (Option D) is an anti-pattern that doubles the required API calls and transaction overhead.


NEW QUESTION # 63
A developer created an Apex class that updates an Account based on input from a Lightning web component that Is used to register an Account. The update to the Account should only be made if it has not already been registered.

What should the developer do to ensure that users do not overwrite each other's updates to the same Account if they make updates at the same time?

  • A.
  • B.
  • C.
  • D.

Answer: C

Explanation:
When multiple users are updating the same record at the same time, there is a risk of overwriting each other's changes. Salesforce provides a mechanism called 'record locking' to prevent this from happening.
* Option D is correct because including FOR UPDATE in the SOQL query locks the retrieved records for the duration of the transaction. This prevents other transactions from updating the record until the current transaction is complete, which is essential for avoiding race conditions where two users might overwrite each other's updates.
* Option A is incorrect because while adding a try/catch block around the update operation is good practice for handling exceptions, it does not prevent overwrites from concurrent updates.
* Option B is incorrect because using upsert instead of update does not address the problem of concurrent updates. The upsert operation is used to either insert a new record or update an existing one based on whether a record with a matching ID or external ID already exists.
* Option C is incorrect because FOR UPDATE should be used in the SOQL query to lock the records, not in the SELECT statement itself.
References:
Salesforce Developer Documentation on Locking Statements: Locking Statements Salesforce Developer Blog on Handling Concurrency in Apex: Handling Concurrency in Apex


NEW QUESTION # 64
Universal Containers (UC) has an CRP system that stores customer information.
When an Account is created in Salesforce, the FRP system's REST endpoint for creating new customers must automatically be called with the Account information, If the call to the ERP system fails, the Account should still be created. Accounts in UC org are only created, one at a time, by users in the customer on-boarding department.
What should a developer to make the call to the CRP system's REST endpoint7

  • A. REST call from JavaScript
  • B. call a Queueable from a Trigger
  • C. apex Continuation
  • D. Headless Quick Action

Answer: A

Explanation:
Explanation
According to 1, REST API provides you with programmatic access to your data in Salesforce. You can use REST API to make HTTP requests to Salesforce endpoints and perform operations on your data. However, you also need to authenticate your requests using OAuth endpoints According to 3, you can use Queueable Apex to schedule batch send the data from Salesforce to another system using REST API. Queueable Apex allows you to run asynchronous jobs that can be chained and monitored. You can call a Queueable class from a trigger to enqueue the job after an Account is created.
Therefore, using a Queueable from a Trigger seems to be the best way to make the call to the ERP system's REST endpoint.


NEW QUESTION # 65
@isTest static void testAccountUpdate() { Account acct = new Account({Name = 'Test'); acct.Integration Updated_c = false; insert acct; CalloutUtil.sendAccountUpdate (acct.Id); Account acctAfter = [SELECT Id, Integration Updated_c FROM Account WHERE Id = :acct.Id] [0]; System.assert(true, acctAfter.Integration_Updated_c); } The test method above calls a web service that updates an external system with Account information and sets the Account's Integration_Updated__c checkbox to True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts." What is the optimal way to fix this?

  • A. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  • B. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  • C. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
  • D. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.

Answer: A


NEW QUESTION # 66
A custom field Exec_Count_c of type Number is created on an Account object. An account record with value of "1" for a: Exec_Count_c is saved. A workflow field update is defined on the Exec_Count_c field, to increment its value every time an account record is created or updated. The following trigger is defined on the account:
trigger ExecOrderTrigger on Account (before insert, before update, after insert, after update){ for (Account accountInstance: Trigger.New){ if (Trigger
. isBefore){ accountInstance Exec_Count_c += 1; } System. debug
(accountInstance.Exec_Count_c); } }

  • A. 2, 2, 4, 4
  • B. 1, 2, 3, 3
  • C. 1, 2, 3, 4
  • D. 2, 2, 3, 3

Answer: A


NEW QUESTION # 67
......

Latest Questions PDII Guide to Prepare Free Practice Tests: https://www.exam-killer.com/PDII-valid-questions.html

PDII Practice Exam - 163 Unique Questions: https://drive.google.com/open?id=1mPyxurvepjntxVOpnmjd-bBoe_zv-jrl