Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
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 106 discussion

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

A developer encounters an error that states that the Apex heap size is exceeded.
Which technique may reduce heap size?

  • A. Add the transient keyword to the variable definition
  • B. Move the variable definition inside the scope of the function
  • C. Use static variables instead of instance variables
  • D. Use SOQL for loops instead of standard SOQL queries
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
FriedConsole2000
9 months, 1 week ago
Is the question incorrectly missing a "NOT"? A, B and D are correct.
upvoted 1 times
...
santo_aj
1 year, 5 months ago
Selected Answer: D
Best practices for running within the Apex heap size Don't use class level variables to store a large amounts of data. Utilize SOQL For Loops to iterate and process data from large queries. Construct methods and loops that allow variables to go out of scope as soon as they are no longer needed.
upvoted 1 times
...
lorenac2
1 year, 10 months ago
Selected Answer: D
D is your best option to start with, but B is another. I have heard that A can be as well but I'm not entirely sure why. Reference: https://help.salesforce.com/s/articleView?id=000384468&type=1
upvoted 1 times
lorenac2
1 year, 10 months ago
Another article: https://help.salesforce.com/s/articleView?id=000385712&type=1
upvoted 1 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 ...