ExamGecko
Home Home / Salesforce / Certified Platform Developer II

Salesforce Certified Platform Developer II Practice Test - Questions Answers, Page 5

Question list
Search
Search

List of questions

Search

Related questions











Which two relationship queries use the proper syntax? Choose 2 answers

A.
SELECT Name, (SELECT LastName FROM Contacts__r) FROM Account
A.
SELECT Name, (SELECT LastName FROM Contacts__r) FROM Account
Answers
B.
SELECT Name, (SELECT LastName FROM Contacts) FROM Account
B.
SELECT Name, (SELECT LastName FROM Contacts) FROM Account
Answers
C.
SELECT Id, Name, Account __r.Name FROM Contact WHERE Account r.Industry = 'Media'
C.
SELECT Id, Name, Account __r.Name FROM Contact WHERE Account r.Industry = 'Media'
Answers
D.
SELECT Id, Name, Account.Name FROM Contact WHERE Account.Industry = 'Media'
D.
SELECT Id, Name, Account.Name FROM Contact WHERE Account.Industry = 'Media'
Answers
Suggested answer: B, D

A developer built a Component to be used at the front desk for guests to self-register upon arrival at a kiosk. The developer is now asked to create a Component for the Utility Tray to alert Users whenever a guest has arrived at the front desk.

What should be used?

A.
Changelog
A.
Changelog
Answers
B.
Component Event
B.
Component Event
Answers
C.
Application Event
C.
Application Event
Answers
D.
DML Operation
D.
DML Operation
Answers
Suggested answer: C

Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity's Account?

A.
A.
Answers
B.
B.
Answers
C.
C.
Answers
D.
D.
Answers
Suggested answer: A

An Apex Trigger creates a Contract record every time an Opportunity record is marked as Closed and 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.
Use a Hierarchy Custom Setting to disable the Trigger for the user who does the data loading.
A.
Use a Hierarchy Custom Setting to disable the Trigger for the user who does the data loading.
Answers
B.
Add a Validation Rule to the Contract to prevent Contract creation by the user who does the data loading.
B.
Add a Validation Rule to the Contract to prevent Contract creation by the user who does the data loading.
Answers
C.
Use a List Custom Setting to disable the Trigger for the user who does the data loading.
C.
Use a List Custom Setting to disable the Trigger for the user who does the data loading.
Answers
D.
add the Profile Id of the user who does the data loading to the Trigger so the Trigger won't fire for this user.
D.
add the Profile Id of the user who does the data loading to the Trigger so the Trigger won't fire for this user.
Answers
Suggested answer: A

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 the Database.Delete method if the Contact insertion fails.
A.
use the Database.Delete method if the Contact insertion fails.
Answers
B.
Disable validation rules on Contacts and set default values with a Trigger.
B.
Disable validation rules on Contacts and set default values with a Trigger.
Answers
C.
use the Database.Insert method with allOrNone set to False.
C.
use the Database.Insert method with allOrNone set to False.
Answers
D.
use setSavePoint() and rollback() with a try/catch block.
D.
use setSavePoint() and rollback() with a try/catch block.
Answers
Suggested answer: D

Consider the above trigger intended to assign the Account to the manager of the Account"s region.

Which two changes should a developer make in this trigger to adhere to best practices? Choose 2 answers

A.
Use a Map accountMap instead of List accountList.
A.
Use a Map accountMap instead of List accountList.
Answers
B.
Use a Map to cache the results of the Region__c query by Id.
B.
Use a Map to cache the results of the Region__c query by Id.
Answers
C.
Move the Region__c query to outside the loop.
C.
Move the Region__c query to outside the loop.
Answers
D.
Remove the last line updating accountList as it is not needed.
D.
Remove the last line updating accountList as it is not needed.
Answers
Suggested answer: C, D

Example 1: AggregateResult[] groupedResults = [SELECT Campaignid, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResuits) { System.debug ('Campaign ID' + ar.get('CampaignId'-); System.debug ('Average amount' + ar.get('exprd')); } Example 2: AggregateResult[] groupedResults = [SELECT Campaignid, AVG(Amount) theAverage FROM Opportunity GROUP BY Campaignid]; for (AggregateResult ar : groupedResuits) { 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 : groupedResuits) System.debug(*Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get.AVG(- ); } Example 4:AggregateResult[] groupedResults = [SELECT CampaigniId, 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 2 answers

A.
Example 1
A.
Example 1
Answers
B.
Example 2
B.
Example 2
Answers
C.
Example 3
C.
Example 3
Answers
D.
Example 4
D.
Example 4
Answers
Suggested answer: A, B

Which method should be used to convert a Date to a String in the current user's locale?

A.
Date.format
A.
Date.format
Answers
B.
Date.parse
B.
Date.parse
Answers
C.
String.format
C.
String.format
Answers
D.
String. valueOf
D.
String. valueOf
Answers
Suggested answer: A

A company has a custom object, Order__c, that has a required, unique, external ID field called Order_Number__c. Which statement should be used to perform the DML necessary to insert new records and update existing records in a List of Order__c records?

A.
upsert orders;
A.
upsert orders;
Answers
B.
merge orders;
B.
merge orders;
Answers
C.
merge orders Order_Number__c;
C.
merge orders Order_Number__c;
Answers
D.
upsert orders Order_Number__c;
D.
upsert orders Order_Number__c;
Answers
Suggested answer: D

A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory assignments are completed in the external system. What is the optimal way to update the Accounts from the external system?

A.
Apex REST Web Service
A.
Apex REST Web Service
Answers
B.
Composite REST API
B.
Composite REST API
Answers
C.
SOAP API
C.
SOAP API
Answers
D.
Bulk API
D.
Bulk API
Answers
Suggested answer: A
Total 408 questions
Go to page: of 41