Download Salesforce PDII Mock Test Study Material [Q19-Q37]

Share

Download Salesforce PDII Mock Test Study Material

PDII Questions Prepare with Learning Information


The Salesforce PDII exam consists of 60 multiple-choice questions and five coding challenges that need to be completed within three and a half hours. The coding challenges are designed to test the candidate's ability to solve complex problems using Apex, Visualforce, and Lightning Components.


Achieving the PDII certification demonstrates to employers and colleagues that a developer has a deep understanding of the Salesforce platform and can design and develop complex solutions to meet business requirements. It can also help developers advance their careers and increase their earning potential. The PDII certification is a valuable asset for any developer looking to work with Salesforce, and it is recognized globally as a mark of expertise in the field.

 

NEW QUESTION # 19
Consider the following code snippet:
A developer created the following test class to provide the proper code coverage for the snippet above:
However, when the test runs, no data is returned and the assertion fails.
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 setFixedSearchResults method in the test class.
  • B. Implement the without sharing keyword in the searchfeature Apex class.
  • C. Implement the seeAllData=true attribute in the @isTest annotation.
  • D. Enclose the method call within Test. startTest () and Test , stop Test ()

Answer: A


NEW QUESTION # 20
Refer to the test method below:

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 CallcutoutUtil. sendAccoutUpdate.
  • B. Add Test.startTest() and Test .setMock before and Test.stopTest () after CalloutUtil.sendAccountUpdate.
  • C. Add Test.startTest before and Test.setMock and Test. stoptest () after CallloutUtil.sendAccountUpdate.
  • D. Add if ('Test.isRunningTest I)) around calloutUtil.sendAccountUpdate.

Answer: B


NEW QUESTION # 21
Universal Containers has an Apex trigger on Account that creates an Account Plan record when an Account is marked as a Customer.
Recently a record-triggered flow was added so that whenever an Account is marked as a Customer, a
"Customer Since' date field is updated with today's date. Since the addition of the flow, two Account Plan records are created whenever the Account is marked as a Customer.
What might cause this to happen?

  • A. The flow is configured to use an "Update Records' element.
  • B. The Apex trigger is not bulk safe and calls insert inside of a for loop.
  • C. The flow is configured to evaluate when a record is created and every time it is edited.
  • D. The Apex trigger does not use a static variable to ensure it only fires once.

Answer: C

Explanation:
If a flow is configured to evaluate when a record is created and every time it's edited, and an Apex trigger also fires upon the same conditions, it could result in duplicate operations. In this case, two Account Plan records are created because both the flow and the trigger execute upon the Account being marked as a Customer.


NEW QUESTION # 22
Consider the queries in the options below and the following Information:
* For these queries, assume that there are more than 200,000 Account records.
* These records Include soft-deleted records; that is, deleted records that are still in the Recycle Bin.
* There are two fields that are marked as External Id on the
Account. These fields are customer_Number_c and ERR_Key_ s.
Which two queries are optimized for large data volumes?
Choose 2 answers

  • A. SELECT I4 FROM Account WHERE Name !- NULL
  • B. SELECT 1d FROM Accounts WHERE Name != '°
    AND Customer_Number_c- "ValueA'
  • C. SELECT Id FROM Account WHERE Name != ' 'AND IsDeleted = false
  • D. SELECT ID FROM Account WHRE id IN :aListVariable

Answer: B,C

Explanation:
For optimizing queries, especially on large data volumes, it's recommended to use indexed fields such as External ID fields, which will make the queries selective. Among the options given:
B) is optimized because it is using the Customer_Number__c field, which is an External ID and hence indexed.
D) is also optimized because it filters out deleted records with IsDeleted = false and uses Name != ' ', which is likely to be selective.
Using indexed fields and filtering out unnecessary records helps in faster query execution on large data volumes.
References:
Make SOQL Query Selective
Working with Very Large SOQL Queries


NEW QUESTION # 23
A company has a Lightning page with many Lightning Components, some that cache reference dat a. It is reported that the page does not always show the most current reference data.
What can a developer use to analyze and diagnose the problem in the Lightning page?

  • A. Salesforce Lightning Inspector Actions tab
  • B. Salesforce Lightning Inspector Transactions tab
  • C. Salesforce Lightning Inspector Storage tab
  • D. Salesforce Lightning Inspector Event Log tab

Answer: C

Explanation:
The Salesforce Lightning Inspector Storage tab is a tool that can be used to analyze and diagnose the problem of stale or outdated data in a Lightning page. The Storage tab shows the data that is stored in the browser cache by the Lightning components, such as reference data, metadata, and UI state. The developer can use the Storage tab to inspect the data, clear the cache, or disable the cache for debugging purposes. The developer can also use the Storage tab to monitor the cache performance and size, and identify any potential issues or bottlenecks. Reference: [Salesforce Lightning Inspector Storage Tab], [Lightning Data Service Caching]


NEW QUESTION # 24
A company has a custom object. Order__c, that has a custom picklist field. Status__c, with values of New, In Progress," or Fulfilled and a lookup field, Contact_c, to Contact.
Which SOQL query wrii return a unique list of all the Contact records that have no Fulfilled Orders?

  • A. SELECT Contact_c FROM Order_c Where Status_c <> ;Fulfilled'
  • B. SELECT Contact_c From order_c Where id NOT IN (SELECT id FROM_c Where States_c + Fulfilled')
  • C. SELECT id FROM Contact WHERE id NOT IN (SELECT Contact _c FROM order_c Where Status_c = fulfilled')
  • D. SELECT iD FROM Contact WHERE id NOT IN (SELECT id From order_c WHERE_c = Fulfilled')

Answer: C


NEW QUESTION # 25
A company has a custom component that allows users to search for records of a certain object type by invoking an Apex Controller that returns a list of results based on the user's input. When the search is completed, a searchComplete event is fired, with the results put in a results attribute of the event. The component is designed to be used within other components and may appear on a single page more than once.
What is the optimal code that should be added to fire the event when the search has completed?

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

Answer: B

Explanation:
The correct code to fire the event when the search has completed in a Lightning component is option B.
$A.get("e.c.searchComplete") is the syntax used to get the event, setParams is used to set the parameters, and fire is used to dispatch the event.References: Lightning Components Developer Guide - Firing Events


NEW QUESTION # 26
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 w'th the @Future annotation.
  • B. Break down the query into two individual queries and join the two result sets.
  • C. Create a formula field to combine the CreateData and RecordType value, then Piter based on the formula.
  • D. Use the Database, queryLocation method to retrieve the accounts.

Answer: B


NEW QUESTION # 27
A developer needs to implement a system audit feature that allows users, assigned to a custom profile named
"Auditors", to perform searches against the historical records in the Account object. The developer must ensure the search is able to return history records that are between 6 and 12 months old.
Given the code below, which select statement should be inserted below as a valid way to retrieve the Account History records ranging from 6 to 12 months old?

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

Answer: D

Explanation:
Given the code snippet, the correct query to retrieve Account History records between 6 and 12 months old would be the one that includes a WHERE clause filtering records where the CreatedDate is greater than or equal to initialDate and less than or equal to endDate. Option B's statement does this correctly by using the >
= and <= operators to define the range between initialDate (which is set to today's date minus 12 months) and endDate (set to today's date minus 6 months). Options A, C, and D either use incorrect comparison operators or compare against the wrong variables, resulting in an incorrect data set being returned.
References
SOQL Date Formats and Date Literals: SOQL and SOSL Reference Guide


NEW QUESTION # 28
A developer is experiencing issues with a Lightning web component. The component must surface information about Opportunity owned by the currently logged-in user.
When the component is rendered, the following message is displayed: ''Error retrieving data'' Which modification should be implemented to the Apex class to overcome the issue?

  • A. Use the Continuation=true attribute in the Apex method.
  • B. Use the Cacheable=True attribute in the Apex method.
  • C. Edit the code to use the without sharing keyword in the Apex class.
  • D. Ensure the OWD for the Opportunity object is public.

Answer: B


NEW QUESTION # 29
What is the optimal technique a developer should use to programmatically retrieve Global Picklist options in a Test Method?

  • A. performs a SOQL Query.
  • B. Use a static resource
  • C. Perform a callout to the Metadata API.
  • D. Use the Schema namespace.

Answer: B


NEW QUESTION # 30
A developer gets an error saying 'Maximum Trigger Depth Exceeded.'
What is a possible reason to get this error message?

  • A. A flow trigger was included too many times.
  • B. A trigger is recursively invoked more than 16 times.
  • C. The SOQL governor limits are being hit.
  • D. There are numerous DML operations in the trigger logic.

Answer: B


NEW QUESTION # 31
How should a developer assert that a trigger with an asynchronous process has successfully run?

  • A. Create all test data, use future in the rest class, then perform assertions.
  • B. Insert records into Salesforce, use seeAllData=true, then perform assertions.
  • C. Create all test data in the test class, use system. runs {} to invoke the trigger, then perform assertions.
  • D. Create all test data in the test class, invoke Test.startTest{} and Test.etopTaat {} and then perform assertions.

Answer: D

Explanation:
Use Test.startTest() and Test.stopTest(). These methods ensure asynchronous code runs within test execution and allows for accurate assertions.References: Testing Asynchronous Apex


NEW QUESTION # 32
What is the correct order of execution for Visualforce Page "postback" requests (when user interaction requires a page update)?

  • A. 1) Decode View State
    2) Evaluate expressions and method calls for the main page and custom components
    3) Upon successful completion, Evaluate the action that triggered the postback
    4) Upon successful completion, Update data and redirect user/update view state
    5) HTML sent to browser
  • B. 1) Decode View State
    2) Evaluate expressions and method calls for the main page and custom components
    3) Upon successful completion, Update data and redirect user/update view state
    4) Upon successful completion, Evaluate the action that triggered the postback
    5) HTML sent to browser
  • C. 1) Evaluate expressions and method calls for the main page and custom components
    2) Decode View State
    3) Upon successful completion, Update data and redirect user/update view state
    4) Upon successful completion, Evaluate the action that triggered the postback
    5) HTML sent to browser

Answer: A


NEW QUESTION # 33
Which of the following about Dynamic Apex is incorrect?

  • A. You can retrieve the sObject type from an Id by calling .getSObjectTypeQ
  • B. Schema.getGlobalDescribeQ gives you a map of all sObject
  • C. In dynamic SOQL, you can use bind variables and bind variable fields
  • D. getDescribe() can get you a variety of info on a particular object/field

Answer: C

Explanation:
Explanation
Explanation/Reference:
While you can use simple bind variables in dynamic SOQL, you cann|ot use bind variable fields (e.g. :myVariable.field1_c) Use escapeSingleQuotes to prevent SOQL injection


NEW QUESTION # 34
A company recently deployed a Visualforce page with a custom controller that has a data grid of information about Opportunities in the org.
Users report that they receive a ''Maximum view state size limit'' error message under certain conditions.
According to Visualforce best practice, which three actions should the developer take to reduce the view state? Choose 3 answers

  • A. Use the transient keyword in the Apex controller for variables that do not maintain state.
  • B. Use the final keyword In the controller for variables that will not change.
  • C. Refine any SQQL queries to return only data relevant to the page.
  • D. Use the private keyword in the controller for variables
  • E. Use filters and pagination to reduce the amount of data.

Answer: C,D,E


NEW QUESTION # 35
A user receives the generic "An internal server error has occurred" while interacting with a custom Lightning Component. What should the developer do to ensure a more meaningful message?

  • A. Add an onerror event handler to the tag.
  • B. Add an error-view component to the markup.
  • C. Use an AuraHandledException in a try/catch block.
  • D. Use ProcessBuilder to catch the error.

Answer: C


NEW QUESTION # 36
A company has the Lightning Component above that allows users to dick a button to save their changes and redirects them to a different page. Currently, when the user hits the Save button the records are getting saved, but they are not redirected.
Which three techniques can a developer use to debug the JavaScript? Choose 3 answers

  • A. Use Developer Console to view the debug log.
  • B. Use Developer Console to view checkpoints.
  • C. Enable Debug Mode for Lightning components for the user.
  • D. Use consde.log() messages in the JavaScript.
  • E. Use the browser's dev tools to debug the JavaScript.

Answer: C,D,E


NEW QUESTION # 37
......

Most Reliable Salesforce PDII Training Materials: https://vce4exams.practicevce.com/Salesforce/PDII-practice-exam-dumps.html