SF-PD2 User Interface Practice Question
A developer needs a Lightning Web Component to expose a public method so that an Aura component on the same page can call it and pass a string parameter. Which approach should the developer use?
⚠ Common exam trap
The trap here is assuming that Lightning Message Service or a wire adapter can be used for direct method invocation, when only an @api-decorated method is callable from the parent Aura component.
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
✓
Define a public method in the LWC and annotate it with @api.
Lightning Web Components expose public methods to parent Aura components by decorating them with @api. The Aura component can then call the method on the LWC element reference. Other options either do not provide a callable instance method, use asynchronous messaging that lacks return values, or confuse data provisioning with method exposure, so they do not meet the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use Lightning Message Service to publish a message that the Aura component subscribes to.
Why it's wrong here
Lightning Message Service enables communication across DOM boundaries such as between Aura, LWC, and Visualforce, but it is asynchronous and does not provide a direct method call with a return value. The scenario requires the Aura component to call a public method on the LWC, which LMS does not support. LMS would be overkill and would not meet the synchronous invocation requirement.
- ✗
Declare the method inside a wire adapter in the LWC.
Why it's wrong here
Wire adapters are used to provision data reactively from Salesforce or custom adapters; they are not a mechanism for exposing callable methods to parent components. A wire adapter cannot be invoked directly by an Aura component with a string parameter. This option confuses data provisioning with component-to-component method invocation, so it fails the scenario.
- ✗
Define the method as a static method on the LWC class.
Why it's wrong here
Static methods belong to the class itself, not to component instances, and they are not exposed to the Aura component's element reference. The Aura component interacts with an instance of the LWC, so a static method would not be callable through the component instance. Therefore, this approach does not satisfy the requirement to call the method from Aura.
- ✓
Define a public method in the LWC and annotate it with @api.
Why this is correct
In Lightning Web Components, public properties and methods are exposed by decorating them with @api. When an Aura component contains an LWC, the Aura component can call the LWC's public method through the element reference. This is the documented interop pattern for Aura-to-LWC communication, so annotating the method with @api is the correct approach.
Visual reference
About these practice questions
Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.