Courseiva
Process Automation And LogichardMultiple ChoiceObjective-mapped

SALESFORCE-PD1 Process Automation And Logic Practice Question

A developer has a Queueable Apex job that needs to query large volumes of data and perform updates. To optimize performance and avoid heap size limits, what is the best practice when querying records inside a Queueable Apex job?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Implement the Database.Batchable interface instead of Queueable.

Querying records using a SOQL Query Locator inside a batch or leveraging iterable queries helps manage memory efficiently, but for Queueable jobs, querying using SOQL for loops or batching ids helps avoid heap limits.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Assign all queried records to a single global List variable in the class.

    Why it's wrong here

    Incorrect. Storing all records in a single list easily leads to heap size limit exceptions for large datasets.

  • Set the method execution context to read-only using @ReadOnly.

    Why it's wrong here

    Incorrect. Queueable classes cannot be annotated with @ReadOnly.

  • Implement the Database.Batchable interface instead of Queueable.

    Why this is correct

    Correct. While Batchable is better for massive datasets, SOQL for-loops are the correct tool within Queueable to manage heap size.

  • Use a SOQL for-loop to iterate over query results chunk by chunk.

    Why this is correct

    Correct. SOQL for-loops process records in chunks of 200 using internal heap allocation, preventing heap size limits.

About these practice questions

One of 488 original SALESFORCE-PD1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Salesforce exam blueprint

This SALESFORCE-PD1 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SALESFORCE-PD1 exam.