Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 186 discussion

Actual exam question from Salesforce's CRT-450
Question #: 186
Topic #: 1
[All CRT-450 Questions]

A developer must modify the following code snippet to prevent the number of SOQL queries issued from exceeding the platform governor limit.

The above method might be called during a trigger execution via a Lightning component.
Which technique should be implemented to avoid reaching the governor limit?

  • A. Refactor the code above to perform the SOQL query only if the Set of opportunityIds contains less 100 Ids.
  • B. Use the System.Limits.getLimitQueries() method to ensure the number of queries is less than 100.
  • C. Refactor the code above to perform only one SOQL query, filtering by the Set of opportunityIds.
  • D. Use the System.Limits.getQueries() method to ensure the number of queries is less than 100.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ekanki
Highly Voted 3 years, 2 months ago
The answer is C. Remove the for loop and Change the query [SELECT Id FROM OpportunityLineItem WHERE OpportunityId in :opportunityIds]
upvoted 17 times
...
sirerick
Highly Voted 3 years, 2 months ago
it's C. it must be done only using 1 query and a set for id's
upvoted 8 times
...
SanjeevOnForce
Most Recent 1 year ago
The answer is C
upvoted 1 times
...
Alf8
1 year, 11 months ago
Selected Answer: C
Use Set and query only once for the keys in the set
upvoted 3 times
...
ApexMike
2 years, 1 month ago
Selected Answer: C
C is the only correct answer
upvoted 3 times
...
tapasroy
2 years, 6 months ago
Selected Answer: C
Use IN : operator for setIds to fetch all records.
upvoted 3 times
...
Simon28
3 years, 2 months ago
It should be C
upvoted 7 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 ...