+ Start a Discussion
Madhusudan Singh 19Madhusudan Singh 19 

Pd2 Question doubts

Hi All,
I am preparing for PD2 and have an exam scheduled on coming Sunday, thought to double confirm with forums for few questions.

1. Consider the following queries. For these queries, assume that there are more than 200000 Account records. These records include soft-deleted records; that is, deleted records are still in Recycle Bin. Notre that there are two fields that are marked as External Id on the Account. These fields are Customer_Number__c and ERP_Key__c
a. SELECT Id FROM Account WHERE Id IN :aListVariable
b. SELECT Id FROM Account WHERE Name !='' AND IsDeleted = false
c. SELECT Id FROM Account WHERE Name != NULL
d. SELECT Id FROM Account WHERE Name != '' AND Customer_Number__c = 'ValueA'

My Answer: A,D
Reason: Perfroming SOQL on Id field or ExternalID field will be faster as they are indexed.

2. An Apex trigger creates and Order__c record every time an Opportunity is won by Sales Rep. Recently a trigger is creating two orders. What is the optimal method for a developer to troubleshoot this?

a. Set up debug logging for each Sales Rep, then monitor the logs for errors and exceptions.
b. Run the Apex test classes for the apex trigger to ensure the code still has sufficient code coverage
c. Turn off all the Workflow Rules, then turn on one at a time to see which one causes the errors
d. Add system.debug() statements to the code and use the developer console logs to trace the code

My Answer: D
Reason: This is easier process for debuging, Option A is asking to create debug log for all users hance it will be useless

3. A developer wishes to improve the runtime performance of the Apex calls by caching results on the client
a. Set a cookie in the browser for use upon return to the page
b. Call the setStorable() method on the action in the JavaScript client-side code.
c. Decorate the server-side method with @AuraEnabled(cacheable=true)
d. Decorate the server-side method with @AuraEnabled(storable=true)

My Answer: C
Reason: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_storable_actions.htm having doubt as many places people are still saying B

4. When calling a Restful web service a developer receives a JSON payload that has a data hierarchy that is three levels deep. How can the developer describe the external data?
a. Deserialize the data and then process it.
b. Declare a class with three levels and deserialize the JSON typed with this class
c. Use the ANT migration tool, the custom metadata API, or the Dataloader
d. Use middleware to flatten the JSON and consume it as a new custom object

My Answer: B
Reason: Create an Inner class and deserialize it with the inner class

5. A visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
a. Use the transient keyword for the List variables used in the custom controller
b. Use the lazy loading to load the data on demand, instead of in the controller's constructor
c. Use an <apex:actionPolar> in the page to load all of the data asynchronously.
d. Use Javascript to move data processing to the browser instead of the controller

My Answer: B
Reason: Option is well explanatory whereas other options will not fit in this requirement
AbhishekAbhishek (Salesforce Developers) 
Hi Madhu,

This forum's main intention is to help developers or people who are having issues with salesforce.

But you can't post this type of question here.

Salesforce Support.