Refer to the component code and requirements below: HTML <lightning:layout multipleRows="true"> <lightning:layoutItem size="12">{!v.account.Name}</lightning:layoutItem> <lightning:layoutItem size="12">{!v.account.AccountNumber}</lightning:layoutItem> <lightning:layoutItem size="12">{!v.account.Industry}</lightning:layoutItem> </lightning:layout> Requirements: * For mobile devices, the information should display in three rows. * For desktops and tablets, the information should display in a single row. Requirement 2 is not displaying as desired. Which option has the correct component code to meet the requirements for desktops an7d tablets?
Correct Answer: D
To achieve a responsive layout in Salesforce Aura components, the lightning:layout and lightning:layoutItem components utilize a 12-column grid system. The size attribute defines the default behavior, which targets the smallest devices (mobile). In the original code, size="12" is applied to all three items. Since each item occupies the full 12 columns, they stack vertically in three rows. To meet Requirement 2 (displaying in a single row for tablets and desktops), the three items must share the 12-column horizontal space. Mathematically, $12 \div 3 = 4$. Therefore, each item must be assigned a size of 4 for larger screen breakpoints. Option D is the correct implementation. It maintains size="12" for mobile (Requirement 1) and sets mediumDeviceSize (tablets) and largeDeviceSize (desktops) to 4. This ensures that on any screen larger than a phone, the three items will sit side-by-side in a single row. Option A is incorrect because mediumDeviceSize="6" would only allow two items per row ($6 + 6 = 12$), forcing the third item to a second row. Option C is incomplete as it only specifies the largeDeviceSize, potentially leaving tablets in a stacked configuration. Option D follows the best practice of explicitly defining the span for all relevant device categories to ensure a consistent user experience.
PDII Exam Question 57
A developer has a test class that creates test data before making a mock callout but now receives a "You have uncommitted work pending. Please commit or rollback before calling out" error. Which step should be taken to resolve the error?
Correct Answer: C
Comprehensive and Deta10iled 150 to 250 words of E11xplanation: This error occurs because Salesforce prohibits making a callout (even a mock one) in the same transaction after a DML operation has been performed. When you insert test data, it creates a "pending" transaction in the database. If you then attempt to execute a callout immediately, the platform throws the CalloutException to prevent data inconsistency issues. To resolve this in a test context, you must separate the DML operation from the callout using the Test. startTest() and Test.stopTest() methods. When Test.startTest() is called, Salesforce provides a fresh set of governor limits and effectively creates a new transaction context for the code that follows. By inserting the records before Test.startTest() and performing the logic that triggers the callout after Test.startTest(), the developer ensures that the DML operation is "committed" to the test database context before the callout is initiated. Option C correctly identifies this pattern. Option B is incorrect because @testSetup is used for global data creation across all test methods and does not specifically address the callout transaction split. Options A and D do not solve the problem because they either keep the DML and callout in the same context or place the DML in a context where it would still interfere with the subsequent callout request.
PDII Exam Question 58
The Account after-update trigger fires whenever an Account's address is updated, and it updates every associated Contact with that address. The Contact after-update trigger fires on every edit, and it updates every Campaign Member record related to the Contact with the Contact's state. Consider the following: A mass update of 200 Account records' addresses, where each Account has 50 Contacts. Each Contact has one Campaign Member. This means there are 10,000 Contact records across th23e Accounts and 10,000 Campaign Member records across the contacts. What will happen when the mass update occurs?24252627
Correct Answer: C
38 In Salesforce, all triggers that fire as a result of an initial DML operation ru39n within the same execution context and the same transaction. This means that all governor limits-such as the limit of 10,000 records processed by DML statements-are shared across the entire chain of events. In this scenario, the transaction begins with the update of 200 Accounts. The Account trigger then attempts to update 10,000 related Contacts (50 Contacts per Account across 200 Accounts). This update of 10,000 Contacts then fires the Contact trigger, which attempts to update 10,000 related Campaign Members. When the system attempts to process these updates, the total number of records processed via DML in a single transaction will exceed the platform limit of 10,000 rows. Even though the Account update is only 200 records, the subsequent cascading updates (10,000 Contacts + 10,000 Campaign Members) bring the total DML count to 20,200. This triggers a LimitException, and because Apex transactions are atomic, the entire operation will fail and roll back. To resolve this, the developer would need to handle these updates asynchronously (e.g., using Batch Apex or Queueable) to split the cascading updates into separate transactions with their own sets of governor limits.
PDII Exam Question 59
Consider the following code snippet: HTML <c-selected-order> <template for:each={orders.data} for:item="order"> <c-order orderId={order.Id}></c-order> </template> </c-selected-order> How should the <c-order> component communicate to the <c-selected-order> component that an order has been selected by the user?
Correct Answer: A
In Lightning Web Components (LWC), components communicate up the containment hierarchy (from child to parent) by creating and dispatching Custom Events. Unlike the older Aura framework, which used specific "Component" or "Application" event types (Options B and C), LWC relies on standard web browser event protocols. The child component (c-order) would instantiate a CustomEvent object, optionally including a data payload in the detail property (such as the orderId), and then call the this.dispatchEvent() method. The parent component (c-selected-order) then listens for this event using an on prefix (e.g., onselection= {handleSelection}) in its HTML template. While you could technically use a standard DOM event (Option D), the CustomEvent interface is the platform-standard best practice in LWC for passing custom data payloads between components. Custom events allow for clean encapsulation and follow the modern "Events Up, Properties Down" design pattern common in reactive frameworks like LWC, React, and Vue.
PDII Exam Question 60
Which three Visualforce components can be used to initiate Ajax behavior to perform partial page updates?
Correct Answer: C,D,E
Comprehensive and Detailed Explanation: In Visualforce, partial page updates (AJAX) are achieved using the reRender attribute. This attribute allows a component to refresh only a specific part of the page identified by an ID, rather than performing a full browser reload. * <apex:commandButton> (Option C) and <apex:commandLink> (Option E) are standard action components. When their reRender attribute is populated, they perform an asynchronous postback. * <apex:actionSupport> (Option D) is an auxiliary component that adds AJAX functionality to other components that do not natively support it. For example, you can place an actionSupport inside an inputText to trigger a partial refresh on the onchange event. Option A (<apex:form>) is a container and does not initiate AJAX behavior itself. Option B (<apex: actionStatus>) is used to display the status of an AJAX request (e.g., a loading spinner) but does not initiate the request.