nerdexam
Salesforce

PDII · Question #314

Refer to the code below: When the code runs, it results in a System Limit Exception with the error message: Apex heap size too large. What should be done to fix this error?

The correct answer is A. Use a SOQL for loop to process the data. See the full explanation below for the reasoning.

Question

Refer to the code below:

When the code runs, it results in a System Limit Exception with the error message: Apex heap size too large. What should be done to fix this error?

Options

  • AUse a SOQL for loop to process the data.
  • BConvert the List into a Set.
  • CUse Limits.getLimitHeapSize().
  • DUse a try/catch block to catch the error.

How the community answered

(51 responses)
  • A
    82% (42)
  • B
    6% (3)
  • C
    10% (5)
  • D
    2% (1)

Community Discussion

No community discussion yet for this question.

Full PDII Practice