exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 318 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 318
Topic #: 1
[All Certified Platform Developer II Questions]

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 with the @Future annotation.
  • B. Create a formula field to combine the CreatedDate and RecordType value, then filter based on the formula.
  • C. Break down the query into two individual queries and join the two result sets.
  • D. Use the Database.queryLocator method to retrieve the accounts.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
moitam
9 months ago
Selected Answer: C
C is correct. This is a way to avoid using OR conditions, which can make a query non-selective and slow(1). By using two separate queries with selective filters, the developer can reduce the query cost and improve the performance(2). 1: https://help.salesforce.com/s/articleView?id=000387172&language=en_US&type=1 2: https://help.salesforce.com/s/articleView?id=000386021&language=en_US&type=1
upvoted 2 times
...
globaltelnet
1 year ago
D and using Batch
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...