
A fully updated 2021 PDII Exam Dumps exam guide from training expert VCE4Dumps
Provides complete coverage of every objective on exam and exam preparation PDII
NEW QUESTION 192
What is the recommended approach to create test data when testing Apex that involves Pricebooks, PricebookEntries, and Products?
- A. Use the isTest (SeeAllData=true) annotation on the entire Test Class to allow your Test Methods access to the standard Pricebook.
- B. Insert a new standard Pricebook record within your Test Method so that it can be used with other test records.
- C. Use the Test.getStandardPricebookId() method to get theId of the standard Pricebook so that it can be used with other test records.
- D. Use the isTest (SeeAllData=true) annotation on Test Methods that require access to the standard Pricebook.
Answer: C
NEW QUESTION 193
A developer wants to retrieve and deploy metadata, perform simple CSV export of query results, and debug Apex REST calls by viewing JSON responses.
Which tool should the developer use?
- A. Force.com Migration Tool
- B. Workbench
- C. Developer Console
- D. Force.com IDE
Answer: B
NEW QUESTION 194
A developer has requirement to query three fields (id, name, Type) from an Account and first and last names for all Contacts associated with the Account.
Which option is the preferred optimized method to achieve this for the Account named 'Ozene Electronics'?
- A. List 1Contacts = new list ( ); for(Contact c ; 1Select firstname, lastname Account, Name Account,ID Account, Type from Contact where Account: Name=' electronics')) ( iContacts.add(c);)
- B. List 1Accounts = (Select ID, Name, Type from Account Join (Select ID, firstname, lastname form Contact where contact account , name 'ozone electronics));
- C. Account a = (SELECT ID, Name, Type from Account where name= Ozone Electronics;) list 1contacts = (SELECT firstname, lastname from Contacts where accountid=: a -ID0;
- D. Account a = (SELECT ID, Name, Type, (select contat,firstName, Contact,LastName from Account, Contacts) from Account where name; Ozone Electronic' Limit 1 );
Answer: D
NEW QUESTION 195
A developer has written an After Update trigger on Account. A workflow rule and field update cause the trigger to repeatedly update the Account records.
How should the developer handle the recursive trigger?
- A. Deactivate the trigger and move the logic into a Process or Flow
- B. Deactivate the workflow rule to prevent the field update from executing
- C. Use a static variable to prevent the trigger from executing more than once
- D. Use a global variable to prevent the trigger from executing more than once
Answer: C
NEW QUESTION 196
Universal Containers stores user preferences in a Hierarchy Custom Setting, User_Prefs_c, with a Checkbox field, Show_Help_c. Company-level defaults are stored at the organizational level, but may be overridden at the user level. If a user has not overridden preferences, then the defaults should be used.
How should the Show_Help_c preference be retrieved for the current user?
- A. Boolean show = User_Prefs__c.getValues().Show_Help__c;
- B. Boolean show = User_Prefs__c.Show_Help__c;
- C. Boolean show = User_Prefs__c.getInstance().Show_Help__c;
- D. Boolean show = User_Prefs__c.getValues(UserInfo.getUserId()).Show_Help__c;
Answer: D
Explanation:
Explanation/Reference: https://developer.salesforce.com/forums/?id=906F00000008ySqIAI
NEW QUESTION 197
A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue?
- A. Change the required field to be a validation rule that excludes the System Administrator profile.
- B. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there.
- C. Add a before insert trigger on Account to set the value of the required field.
- D. Add the required field to the data setup for all of the unit tests.
Answer: B
NEW QUESTION 198
What is a consideration when testing batch Apex? (Choose two.)
- A. Test methods must execute the batch with a scope size of less than 200 records
- B. Test methods must run the batch between TeststartTestQ and Test.stopTestQ
- C. Test methods must use the @isTest (SeeAIIData=true) annotation
- D. Test methods must call the batch execute() method once
Answer: A,B
NEW QUESTION 199
A developer has created a Visualforce page that uses a thirdparty JavaScript framework. The developer has decided to supply data to the JavaScript functions using JavaScript Remoting for Apex Controllers. What is the correct syntax to declare a remote method in Apex? Choose 2 answers
- A. @RemoteAction global static String getTable()
- B. @RemoteAction global String getTable()
- C. @Remoteobject ' global static String gettable
- D. @RemoteAction public static String getTable()
Answer: A,D
NEW QUESTION 200
What is the value of "i" printed by the System.debug statement, if the value of "j" is 2 at the end of the transaction? insert new Account[]{new Account(Name = 'yyy'), new Account(Name = 'yyy')}; integer i = 0; integer j; for (Account[] tmp : [SELECT Id FROM Account WHERE Name = 'yyy']) j=tmp.size(); i++; System.debug(i);
- A. 0
- B. 1
- C. 2
- D. 3
Answer: B
NEW QUESTION 201
Which technique can run custom logic when a Lightning web component is loaded?
- A. Use the connectedCallback () method.
- B. Call SA.enqueueAction passing in the method to call.
- C. Use the renderedCallback ( ) method.
- D. Use an aura:handler "init" event to call a function.
Answer: D
NEW QUESTION 202
A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration is periodically reporting errors. Which change should the developer make to ensure the integration is not affected with minimal impact to business logic?
- A. use Try/Catch block after the insert statement.
- B. Remove the Apex Class from the Integration User's Profile.
- C. Deactivate the Trigger before the Integration runs.
- D. Use the Database method with allOrNone set to False.
Answer: A
NEW QUESTION 203
What is the correct syntax for calling a controller action from a Visualforce page and updating part of the page once the action is completed? (Choose two.)
<apex:commandFunction action="{!Save}" value="Save" rendered="thePageBlock"/
- A. >
<apex:actionFunction action="{!Save}" name="Save" rerender="thePageBlock"/> - B. rerender="thePageBlock"/>
- C. <apex:commandButton action="{!Save}" value="Save" redraw="thePageBlock"/>
- D. <apex:actionSupport action="{!Save} " event="onchange"
Answer: B,C
NEW QUESTION 204
What are three benefits of using declarative customizations over code? Choose 3 answers
- A. Declarative customizations generally require less maintenance.
- B. Declarative customizations are not subject to governor limits.
- C. Declarative customizations will automatically update with each Salesforce release.
- D. Declarative customizations do not require user testing.
- E. Declarative customizations cannot generate run time errors.
Answer: A,B,C
NEW QUESTION 205
An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed end Won. This trigger is working great, except (due to a recent acquisition) historical Opportunity records need to be loaded into the Salesforce instance.
When a test batch of records are loaded, the Apex trigger creates Contract records. A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created.
What is the most extendable way to update the Apex trigger to accomplish this?
- A. Add a Validation Rule to the Contract to prevent Contract creation by the user who loads the data.
- B. Use a Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data.
- C. Use a List Custom Setting to disable the trigger for the user who loads the data.
- D. Add the Profile ID of the user who loads the data to the trigger so the trigger will not fire for this user.
Answer: B
NEW QUESTION 206
A developer has working business logic code, but sees the following error in the test class:
You have uncommitted work pending. Please commit or rollback before calling out. What is a possible solution?
- A. Call support for help with the target endpoint, as it is likely an external code error.
- B. Set seeAIIData to "true" at the top of the test class, since the code does not fail in practice.
- C. Use test.IsRunningTest() before making the callout to bypass it in test execution.
- D. Rewrite the business logic and test classes with ©TestVisible set on the callout.
Answer: C
NEW QUESTION 207
What is a consideration when testing batch Apex? Choose 2 answers
- A. Test methods must use the @isTest (SeeAllData=true) annotation.
- B. Test methods must run the batch between Test. startTest () and Test.stopTest
- C. Test methods must execute the batch with a scope size of less than 200 records.
- D. Test methods must call the batch execute () method once.
Answer: B,C
NEW QUESTION 208
Given the following code, what value Will be output in the logs by line #8? 1 Contact con = new Contact( LastName ='Smith', Department = 'Admin') 2 insert con; 3 Contact insertedContact=[select Name from Contact where id=zcon.Id]; 4 Savepoint sp_admin = Database.setSavepoint(); 5 con.Department = 'HR'; D} 6 update con; 7 Database.rollback(sp_admin); 8 console.log(Limits.getDmlStatements());
- A. 0
- B. 1
- C. 2
- D. 3
Answer: C
NEW QUESTION 209
......
Tested Material Used To PDII: https://www.vce4dumps.com/PDII-valid-torrent.html
Steps Necessary To Pass The PDII Exam: https://drive.google.com/open?id=1QQRFOXRF3RO2LcNrsPkWbqegFN_NM-F2