Courseiva

CCNA User Interface Questions

75 of 122 questions · Page 1/2 · User Interface · Answers revealed

1
MCQeasy

A developer is writing a Visualforce page and wants to include standard Salesforce styling and icons. What tag should be added to the top of the Visualforce page?

A.<apex:lightningStyleguide />
B.<apex:stylesheet value="{!$Resource.SLDS}" />
C.<apex:includeLightning />
D.<apex:slds />
AnswerD

Correct because <apex:slds /> includes SLDS resources in Visualforce.

Why this answer

<apex:slds /> includes the Salesforce Lightning Design System styles and assets in a Visualforce page.

2
MCQeasy

Which lifecycle hook in a Lightning Web Component is called after every render of the component?

A.constructor
B.connectedCallback
C.errorCallback
D.renderedCallback
AnswerD

Called after every render of the component.

Why this answer

renderedCallback() is called after every render of the component, useful for DOM manipulation after rendering.

3
MCQmedium

An LWC component uses a wire adapter to fetch account records. The developer needs to update the parameters passed to the wire adapter dynamically based on user input. How should this be implemented?

A.Call the wire adapter imperatively inside a JavaScript function.
B.Mark the property as @track and reference it in a reactive wire property or function.
C.Use standard hidden HTML inputs to store state.
D.Reload the entire browser page using window.location.reload().
AnswerB

Reactive properties in wire arguments cause the wire to re-provision data when changed.

Why this answer

Using a getter property or tracked reactive property referenced in a @wire decorator allows dynamic parameter updates.

4
MCQeasy

A developer is building a Lightning Web Component and wants to define a property that can be set by a parent component. Which decorator is required?

A.@track
B.@api
C.@auraEnabled
D.@wire
AnswerB

Correct because @api exposes public properties to parent components.

Why this answer

The @api decorator exposes a public property or method, making it accessible to parent components.

5
Multi-Selecteasy

Which THREE statements are true regarding the standard Salesforce Lightning Design System (SLDS)? Choose 3 answers.

Select 3 answers
A.SLDS relies on external third-party UI frameworks like Bootstrap for grid styling.
B.SLDS is automatically included in Lightning experience pages to maintain a consistent UI.
C.SLDS classes can be used in Lightning Web Components, Aura components, and Visualforce pages.
D.SLDS provides a design token system that allows customization using styling hooks.
E.Developers must manually upload all SLDS CSS and image files as static resources for every project.
AnswersB, C, D

Correct. The platform automatically includes SLDS styling context for Lightning components.

Why this answer

SLDS is built into the Salesforce platform, provides CSS framework styling matching the Salesforce look-and-feel, and can be used in both LWC and Visualforce.

6
MCQeasy

A developer is writing a Visualforce page and wants to display messages generated by controllers or validation rules. Which component should be used?

A.<apex:pageMessages />
B.<apex:errorMessages />
C.<apex:outputPanel type="messages" />
D.<apex:messageLog />
AnswerA

Correct because <apex:pageMessages> renders system and custom error messages.

Why this answer

<apex:pageMessages /> displays all messages queued on the page for the current request.

7
Multi-Selecteasy

Which TWO statements are true regarding the differences between Aura components and Lightning Web Components (LWC)? (Choose TWO)

Select 2 answers
A.LWC components cannot contain HTML markup tags.
B.Aura components are required for all modern mobile app development while LWC is restricted to desktop only.
C.Lightning Web Components take advantage of native web standards built directly into modern browsers.
D.Aura components use standard Shadow DOM encapsulation without component-specific framework abstractions.
E.Lightning Web Components execute with better performance because they run on native browser engine features.
AnswersC, E

Correct because LWC leverages standard web components and modern ECMAScript.

Why this answer

LWC builds on native web standards and modern JS, whereas Aura relies on an older framework architecture.

8
Multi-Selecthard

Which THREE features or capabilities are supported by the Lightning Message Service (LMS)? Choose 3 answers.

Select 3 answers
A.Communication between unrelated components on the same Lightning page.
B.Communication between Visualforce pages and Lightning Web Components.
C.Communication across components in different browser tabs.
D.Communication between Aura components and Lightning Web Components.
E.Executing asynchronous server-side database updates automatically.
AnswersA, B, D

LMS enables publisher-subscriber pattern across the page.

Why this answer

LMS supports communication across DOM boundaries, between Visualforce, Aura, and LWC.

9
MCQhard

A developer is configuring a Lightning Web Component to be used as a Quick Action on a record page. Which target configuration must be added to the component's metadata file?

A.lightning__AppPage
B.lightning__RecordAction
C.lightning__RecordPage
D.lightning__Tab
AnswerB

Enables the component as a record quick action.

Why this answer

lightning__RecordAction enables a component to be used as a record-level quick action.

10
MCQmedium

A developer is building a Visualforce page and wants to execute an action method on the controller when a user clicks a button, without performing a full page reload. Which component should be wrapped around the area to be updated?

A.apex:pageBlock
B.apex:form
C.apex:outputPanel with rerender attribute
D.apex:actionFunction
AnswerC

Enables AJAX partial page rendering.

Why this answer

<apex:actionRegion> or <apex:outputPanel> with <apex:actionSupport> or <apex:commandButton rerender=...> performs partial page updates.

11
MCQhard

A developer is troubleshooting an issue where a Lightning Web Component is not picking up changes to the internal fields of an object property. What is the cause of this behavior in LWC reactivity?

A.Reactive properties must be declared as constants using const instead of let.
B.LWC reactivity is shallow, so nested object property mutations require creating a new object reference or using @track.
C.The component must be wrapped in an Aura container to enable deep object tracking.
D.LWC does not support objects as reactive properties under any circumstances.
AnswerB

Correct because LWC tracks changes at the reference level for plain objects unless observed via @track.

Why this answer

LWC reactivity is shallow; mutating properties of a nested object without reassigning the reference requires @track or creating a new object reference.

12
Multi-Selecteasy

Which TWO tools or features are recommended for styling Lightning Web Components according to best practices? Choose 2 answers.

Select 2 answers
A.Global un-scoped CSS stylesheets loaded in every page
B.Component-scoped CSS style files (.css)
C.Salesforce Lightning Design System (SLDS) utility classes
D.Inline style tags in HTML templates
E.Bootstrap CSS framework via static resource
AnswersB, C

LWC automatically scopes CSS styles defined in a companion .css file.

Why this answer

SLDS utility classes and scoped CSS stylesheets are the standard ways to style LWC.

13
MCQeasy

A developer creates a Visualforce page and wants to include standard Salesforce styling. Which attribute on the <apex:page> tag enables this?

A.lightningStylesheets="true"
B.standardStylesheets="true"
C.applyHtmlTag="true"
D.sidebar="true"
AnswerB

Includs standard Salesforce styles on the page.

Why this answer

The standardStylesheets attribute controls whether standard Salesforce styling is applied.

14
Multi-Selectmedium

A developer is working with component styling and design tokens in Lightning Web Components. Which TWO practices apply when working with SLDS styling in LWC? (Choose TWO)

Select 2 answers
A.Use the !important declaration on every CSS rule to bypass Salesforce CSS encapsulation.
B.Prefer standard SLDS utility classes over custom hardcoded CSS rules for padding and margins.
C.Write global CSS stylesheets in static resources and include them in every component using standard HTML <link> tags.
D.Override component-internal shadow DOM styles from a parent component's CSS file without styling hooks.
E.Use SLDS design tokens via CSS custom properties (e.g., var(--lwc-spacingMedium)).
AnswersB, E

Correct because SLDS utility classes ensure consistency and theme adaptability.

Why this answer

SLDS design tokens can be used via var() CSS variables, and standard SLDS classes should be preferred over custom CSS where possible.

15
MCQmedium

A developer is building a Lightning Web Component and wants to iterate over a list of items in the HTML template. Which directive should be used?

A.<template repeat={item in items}>
B.<aura:iteration items="{!v.items}" var="item">
C.<apex:repeat value="{!items}" var="item">
D.<template for:each={items} for:item="item">
AnswerD

Correct because for:each is the standard iteration directive in LWC.

Why this answer

Iteration in LWC templates uses the <template for:each={list} for:item={item}> construct.

16
MCQeasy

Which base Lightning component should be used in an LWC to display a standard button?

A.lightning:button
B.apex:commandButton
C.lightning-button
D.ui:button
AnswerC

Standard LWC component for buttons.

Why this answer

lightning-button is the standard base component for buttons in LWC.

17
MCQeasy

A developer needs to create a Lightning Web Component configuration file. What is the required file extension and naming convention?

A.componentName.cmp-meta.xml
B.componentName.xml
C.componentName.config.xml
D.componentName.js-meta.xml
AnswerD

Correct because .js-meta.xml is the required extension and format for LWC metadata files.

Why this answer

LWC configuration files are named componentName.js-meta.xml.

18
MCQhard

A developer is using the Lightning Message Service and needs to unsubscribe from a message channel when a component is destroyed. In which lifecycle hook should unsubscribe be called?

A.connectedCallback
B.constructor
C.disconnectedCallback
D.renderedCallback
AnswerC

Used for cleanup and unsubscription.

Why this answer

disconnectedCallback is used for cleanup tasks like unsubscribing from message channels or removing event listeners when a component is removed from the DOM.

19
MCQmedium

A developer is writing an Aura component and needs to handle an event fired by a child component. Which attribute is required in the aura:handler tag on the parent component?

A.name
B.method
C.controller
D.event
AnswerD

Specifies the fully qualified name of the event.

Why this answer

The event attribute on aura:handler specifies the event name to handle.

20
MCQeasy

Which base Lightning component is used to show a progress indicator or spinner in LWC?

A.ui:spinner
B.lightning-spinner
C.apex:spinner
D.lightning-progress
AnswerB

Standard component for loading indicators.

Why this answer

lightning-spinner is the standard component for loading spinners in LWC.

21
Multi-Selecteasy

Which TWO tools or environments are officially supported for developing Lightning Web Components? (Choose TWO)

Select 2 answers
A.Microsoft FrontPage 2003
B.Visual Studio Code with the Salesforce Extension Pack
C.Eclipse IDE with the Force.com IDE v1 plugin
D.Salesforce CLI (sfdx / sf)
E.Dreamweaver MX with custom snippet extensions
AnswersB, D

Correct because VS Code is the primary supported IDE for LWC.

Why this answer

Visual Studio Code with the Salesforce Extension Pack and Salesforce CLI are standard tools for LWC development.

22
MCQhard

A developer creates a parent Lightning Web Component containing a child component. The parent needs to call a public method defined inside the child component. How is this accomplished?

A.Use the publish() method of the Lightning Message Service.
B.Update a shared reactive property passed down via @api.
C.Dispatch an event from the parent and listen to it in the child component.
D.Use this.template.querySelector('c-child-component').publicMethodName() in the parent component.
AnswerD

Correct because querying the child component reference allows calling its exported @api methods.

Why this answer

A parent component can invoke a public method on a child component by querying the child element and calling the method directly.

23
Multi-Selecteasy

A developer is building a Lightning Web Component and wants to style it using Salesforce Lightning Design System (SLDS). Which TWO statements are true regarding SLDS usage in LWC? (Choose TWO)

Select 2 answers
A.Custom CSS styles written in LWC automatically leak into child components.
B.Developers must upload SLDS as a static resource and reference it via loadStyle for every component.
C.SLDS styles are automatically available in LWC without needing to import static resources.
D.SLDS design tokens cannot be used within component CSS files.
E.SLDS utility classes follow the BEM naming convention.
AnswersC, E

Correct because SLDS is natively built into the Lightning Experience platform.

Why this answer

SLDS is natively available in LWC without static resource uploads, and utility classes are used for styling.

24
Multi-Selecthard

A developer is utilizing the Lightning Message Service (LMS) to facilitate communication between an Aura component and a Lightning Web Component. Which THREE steps are required to implement LMS successfully? (Choose THREE)

Select 3 answers
A.Define a Message Channel in XML format under the /messageChannels/ directory.
B.Import the Message Channel reference into the LWC using '@salesforce/messageChannel/ChannelName__c'.
C.Create an Apex trigger to listen to the Message Channel on the server side.
D.Use publish() or subscribe() functions from the 'lightning/messageService' module.
E.Configure the component metadata file with <target>lightning__MessageChannel</target>.
AnswersA, B, D

Correct because Message Channels are defined as metadata files in the force-app directory.

Why this answer

LMS requires defining a Message Channel metadata file, importing the channel in the component, and calling publish or subscribe APIs.

25
MCQmedium

A developer is building an Aura component and needs to include a Lightning Web Component inside it. How does the Aura markup reference the LWC?

A.<c:myLwcComponent />
B.<apex:includeComponent name="myLwcComponent" />
C.<lightning:lwc name="myLwcComponent" />
D.<aura:component include="myLwcComponent" />
AnswerA

Correct because Aura references LWC using standard kebab-case or camelCase converted to namespace tag syntax.

Why this answer

Aura components reference LWC using the syntax c:lwnComponentName where 'c' is the namespace.

26
Multi-Selectmedium

Which TWO conditions must be met for an Apex method to be wired using the @wire service in an LWC? Choose 2 answers.

Select 2 answers
A.The Apex method must return a DML operation result.
B.The Apex method must be public or global and static.
C.The Apex method must return a PageReference.
D.The Apex method must be annotated with @AuraEnabled(cacheable=true).
E.The Apex method must be asynchronous using @future.
AnswersB, D

Wire methods must be static and accessible.

Why this answer

Wired Apex methods must be static, public or global, and annotated with @AuraEnabled(cacheable=true).

27
MCQhard

A developer creates a custom LWC that wraps child components. The developer needs to pass styling from the parent component into specific slots of the child component. Which CSS selector should be used inside the child component to style content passed into a slot?

A.:content
B.:scope
C.:host
D.::slotted()
AnswerD

Applies styles to elements that are distributed into a slot.

Why this answer

The ::slotted() pseudo-class selector is used in the child component's stylesheet to target nodes slotted into a <slot> element.

28
Multi-Selectmedium

A developer is implementing communication in Lightning Web Components. Which TWO mechanisms are valid for passing data or messages between components? (Choose TWO)

Select 2 answers
A.Directly assigning properties on child components from sibling components.
B.Dispatching and listening to CustomEvent instances in parent-child hierarchies.
C.Using application events via $A.get('e.force:event') in LWC.
D.Modifying global window variables shared across component scopes.
E.Using Lightning Message Service (LMS) to publish and subscribe across the DOM.
AnswersB, E

Correct because CustomEvent is standard for child-to-parent communication.

Why this answer

Custom events (child to parent) and Lightning Message Service (unrelated components) are standard mechanisms.

29
MCQmedium

A developer needs to display a toast notification in a Lightning Web Component when a record is successfully saved. Which module should the developer import?

A.import { Toast } from 'lightning/toast';
B.import ShowToast from 'force:showToast';
C.import { ShowToastEvent } from 'lightning/platformShowToastEvent';
D.import { showNotification } from 'lightning/notificationsLibrary';
AnswerC

Correct because ShowToastEvent is the standard module for displaying toasts.

Why this answer

Lightning Toast notifications are triggered by importing ShowToastEvent from 'lightning/platformShowToastEvent'.

30
MCQeasy

Which tag is used in Visualforce to output field labels and values dynamically based on sObject field definitions?

A.<apex:field>
B.<apex:inputField>
C.<apex:outputText>
D.<apex:outputField>
AnswerD

Renders sObject field data with field-level security and formatting.

Why this answer

<apex:outputField> renders field values with correct formatting and related labels.

31
Multi-Selecthard

A developer is troubleshooting lifecycle hooks and rendering behavior in a Lightning Web Component. Which THREE statements are correct regarding LWC lifecycle execution order? (Choose THREE)

Select 3 answers
A.The constructor() is invoked before the component is inserted into the DOM.
B.renderedCallback() only executes once during the lifetime of the component.
C.connectedCallback() is invoked when the component is inserted into the DOM.
D.disconnectedCallback() is invoked when the component is removed from the DOM.
E.renderedCallback() is invoked before connectedCallback().
AnswersA, C, D

Correct because the constructor initializes the component instance before DOM insertion.

Why this answer

Constructor runs first, then connectedCallback, then renderedCallback after render.

32
MCQeasy

What is the correct syntax to reference a custom label in a Lightning Web Component JavaScript file?

A.Label.get('LabelName')
B.System.Label.LabelName
C.$Label.LabelName
D.import labelName from '@salesforce/label/LabelName';
AnswerD

Correct import syntax for LWC JS.

Why this answer

Custom labels are imported from @salesforce/label/Namespace.LabelName.

33
MCQhard

A developer needs to pass data from a child Lightning Web Component to a parent Lightning Web Component up the component hierarchy. What is the standard mechanism to achieve this?

A.Use the @api decorator in the child component to expose a public method that the parent can call directly.
B.Dispatch a CustomEvent in the child and handle it in the parent's template using an event listener directive.
C.Publish a message using the Lightning Message Service from the child and subscribe in the parent.
D.Mutate a shared global reactive property imported from a common utility JavaScript module.
AnswerB

Correct because CustomEvent is the standard mechanism for child-to-parent communication.

Why this answer

Child-to-parent communication in LWC is achieved by dispatching a custom event using CustomEvent and listening to it in the parent template.

34
Multi-Selectmedium

A developer is configuring a Lightning Web Component to accept design attributes in the Lightning App Builder. Which THREE files make up a complete LWC bundle that supports App Builder configuration properties? (Choose THREE)

Select 6 answers
A.componentName.js-meta.xml
B.componentName.cmp
C.componentName.apex
D.componentName.html
E.componentName.js-meta.xml
.componentName.design
.componentName.js
.componentName.html
.componentName.js
AnswersA, D, E

Correct part of bundle.

Why this answer

A complete configurable LWC bundle includes the HTML template, JavaScript controller, metadata file (.js-meta.xml), and design file (.design).

35
MCQmedium

A developer needs to include a third-party style sheet in a Lightning Web Component. What is the standard way to load CSS styles that are stored as a static resource?

A.import { loadStyle } from 'lightning/platformResourceLoader';
B.Declaring the stylesheet in the component's metadata configuration file under <stylesheets>.
C.import stylesheet from '@salesforce/resourceUrl/myCSS';
D.Using a standard <link> tag pointing directly to the static resource URL in the HTML template.
AnswerA

Correct because loadStyle is used to load static resource CSS files.

Why this answer

Third-party stylesheets are loaded using loadStyle from 'lightning/platformResourceLoader' inside connectedCallback.

36
MCQeasy

Which CSS methodology forms the foundation of the styling architecture in Salesforce Lightning Design System (SLDS)?

A.Bootstrap grid standards
B.BEM (Block Element Modifier)
C.OOCSS exclusively without modifiers
D.Tailwind utility prefixes
AnswerB

Correct because SLDS utilizes BEM naming conventions.

Why this answer

SLDS is built using BEM (Block Element Modifier) methodology for class naming conventions.

37
MCQhard

A developer is working with the Lightning Data Service (LDS) via the @wire decorator to get record data. The record is updated elsewhere in the app, and the developer wants to imperatively refresh the wire data cache. Which function should be called?

A.refreshApex()
B.rehashData()
C.force:refreshView
D.reloadRecord()
AnswerA

Correct because refreshApex refreshes the cache for Apex wire adapters.

Why this answer

refreshApex() is used to refresh the data provisioned by an Apex wire adapter, while getRecordNotifyChange is used for LDS wire adapters. Wait, refreshApex is for Apex, and notifyRecordUpdateAvailable is for LDS. Let's use refreshApex for an Apex wire adapter context.

38
MCQmedium

A developer is building a Lightning Web Component and needs to dispatch a custom event. Which constructor should be used to create the event?

A.Event
B.AuraEvent
C.CustomEvent
D.LightningEvent
AnswerC

Standard constructor for custom events carrying detail payloads.

Why this answer

CustomEvent is the standard browser constructor used to create custom events in LWC.

39
MCQmedium

A developer is working with a Visualforce page and wants to display a list of Account records using standard styling that matches the Salesforce Classic UI. Which component should the developer include?

A.<apex:sldsGrid>
B.<apex:pageBlockTable>
C.<apex:lightningStylesheets>
D.<apex:outputStandardTable>
AnswerB

Correct because <apex:pageBlockTable> formats tabular data matching the standard Salesforce look and feel.

Why this answer

The <apex:enhancedList> or <apex:relatedList> components allow developers to display lists with standard Salesforce formatting.

40
Multi-Selectmedium

Which TWO methods can be used to navigate to a standard Salesforce object's home page from a Lightning Web Component? Choose 2 answers.

Select 2 answers
A.Using force:navigateToSObject Aura event.
B.Using window.location.assign() with hardcoded Salesforce URLs.
C.Using NavigationMixin.Navigate with type 'standard__objectPage' and actionName 'home'.
D.Using NavigationMixin.GenerateUrl to create a bookmarkable link for the object home.
E.Using lightning/uiRecordApi navigation methods.
AnswersC, D

Standard navigation mixin type for object pages.

Why this answer

NavigationMixin with standard__objectPage and actionName 'home' navigates to an object's home page.

41
MCQhard

A Lightning Web Component needs to communicate an event up to a grandparent component that is nested two levels above. What is the best practice to achieve this in LWC?

A.Use the pubsub utility pattern by importing a shared JavaScript pubsub library
B.Use a global Lightning Message Service context to broadcast the event across components
C.Use standard browser CustomEvent with bubbles: true and composed: false
D.Dispatch an Aura Application Event from within the LWC container
AnswerC

Correct. Setting bubbles: true allows the event to traverse up the DOM tree to parent and grandparent components.

Why this answer

Custom events in LWC bubble up the DOM tree by default when constructed with { bubbles: true, composed: false }, allowing parent and grandparent components to listen for them.

42
MCQmedium

A developer needs to navigate to a record detail page from a Lightning Web Component. Which service should be used?

A.lightning/pageReference
B.window.location.href
C.lightning/uiRecordApi
D.lightning/navigation
AnswerD

Provides navigation service methods.

Why this answer

NavigationMixin from lightning/navigation is used for navigation in LWCs.

43
MCQmedium

A developer wants to conditionally display an HTML element in a Lightning Web Component template based on a boolean property named 'isVisible'. Which directive should be used?

A.renderIf
B.aura:if
C.v:if
D.lwc:if
AnswerD

Conditionally renders DOM elements based on a boolean expression.

Why this answer

lwc:if is the modern conditional directive in LWC.

44
Multi-Selectmedium

A developer is designing a Lightning Web Component that needs to communicate with another component located anywhere in the application hierarchy, including unrelated components. Which TWO mechanisms are valid and appropriate for this requirement? Choose 2 answers.

Select 2 answers
A.A shared pub/sub utility module imported into both components
B.Aura Application Events
C.Lightning Message Service (LMS)
D.Direct parent-to-child property passing via public properties (@api)
E.Standard DOM CustomEvent with bubbles set to true
AnswersA, C

Correct. A custom pub/sub utility using EventTarget or custom events allows decoupled components to communicate.

Why this answer

Lightning Message Service (LMS) and custom PubSub patterns built on top of standard browser events or custom event dispatchers are suited for communication across unrelated components.

45
MCQmedium

A developer needs to configure a Lightning Web Component to be available for use on Lightning Record Pages. Which configuration entry must be present in the component's metadata file (.js-meta.xml)?

A.lightning__AppPage
B.lightning__GlobalAction
C.lightning__RecordPage
D.lightning__UtilityBar
AnswerC

Enables the component for record pages.

Why this answer

lightning__RecordPage target enables a component to be placed on record pages.

46
MCQeasy

Which tag is used in Visualforce to include custom CSS stylesheets?

A.<apex:stylesheet>
B.<link rel="stylesheet" ...>
C.<apex:css>
D.<apex:style>
AnswerA

Includes a stylesheet in the page.

Why this answer

<apex:stylesheet> is used to include external CSS files in Visualforce.

47
MCQmedium

A developer needs to format a currency value according to the user's locale in a Lightning Web Component HTML template. Which base component should be used?

A.lightning-input
B.apex:outputText
C.ui:outputCurrency
D.lightning-formatted-number
AnswerD

Supports currency formatting based on user locale.

Why this answer

lightning-formatted-number with format-style="currency" or lightning-formatted-text is used for formatting.

48
MCQeasy

A developer needs to create a custom tab for a Lightning Web Component so it can be navigated to from the App Launcher. What type of custom tab must be created?

A.Lightning Component Tab
B.Visualforce Tab
C.Object Tab
D.Web Tab
AnswerA

Correct because Lightning Component Tabs expose LWC to the App Launcher and navigation menus.

Why this answer

Lightning component tabs allow Lightning Web Components and Aura components to be exposed as tabs.

49
MCQhard

A developer is working with a Lightning Web Component and needs to access a child component's public method from the parent component. How is this achieved?

A.Bind the child method to a public @api property on the parent.
B.Fire an application event from the parent to the child.
C.Use document.getElementById() to find the child element.
D.Invoke the method directly on the child element reference obtained via template.querySelector().
AnswerD

Public child methods are callable directly from the parent via the component reference.

Why this answer

Public methods on child components must be decorated with @api and invoked via this.template.querySelector().methodName().

50
MCQeasy

A developer is styling a Lightning Web Component using the Salesforce Lightning Design System (SLDS). To ensure the component adheres to the standard styling guidelines for spacing, what should the developer use?

A.SLDS standard spacing utility classes.
B.Inline styles directly in the HTML template.
C.Standard HTML blockquote tags with custom margin properties.
D.Hardcoded pixel values in the component's CSS file.
AnswerA

Correct because SLDS utility classes provide consistent, standardized spacing.

Why this answer

SLDS provides predefined design tokens and CSS utility classes (such asslds-m-around_medium) for consistent spacing.

51
MCQmedium

A developer has created a custom Aura component that needs to be embedded within a Lightning Web Component. What is the correct rule regarding component composition between Aura and LWC?

A.LWC can directly contain Aura components in its markup.
B.Neither framework can consume components from the other framework.
C.Aura components can contain Lightning Web Components in their markup.
D.Both frameworks can freely nest each other without restrictions.
AnswerC

Correct because Aura components support embedding Lightning Web Components.

Why this answer

An LWC can contain an Aura component, provided the Aura component is wrapped or referenced according to framework rules, but Aura cannot directly contain arbitrary LWC without proper wrapping. Wait, actually, LWC can contain Aura components? No, LWC can contain Aura components ONLY if they are wrapped, but more precisely, Aura components CAN contain LWC. Let's verify: Aura can contain LWC, but LWC cannot contain Aura directly.

Let's adjust the options.

52
MCQeasy

Which lifecycle hook in a Lightning Web Component runs after every render of the component?

A.constructor()
B.connectedCallback()
C.renderedCallback()
D.render()
AnswerC

Correct because renderedCallback runs after every render cycle.

Why this answer

renderedCallback() is called after every render of the component, useful for post-rendering DOM manipulation.

53
MCQmedium

A developer is configuring a Lightning Web Component metadata file to allow the component to be placed on a FlexPage. Which tag defines the configuration regions or design properties?

A.Inside the component-name.html template using special attribute tags.
B.Using global variables in the component's JavaScript controller file.
C.A separate component-name.design file in the bundle.
D.Inside the component-name.js-meta.xml file under the <design> tag.
AnswerC

Correct because design files define attributes exposed in the Lightning App Builder.

Why this answer

The <masterLabel> and <targets> are used, but design properties are defined in a separate design file (.design). Wait, configuration regions for App Builder properties are defined in the .design file for Aura, but in LWC design properties are also in a .design file. Let's frame the question around design files.

54
MCQmedium

A developer is creating a Lightning Web Component that needs to display a list of Accounts. The developer wants to fetch the data imperatively when a user clicks a button rather than automatically via a wire adapter. What is the correct approach?

A.Use the @api track decorator on the Apex method call inside the template.
B.Use the @wire decorator on an imported Apex method and update a reactive property.
C.Configure the component metadata file to fetch the data imperatively on load.
D.Call the imported Apex method as a JavaScript function inside the button's event handler and handle the returned promise.
AnswerD

Correct because imperative Apex is called as a function returning a promise inside an event handler.

Why this answer

Imperative Apex calls are invoked as standard JavaScript promises, typically triggered by an event handler such as a button click.

55
MCQeasy

A developer wants to style a Lightning Web Component using the Salesforce Lightning Design System (SLDS). What is the recommended way to include SLDS styling?

A.Use standard SLDS utility classes directly in the component's HTML template.
B.Import the full SLDS stylesheet explicitly as a static resource.
C.Apply standard Bootstrap classes to match Salesforce themes.
D.Use inline styles exclusively for all components.
AnswerA

SLDS classes are available by default in Salesforce environments.

Why this answer

LWC natively incorporates SLDS styling when using standard base components, but custom styling should use standard SLDS CSS utility classes.

56
Multi-Selecteasy

Which TWO features are provided out-of-the-box by Visualforce when building standard user interfaces? (Choose TWO)

Select 2 answers
A.Client-side reactive shadow DOM encapsulation.
B.Automatic compilation of TypeScript into native browser bytecode.
C.Automatic enforcement of CRUD and FLS when using standard controllers.
D.Real-time bidirectional WebSocket synchronization across all connected browser tabs.
E.Built-in view state management for form submission and page state tracking.
AnswersC, E

Correct because standard controllers automatically respect object and field permissions.

Why this answer

Visualforce provides automatic CRUD/FLS enforcement with standard controllers and built-in view state management.

57
MCQmedium

A developer wants to prevent sensitive fields from being included in the Visualforce view state to reduce size. Which keyword should be added to the field declaration in the controller?

A.private
B.static
C.transient
D.final
AnswerC

Excludes variables from the Visualforce view state.

Why this answer

transient keyword prevents variables from being saved in the view state.

58
Multi-Selectmedium

Which TWO configuration files or metadata elements are required when creating a Lightning Web Component? Choose 2 answers.

Select 2 answers
A.A CSS stylesheet (.css)
B.A JavaScript file (.js)
C.An Apex controller class
D.A metadata configuration file (.js-meta.xml)
E.An Aura dependency bundle (.auradoc)
AnswersB, D

Defines component logic and class.

Why this answer

Every LWC requires an HTML template file and a metadata configuration XML file.

59
Multi-Selecteasy

Which TWO actions can a developer perform using standard Visualforce controllers? Choose 2 answers.

Select 2 answers
A.Write complex multi-object business logic with custom SQL-like joins.
B.Perform standard save, delete, and cancel database operations without writing custom Apex code.
C.Instantiate custom web service callouts automatically.
D.Access field values of the record being viewed or edited.
E.Override standard page layouts without any configuration.
AnswersB, D

Standard controller built-in actions handle standard DML.

Why this answer

Standard controllers allow basic DML operations like save and delete, and provide access to record fields.

60
MCQeasy

Which SLDS utility class should a developer use to add a standard margin around a container?

A.slds-grid
B.slds-m-around_medium
C.slds-padding_medium
D.slds-margin-all
AnswerB

Applies a medium margin around all sides of an element.

Why this answer

SLDS spacing classes follow the pattern slds-m-{sides}-{size}.

61
Multi-Selecteasy

A developer is creating a Lightning Web Component that needs to interact with Salesforce data using Lightning Data Service. Which TWO wire adapters are natively available in the @salesforce/apex or lightning/ui* modules for basic record operations? (Choose TWO)

Select 2 answers
A.getAccountList from 'lightning/accountApi'
B.getRecordUi from 'lightning/uiRecordApi'
C.getRecord from 'lightning/uiRecordApi'
D.fetchRecord from 'lightning/recordStore'
E.queryDatabase from 'lightning/database'
AnswersB, C

Correct because getRecordUi is a standard LDS wire adapter for layout and record data.

Why this answer

getRecord and getRecordUi are standard wire adapters provided by lightning/uiRecordApi for working with Salesforce records.

62
MCQeasy

A developer is creating a Visualforce page that overrides the standard Account View action. Which attribute must be included in the <apex:page> tag to ensure standard controller functionality?

A.controller="Account"
B.object="Account"
C.recordId="Account"
D.standardController="Account"
AnswerD

Correct because standardController specifies the object context.

Why this answer

The standardController attribute binds a Visualforce page to a standard Salesforce object.

63
Multi-Selecthard

A developer is implementing error handling for an imperative Apex call in a Lightning Web Component. Which THREE properties or techniques are standard for catching and inspecting errors returned from Apex promises? (Choose THREE)

Select 3 answers
A.Using a .catch(error => { ... }) block on the returned promise.
B.Using try/catch blocks with asynchronous/await syntax when calling imperative Apex.
C.Reading error.stackTrace to automatically rollback database transactions on the client.
D.Calling error.retry() to automatically re-execute the failed database transaction.
E.Inspecting error.body.message to retrieve the specific error message thrown by Apex.
AnswersA, B, E

Correct because imperative Apex returns a promise that uses .catch for error handling.

Why this answer

Imperative Apex returns promises where errors can be caught in .catch(), inspected via error.body.message, or handled via standard JavaScript error objects.

64
Multi-Selecthard

A developer is reviewing a Lightning Web Component that makes calls to an Apex controller. Which THREE best practices should be followed when designing the Apex methods for LWC consumption? (Choose THREE)

Select 3 answers
A.Use primitive data types or simple serializable wrapper classes for parameters and return values.
B.Ensure Apex methods enforce object and field-level security (FLS) where appropriate.
C.Mark all Apex controller methods as global to allow unrestricted LWC access.
D.Annotate read-only methods with @AuraEnabled(cacheable=true) to improve performance.
E.Pass entire sobject records with complex parent relationships directly from client-side JavaScript without validation.
AnswersA, B, D

Correct because LWC requires serializable primitives or wrapper structures.

Why this answer

Apex methods for LWC should be cacheable when read-only, handle security/sharing properly, and accept appropriate parameter types.

65
MCQmedium

A developer is building a Lightning Web Component and needs to navigate to a URL that is external to Salesforce. Which PageReference type should be used with NavigationMixin?

A.standard__recordPage
B.standard__webPage
C.standard__namedPage
D.standard__objectPage
AnswerB

Used for external URLs.

Why this answer

standard__webPage is the PageReference type for navigating to external URLs or web pages.

66
Multi-Selecteasy

Which TWO lifecycle hooks are available in Lightning Web Components? Choose 2 answers.

Select 2 answers
A.renderedCallback
B.init
C.connectedCallback
D.componentDidMount
E.willMount
AnswersA, C

Invoked after every render of the component.

Why this answer

connectedCallback and renderedCallback are standard LWC lifecycle hooks.

67
MCQmedium

A developer is building a Lightning Web Component and needs to perform validation on an input field before submission. Which method on a lighting-input element checks validity?

A.verify()
B.checkValidity()
C.isValid()
D.validate()
AnswerB

Checks if the input satisfies validity constraints.

Why this answer

checkValidity() evaluates validity and reports validity status on input components.

68
Multi-Selecthard

Which THREE statements are true regarding Lightning Web Component shadow DOM encapsulation? Choose 3 answers.

Select 3 answers
A.Global CSS stylesheets automatically penetrate and override LWC shadow DOM styles.
B.Child components can be styled directly from parent CSS files without styling hooks.
C.querySelector calls inside a component only search within that component's template unless using specific host selectors.
D.Styles defined in a component's stylesheet only apply to that component.
E.HTML templates are rendered inside a shadow root for the component.
AnswersC, D, E

DOM queries are encapsulated within the component shadow root.

Why this answer

Shadow DOM encapsulates templates, styles, and queries, preventing external CSS bleeding and restricting queries to the component template.

69
MCQhard

A developer is writing a Lightning Web Component and needs to load a third-party JavaScript library (such as D3.js) stored as a static resource. Which lifecycle hook is most appropriate for initiating the load using loadScript?

A.constructor()
B.disconnectedCallback()
C.connectedCallback()
D.renderedCallback()
AnswerC

Correct because connectedCallback ensures the component is in the DOM for script loading.

Why this answer

Third-party scripts should be loaded in connectedCallback() because the component must be inserted in the DOM before script tags can be appended.

70
MCQeasy

Which tag is used in Visualforce to iterate over a collection of records and display them in a table?

A.apex:pageBlockTable
B.<apex:repeat>
C.apex:iterator
D.apex:outputPanel
AnswerA

Renders data in a standard Salesforce styled table format.

Why this answer

<apex:pageBlockTable> or <apex:dataTable> are used for tabular iteration.

71
MCQeasy

Which base component should be used in LWC to display a tabular grid of data with sorting and row selection?

A.lightning-datatable
B.lightning-grid
C.lightning-table
D.apex:pageBlockTable
AnswerA

Standard LWC component for structured data tables.

Why this answer

lightning-datatable is the standard component for tabular data display in LWC.

72
MCQeasy

Which tool or feature should a developer use to test Lightning Web Components locally on their workstation without deploying to Salesforce every time?

A.The Developer Console preview tab
B.Visual Studio Code Live Server extension pointing to Salesforce org
C.Salesforce CLI force:source:preview command
D.LWC Local Development Server
AnswerD

Correct because the Local Development Server enables local preview.

Why this answer

LWC Local Development Server allows developers to preview components locally.

73
MCQmedium

A developer needs to execute initialization logic as soon as a Lightning Web Component is inserted into the DOM. Which lifecycle hook should be used?

A.renderedCallback()
B.disconnectedCallback()
C.constructor()
D.connectedCallback()
AnswerD

Correct. connectedCallback() runs when the component is inserted into the DOM.

Why this answer

connectedCallback() is invoked when a component is inserted into the DOM, making it the standard hook for initialization logic.

74
MCQhard

A developer is building a Lightning Web Component and needs to listen to a custom event dispatched by a child component. How is the event listener attached in the parent HTML template?

A.onmyevent={handler}
B.event-myevent={handler}
C.on-myevent={handler}
D.listener={handler}
AnswerA

Standard LWC syntax for listening to custom events (lowercased event name).

Why this answer

Child events are listened to using on<eventname> attribute syntax in the parent template.

75
MCQhard

A developer is building a Lightning Web Component that includes a custom wire adapter to fetch custom metadata. The wire adapter needs to react whenever a tracked property changes value. How should the developer wire the property?

A.Prefix the parameter passed to the wire adapter with a dollar sign ($) in the JavaScript file.
B.Wrap the property in a standard JavaScript Proxy object.
C.Decorate the parameter with @track and call this.updateWire() explicitly.
D.Invoke the refreshApex() method inside the component constructor.
AnswerA

Correct because the $ prefix denotes a reactive property that triggers reprovisioning when changed.

Why this answer

Wire adapters automatically provision data when reactive parameters (prefixed with $) change.

Page 1 of 2 · 122 questions totalNext →

Ready to test yourself?

Try a timed practice session using only User Interface questions.