Courseiva

SF-PD2 · domain

User Interface

The User Interface domain of Salesforce Certified Platform Developer II covers Lightning Web Components: composition, inter-component communication, rendering lifecycle, and localization. Questions present concrete LWC scenarios — nested hierarchies, shadow boundaries, timezone-aware date display, and internationalization — and ask you to select the correct API, event configuration, or Salesforce feature to implement the requirement.

39 questions8 easy16 medium15 hard

Focused practice

Practice User Interface questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about User Interface

Be able to choose the right LWC communication mechanism — @api, CustomEvent with bubbles/composed, or Lightning Message Service — and handle dates and translations with Intl, Custom Labels, and locale-aware formatting. The critical detail is setting composed on events that must cross shadow boundaries.

Lightning Message Service and pub-sub for cross-DOM communication beyond parent-child boundaries

CustomEvent with bubbles and composed flags to cross shadow boundaries in LWC hierarchies

JavaScript Intl object and Lightning formatted date/time for user-timezone display in LWC

Custom Labels and Salesforce locale/translation workbench for internationalizing LWC text and formatting

Watch out for

Common User Interface exam traps

  • ▸Assuming a bubbling CustomEvent crosses shadow boundaries by default; composed must be set to true explicitly.
  • ▸Using Lightning Message Service when a simple parent-to-child @api property or method would suffice.
  • ▸Hardcoding date formats or locale strings instead of using Intl or Salesforce-provided formatting and translation features.

Question index

All User Interface questions (39)

Click any question to see the full explanation, or start a practice session above.

1

A developer is building a Lightning Web Component that needs to navigate to a specific record page when a user clicks a button. The developer wants to use the NavigationMixin from lightning/navigation. The component is a child component nested inside another component, and the developer needs to ensure that the navigation works correctly. Which code snippet correctly uses NavigationMixin to navigate to an Account record page?

Hard
2

A developer is building a Lightning Web Component that should be embedded inside a Visualforce page. The LWC must receive a parameter passed from the Visualforce page and send an event back when a button is clicked. Which combination of features enables this integration?

Medium
3

A developer is building a Lightning Web Component that includes a button. When the button is clicked, the component must navigate the user to a specific Account record page in Lightning Experience. Which approach should the developer use?

Easy
4

A developer is building a Lightning Web Component that must display a toast notification when a record is saved successfully. The component uses lightning/platformShowToastEvent. Which import and usage are correct?

Hard
5

A developer needs a Lightning Web Component to navigate the user to a specific Account record's detail page when a button is clicked. Which approach is correct?

Easy
6

Refer to the exhibit. A developer is attempting to push source code to a scratch org and encounters the error shown. The developer confirms that 'utils.js' and 'utils.js-meta.xml' exist in the 'force-app/main/default/lwc/utils/' directory. What is the most likely cause of this error?

Hard
7

A developer has a Lightning Web Component named accountTile that exposes a public property accountName decorated with @api. A parent Aura component includes accountTile using <c:accountTile accountName="Acme"/>. During testing, the account name never appears. The developer confirms the property is set in the LWC constructor. What is the cause?

Medium
8

A developer is creating a Lightning Web Component that includes a button. When the button is clicked, the component should call an Apex method to save data. Which decorator should be used to expose the Apex method to the Lightning Web Component?

Easy
9

A developer is building a Lightning Web Component that must call an Apex method that performs a callout. The component is placed on a Lightning record page, and the Apex method is annotated with @AuraEnabled(cacheable=true). Users report that the callout never executes and an error is thrown. What is the most likely cause and the correct fix?

Hard
10

A developer is creating a Lightning Web Component to display a list of high-priority Opportunities. The component needs to reactively update whenever an Opportunity is updated elsewhere on the page by another component. Which approach is most efficient and requires the least amount of custom code?

Medium
11

A developer is building a Lightning Web Component that must expose a method to an Aura component wrapper so the Aura component can call it after a user action. The LWC method is decorated with @api and named doSomething. Which code in the Aura component correctly invokes it?

Hard
12

A developer is building a Lightning Web Component for a Lightning Experience app. The component contains a form with an <input> for a search term and a list of results. When the user types into the input, the component must call an Apex method that returns matching records. The developer observes that the Apex method is being invoked on every keystroke, causing excessive server calls. Which technique should the developer use to limit the number of Apex calls while still updating the results as the user types?

Medium
13

An enterprise Salesforce implementation requires a Lightning Web Component to display massive amounts of tabular data with extremely high rendering performance. The standard lightning-datatable component fails to meet performance SLAs during stress testing. Which architectural approach should the developer implement to optimize rendering performance?

Hard
14

A developer is creating a Lightning Web Component that needs to display a list of Contacts for a given Account. The component will be placed on a Lightning record page for Account. The developer wants to use the getRelatedListRecords wire adapter from lightning/uiRelatedListApi to fetch the contacts. Which two parameters are required in the wire configuration object for getRelatedListRecords? (Choose two.)

Hard
15

A developer is experiencing performance issues with a Visualforce page that includes multiple complex components and a large amount of data. The page uses a standard controller with several extensions. Which technique should the developer use to reduce the view state size and improve page load time?

Hard
16

A developer is building a Lightning Web Component that must navigate to a new record's detail page after the record is created via a custom form. The component uses NavigationMixin. Which navigation type should the developer use to navigate to the newly created record?

Medium
17

A developer is building a Lightning Web Component that must expose a public method callable from an Aura component on the same page. The method accepts a string and returns a promise that resolves with a boolean. Which TWO steps are required to make this method callable from the Aura parent? (Choose two.)

Hard
18

A developer is tasked with internationalizing a Lightning Web Component that will be deployed globally. Which TWO Salesforce features should be used to handle locale-specific formatting and translations? (Choose TWO)

Medium
19

A developer is building a Lightning Web Component that must render a large list of order records retrieved from Apex. The component displays each order's formatted total, which follows the user's locale (for example, 1.234,56 € in Germany versus $1,234.56 in the US). Which approach correctly formats each order total for the current user?

Medium
20

A developer has a Lightning Web Component that must call an imperative Apex method to save a record, then immediately display a toast confirming success only if the save actually succeeded. The Apex method returns a wrapper with a Boolean success flag and a message. Which imperative call pattern correctly handles both the success and error paths?

Hard
21

A developer is creating a Lightning Web Component that will be placed on a Lightning record page for the Case object. The component must display the case's subject and status. Which approach correctly retrieves the record data so the component updates automatically when the record changes?

Easy
22

A developer is building a Lightning Web Component that needs to communicate with a parent component in a deep containment hierarchy. The event must traverse shadow boundaries without stopping at component boundaries. Which property configuration should the developer apply when instantiating the CustomEvent?

Medium
23

A developer needs a Lightning Web Component placed on a record page to read the 18-character id of the record currently being viewed, without querying the database or calling Apex. Which approach provides this value directly?

Easy
24

A developer is building a Lightning Web Component for a Lightning Experience record page. The component must display a toast notification to the user after a successful save operation. The developer uses the ShowToastEvent from the lightning/platformShowToastEvent module. Which import statement is correct?

Medium
25

A developer is building a reusable Lightning Web Component that exposes public properties and methods to its parent, and needs to fire an event the parent can handle. Which TWO techniques are valid for this parent-child interaction? (Choose two.)

Hard
26

A developer wants to ensure that a Lightning Web Component is only available for use on Record Pages for the Account and Contact objects in the Lightning App Builder. How should the developer configure the component's metadata file?

Easy
27

A developer is building a Lightning Web Component that must surface a toast notification when an Apex callout returns a specific error code. The component is used inside a Salesforce mobile app and on desktop. Which module should the developer import to display the toast?

Medium
28

A developer is building a Lightning Web Component that includes a lightning-button. The button's click handler is defined as an arrow function in the component's JavaScript file. The developer wants to pass the event object to the handler to access the event's target. Which syntax should be used in the component's HTML template to correctly bind the handler and pass the event?

Medium
29

A developer is creating a Lightning Web Component that must expose a public property so that a parent Aura component can pass a record ID into it. The LWC is embedded inside the Aura component using aura:component with an attribute. Which decorator and configuration should the developer use on the LWC property?

Hard
30

A developer is building a complex nested Lightning Web Component structure. A deeply nested child component needs to notify an ancestor component, which is not the immediate parent, about a data change. Which configuration of the CustomEvent constructor should the developer use to ensure the event reaches the ancestor across the shadow DOM boundary?

Medium
31

A developer is building a Lightning Web Component that contains an iframe hosting an external web application. The external application needs to send a message back to the Lightning Web Component when a user completes a task. Which mechanism should the developer use to receive that message securely?

Hard
32

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?

Hard
33

A developer needs to display a read-only, formatted phone number on a Lightning record page. The value comes from a field on the record and should render consistently with Salesforce's standard phone formatting. Which base component should be used?

Easy
34

A developer is building a Lightning Web Component that must navigate the user to a new record's detail page after a successful Apex DML operation. Which module should the developer use to perform the navigation?

Medium
35

A developer is building a Lightning Web Component that needs to display a formatted date and time based on the user's timezone. Which standard JavaScript object, compatible with LWC, should be used to handle this without additional libraries?

Medium
36

A developer is building a Lightning Web Component that renders a custom list of navigation links. The component must follow the Salesforce Lightning Design System (SLDS) styling and remain accessible to screen readers. Which approach best satisfies both the styling and accessibility requirements?

Medium
37

A developer is creating a Lightning Web Component that needs to display a toast message when a record is saved successfully. The developer imports ShowToastEvent from lightning/platformShowToastEvent. Which code correctly dispatches a success toast with the title 'Saved' and message 'Record saved successfully'?

Easy
38

A developer is building a Lightning Web Component that must expose a public method so a parent component can programmatically trigger a refresh of the child's data. The child component's method is decorated with @api and named refreshData. The parent component holds a template reference to the child element. Which code in the parent correctly invokes the child method?

Medium
39

A developer is creating a Lightning Web Component that includes a lightning-input field for a phone number. The component must validate that the input matches a specific pattern before allowing the user to submit a form. The developer wants to use the built-in validation features of lightning-input. Which attribute should be set to enforce a custom validation pattern?

Hard

Frequently asked questions

What does the User Interface domain cover on the SF-PD2 exam?
Be able to choose the right LWC communication mechanism — @api, CustomEvent with bubbles/composed, or Lightning Message Service — and handle dates and translations with Intl, Custom Labels, and locale-aware formatting. The critical detail is setting composed on events that must cross shadow boundaries.
How many questions are in this domain?
This page lists all 39 User Interface questions in the SF-PD2 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only User Interface questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
salesforce-platform-developer-ii SALESFORCE-PLATFORM-DEVELOPER-II pd2 user interface Practice Questions