Courseiva

SF-PD2 Process Automation, Logic, and Integration Practice Question

A developer is building a Lightning web component that needs to display a list of accounts with their related contacts. The component uses a wire adapter to call an Apex method that returns a list of Account objects with a nested list of Contacts. The developer notices that the contacts are not displayed, and the Apex method returns the accounts correctly. What is the most likely cause?

⚠ Common exam trap

The trap here is assuming that the wire adapter or component cannot handle nested data, when the real issue is the Apex query not retrieving child records.

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

✓

The Apex method does not query the related contacts using a subquery or separate query, so the contact data is not included in the result.

The most likely cause is that the Apex method's SOQL query does not include the related contacts. To return parent-child data, the query must use a subquery or a separate query to fetch contacts. Without that, the contacts list will be empty. The wire adapter and component can handle nested data, but the data must be present in the Apex result. Ensuring the query includes the child records resolves the issue.

Answer analysis

Option-by-option breakdown

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

  • ✓

    The Apex method does not query the related contacts using a subquery or separate query, so the contact data is not included in the result.

    Why this is correct

    To include related records in an Apex method result, the SOQL query must explicitly retrieve them, typically using a subquery like SELECT Id, Name, (SELECT Id, Name FROM Contacts) FROM Account. If the developer only queries accounts, the contacts list will be empty. This is the most common oversight when returning parent-child data to Lightning web components.

  • ✗

    The Apex method returns a list of Account objects, but Lightning web components cannot handle nested objects in wire adapters.

    Why it's wrong here

    Lightning web components can handle nested objects returned from Apex, as long as the Apex method returns serializable data. The wire adapter provisions the entire result, including nested lists. The limitation is not with the component's ability to handle nested objects, but with the Apex query not fetching the related records. This statement is false.

  • ✗

    The Lightning web component does not use the @wire decorator correctly, so the data is not reactive.

    Why it's wrong here

    If the @wire decorator were used incorrectly, the entire data set would not be provisioned, not just the contacts. The component would not receive any accounts. Since accounts are displayed, the wire decorator is functioning. The issue is specifically with the nested contacts, which points to the Apex query rather than the component's wire configuration.

  • ✗

    The Apex method does not use the @AuraEnabled(cacheable=true) annotation, so the wire adapter cannot cache the data.

    Why it's wrong here

    The @AuraEnabled(cacheable=true) annotation is required for wire adapters to cache data, but its absence would cause the wire adapter to fail entirely, not just omit contacts. If the method is not cacheable, the wire adapter would not work, and an error would be thrown. The scenario states the accounts are returned, so the method is likely cacheable. This is not the cause of missing contacts.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

One of 226 original SF-PD2 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 September 2026 · checked against the official Salesforce exam blueprint

This SF-PD2 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 SF-PD2 exam.