PD1 User Interface 3 — Questions and Answers
Question 1: What is the purpose of the lightning-record-edit-form component in LWC?
- To display a read-only summary of a record's fields
- To provide a form that creates or edits a record using Lightning Data Service (Correct answer)
- To render a Visualforce page inside an LWC
- To show related list records for a parent record
Correct answer: To provide a form that creates or edits a record using Lightning Data Service
lightning-record-edit-form uses Lightning Data Service under the hood to create or update records with built-in validation and FLS enforcement.
Question 2: In a Visualforce page, what does the 'standardController' attribute on <apex:page> specify?
- The name of the Apex class that extends StandardController
- The sObject type whose standard controller functionality the page uses (Correct answer)
- The CRUD permissions required to view the page
- The API version of the standard controller to use
Correct answer: The sObject type whose standard controller functionality the page uses
standardController='Account' (for example) wires the page to Salesforce's built-in Account controller, exposing save, edit, and delete actions automatically.
Question 3: Which LWC base component should a developer use to render a formatted currency value that respects the user's locale?
- lightning-formatted-text
- lightning-formatted-number (Correct answer)
- lightning-formatted-currency
- lightning-output-field
Correct answer: lightning-formatted-number
lightning-formatted-number with the format-style='currency' attribute renders currency values formatted to the user's locale settings.
Question 4: A developer wants to navigate to a record's detail page from an LWC. Which module must be imported?
- lightning/navigation (Correct answer)
- lightning/router
- lightning/pageReference
- c/navigationService
Correct answer: lightning/navigation
The lightning/navigation module provides the NavigationMixin, which is mixed into the component class to enable programmatic navigation.
Question 5: In Aura components, what is the equivalent of LWC's @wire decorator for reading Salesforce data?
- <aura:attribute> with type='Apex'
- <aura:handler> with event='force:recordData'
- force:recordData component with recordId attribute (Correct answer)
- apex:action tag in the component markup
Correct answer: force:recordData component with recordId attribute
The force:recordData component in Aura wires record data directly to the component, similar to how @wire works in LWC.
Question 6: What happens when you set the 'immutable' flag on a @track property in an Aura component?
- The property cannot be changed after the component renders
- Child components cannot modify the passed value directly
- The property change does not trigger a re-render
- Aura components do not support an 'immutable' flag on @track (Correct answer)
Correct answer: Aura components do not support an 'immutable' flag on @track
Aura's @track decorator does not have an 'immutable' flag; immutability in Aura is enforced by the Locker Service's proxy mechanism, not a decorator option.
Question 7: Which Visualforce global variable provides access to the currently logged-in user's information?
- {!$User} (Correct answer)
- {!$CurrentUser}
- {!$Profile}
- {!$Organization}
Correct answer: {!$User}
$User is the Visualforce global variable that exposes fields of the running user, such as $User.FirstName and $User.Id.
What is the purpose of the lightning-record-edit-form component in LWC?