PDII Salesforce Certified Platform Developer II (PDII)

Loading demo links...

Showing 10–12 of 20 questions

Question 10

Example 1:

AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)

{

System.debug('Campaign ID' + ar.get('CampaignId'));

System.debug('Average amount' + ar.get('expr0'));

}

Example 2:

AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId];

for (AggregateResult ar : groupedResults)

{

System.debug('Campaign ID' + ar.get('CampaignId'));

System.debug('Average amount' + ar.get('theAverage'));

}

Example 3:

AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)

{

System.debug('Campaign ID' + ar.get('CampaignId'));

System.debug('Average amount' + ar.get.AVG());

}

Example 4:

AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId];

for (AggregateResult ar : groupedResults)

{

System.debug('Campaign ID' + ar.get('CampaignId'));

System.debug ('Average amount' + ar.theAverage);

}

Which two of the examples above have correct System.debug statements? (Choose two.)

Select all that apply, then click Submit answer.

  • Example 1

  • Example 2

  • Example 3

  • Example 4

Question 11

An org contains two custom objects: Building__c and Office__c. Office__c has a Lookup field to Building__c.

A developer is asked to automatically populate the Number_of_Offices__c field on the Building__c object with the count of related Office__c records anytime an Office__c record is created or deleted. The developer cannot modify the field types.

Which solution meets the requirements?

Select an option, then click Submit answer.

  • Flow

  • Workflow

  • Apex Trigger

  • Process Builder

Question 12

Which statement is considered a best practice for writing bulk safe Apex Triggers?

Select an option, then click Submit answer.

  • Add records to collections and perform DML operations against these collections

  • Instead of DML statements, use the Database methods with allOrNone set to False

  • Add LIMIT 50000 to every SOQL statement

  • Perform all DML operations from within a Future Method