Courseiva

Salesforce Certified Platform Developer I (SALESFORCE-PD1) (SALESFORCE-PD1) — Questions 226–300

345 questions total · 5 pages · All types, answers revealed

Page 3

Page 4 of 5

Page 5
226
MCQhard

A developer is troubleshooting a Lightning Web Component where data returned from an Apex wire adapter needs to be mutated before being rendered. What is the correct pattern to handle this?

A.Decorate the wire property with @api mutable to allow direct writes.
B.Use the eval() function to strip immutability constraints from the prototype chain.
C.Create a shallow copy or clone of the wire data object in a getter or property assignment before mutation.
D.Directly assign new properties to the object returned by the wire adapter property.
AnswerC

Wire adapter data is read-only and frozen, so direct mutation throws in strict mode. Cloning via spread or structuredClone in a getter or property assignment produces a mutable copy, satisfying the stem's need to transform Apex-returned data before rendering without breaking reactivity.

Why this answer

Data returned from an Apex wire adapter is immutable (read-only). To mutate it, you must create a shallow copy or clone of the object before making changes. This can be done in a getter or by assigning the copied data to a new property.

This pattern ensures you do not attempt to modify the original wire data, which would cause an error.

Exam trap

The trap is assuming that wire data can be directly mutated, or that decorators like @api can make it mutable; candidates may overlook the immutability constraint.

How to eliminate wrong answers

Option A is wrong because @api mutable is not a valid decorator; @api is used to expose public properties, but it does not make wire data mutable. Option B is wrong because using eval() to strip immutability is a hack and not recommended; it can lead to security issues and is not a supported pattern. Option D is wrong because directly assigning new properties to the wire data object will fail silently or throw an error in strict mode, as the object is frozen.

227
MCQmedium

A developer needs to check the status of a long-running batch job that was triggered by an Apex class. Where should they look?

A.Deployment Status.
B.Apex Jobs.
C.Debug Logs.
D.System Overview.
AnswerB

Apex Jobs provides the necessary visibility into asynchronous processes, specifically satisfying the requirement to monitor a long-running batch job initiated via Apex. This interface displays the status, total batches, and processed records for all batchable classes, allowing developers to track execution progress in real-time. By navigating to the Setup menu, administrators can identify failures or bottlenecks within the batch queue, ensuring that resource-intensive operations are functioning correctly without needing to manually query the AsyncApexJob object through the Developer Console.

Why this answer

The status of a long-running batch job triggered by an Apex class can be monitored in the Apex Jobs page in Setup. This page lists all asynchronous Apex jobs, including batch jobs, and shows their status, progress, and any errors.

Exam trap

Salesforce PD1 often tests the misconception that Debug Logs or Deployment Status show batch job status, when the correct location is the Apex Jobs page.

How to eliminate wrong answers

Option A is wrong because Deployment Status is used to monitor metadata deployments, not batch jobs. Option C is wrong because Debug Logs capture execution details but do not provide a consolidated status of batch jobs. Option D is wrong because System Overview provides org-wide limits and usage, not specific batch job status.

228
Multi-Selecteasy

Which TWO practices are considered best practices when writing Apex unit tests in Salesforce? (Choose two.)

Select 2 answers
A.Hardcode record IDs directly from the sandbox into assertions.
B.Create all required test data within the test method or test setup method.
C.Query production records directly in every assertion to verify live system status.
D.Use Test.startTest() and Test.stopTest() to isolate governor limits for the code being tested.
E.Use @isTest(SeeAllData=true) on all test classes to ensure maximum compatibility with production data.
AnswersB, D

Creating all required test data within the test method or test setup method ensures complete isolation from organisation data, satisfying the constraint of writing reliable and repeatable Apex unit tests. By avoiding reliance on pre-existing records in the database, tests will not fail due to missing or modified data in different target environments. This self-containment guarantees that execution results remain consistent and predictable regardless of where the deployment occurs.

Why this answer

Using Test.startTest/stopTest and avoiding SeeAllData=true are essential Apex testing best practices.

229
MCQeasy

What is a 'Change Set' used for?

A.To migrate metadata between related Orgs.
B.To debug Apex code.
C.To backup user records.
D.To write Apex code.
AnswerA

Change Sets facilitate the direct deployment of customisations between Salesforce environments with a parent-child relationship, specifically satisfying the requirement to migrate metadata between related Orgs. By establishing a deployment connection between production and sandbox instances, administrators can package components like custom objects, Apex classes, and page layouts, then upload and validate them securely without relying on file-based tooling or external source control systems.

Why this answer

A Change Set is a Salesforce metadata deployment tool used to migrate customizations and code from one org to another, typically between related orgs such as sandbox and production. It packages metadata components like Apex classes, objects, and layouts for deployment.

Exam trap

Salesforce PD1 often tests the misconception that Change Sets can migrate data or debug code, when they are strictly for metadata deployment between related orgs.

How to eliminate wrong answers

Option B is wrong because debugging Apex code is done using debug logs, not Change Sets. Option C is wrong because Change Sets do not handle user records or data backups; they are for metadata only. Option D is wrong because writing Apex code is done in a developer environment, not through Change Sets.

230
Multi-Selectmedium

Which TWO types of triggers can be defined in Apex? Choose 2 options.

Select 2 answers
A.after trigger
B.instead of trigger
C.commit trigger
D.before trigger
E.validation trigger
AnswersA, D

An `after` trigger executes subsequent to database operations committing records, which directly satisfies one of the two core trigger timing types requested in the stem. During this execution phase, record IDs are fully generated and system-generated fields are populated, allowing developers to access read-only record contexts and reliably perform related-record manipulations or cross-object operations on parent and child objects within the same transactional boundary.

Why this answer

In Apex, the two supported trigger types are before triggers (option D) and after triggers (option A). A before trigger fires before records are saved to the database and is used to validate or modify field values on the incoming records, while an after trigger fires after records are committed and is used to access system-set fields like Id or to perform related-record DML. Apex does not support instead of triggers (option B), which exist in T-SQL for views; commit triggers (option C) are not an Apex construct; and validation triggers (option E) are not a trigger type—validation is handled by before triggers or validation rules.

231
MCQeasy

What is the correct file extension for a Lightning Web Component HTML template file?

A..vfp
B..page
C..html
D..cmp
AnswerC

Lightning Web Components strictly mandate that the user interface template file must use the standard `.html` file extension, perfectly fulfilling the exact file naming constraint specified in the stem. The Salesforce platform parser relies on this precise suffix to automatically identify, compile, and bundle the markup file alongside the corresponding JavaScript controller and configuration metadata within the component's bundle structure.

Why this answer

LWC HTML template files must use the .html extension and share the component base name.

232
MCQhard

A developer is writing a Queueable class that needs to make a callout and also perform a DML operation afterward in the same transaction. Which interface must be added to the Queueable class definition?

A.Schedulable
B.Database.Batchable<SObject>
C.Database.AllowsCallouts
D.InstallHandler
AnswerC

Queueable Apex runs in a transaction where callouts are blocked by default, so Database.AllowsCallouts must be added to the class signature to permit the HTTP callout. This satisfies the requirement to make a callout and then perform DML within the same queued job.

Why this answer

To make HTTP callouts in Queueable Apex, the class must implement the Database.AllowsCallouts interface.

233
MCQhard

A developer creates an Apex trigger that updates related Contact records whenever an Account record is updated. The trigger performs a DML operation on the Contacts. During testing, updating an Account causes the trigger to fire infinitely and throw a System.LimitException: Maximum trigger depth exceeded. Which design pattern should the developer implement to prevent this recursion?

A.Use a Database.setSavepoint() before the DML operation to rollback if recursion occurs.
B.Convert the trigger logic into a Queueable Apex job to defer execution to a separate transaction.
C.Use a static boolean flag in a helper class to ensure the trigger block executes only once per transaction.
D.Check Trigger.isExecuting to determine if the trigger is running in a recursive context.
AnswerC

A static boolean flag in a helper class is set true on first entry and checked before the trigger body runs, so subsequent Contact DML no longer re-enters the Account trigger logic. This halts the recursive cascade within the same transaction, preventing the Maximum trigger depth exception.

Why this answer

Using a static boolean flag in a helper class is the standard Salesforce pattern to prevent recursive trigger execution by tracking whether the trigger logic has already run in the current transaction.

234
MCQhard

A developer is configuring a Lightning Web Component that uses the Lightning Message Service (LMS). Which module must be imported to publish a message on a message channel?

A.lightning/uiRecordApi
B.lightning/empApi
C.lightning/navigation
D.lightning/messageService
AnswerD

Publishing a message on a message channel via the Lightning Message Service requires importing the `publish` function from the `lightning/messageService` module. This specific module provides the fundamental messaging primitives necessary for communication across the DOM, directly satisfying the requirement to trigger outbound messages within a Lightning Web Component. Without importing this exact module, developers cannot access the runtime context needed to broadcast payloads across the Salesforce application architecture.

Why this answer

publish function and the message channel reference are imported from lightning/messageService and the channel definition file respectively.

235
Multi-Selecthard

Which THREE statements are accurate regarding Apex transaction control and database savepoints? Choose 3 answers.

Select 3 answers
A.Database.setSavepoint() returns a Savepoint object reference.
B.Establishing a savepoint resets the SOQL query governor limit counter.
C.Rolling back to a savepoint clears all governor limit exceptions already thrown.
D.You can set multiple savepoints within a single transaction.
E.Savepoints allow developers to roll back part of a transaction after encountering errors.
AnswersA, D, E

`Database.setSavepoint()` captures the current state of an Apex transaction and explicitly returns a `Savepoint` object reference. This returned reference is a mandatory parameter for subsequent rollback operations using `Database.rollback()`, satisfying the core requirement of transaction control where developers must manage and revert partial DML failures within a single execution context. Storing this object reference allows code to safely target and restore the exact database state established at the moment the savepoint was initially invoked.

Why this answer

Savepoints allow partial rollbacks within a single transaction using Database.setSavepoint() and Database.rollback().

236
MCQmedium

A developer writes a SOQL query using the FORMAT() keyword. What is the purpose of this keyword?

A.To ensure SOQL query syntax is validated before execution
B.To return number, date, and currency fields formatted according to the user's locale
C.To format query results into JSON format
D.To convert string fields into uppercase
AnswerB

The `FORMAT()` keyword in SOQL applies locale-specific formatting directly to number, date, time, and currency fields within the query result set. This satisfies the requirement stated in the question stem by leveraging the running user's personal locale settings—such as specific date structures and currency symbols—without requiring developers to manually parse and transform raw database values in Apex code.

Why this answer

FORMAT() formats currency, date, time, and numerical fields according to the current user's locale settings.

237
MCQmedium

A developer needs to ensure that an Apex trigger fires only during the after insert context. Which check should be placed at the beginning of the trigger body?

A.if (Trigger.size > 0)
B.if (Trigger.isExecuting)
C.if (Trigger.isBefore && Trigger.isUpdate)
D.if (Trigger.isAfter && Trigger.isInsert)
AnswerD

Trigger.isAfter and Trigger.isInsert are context variables evaluated at runtime. Combining them with AND restricts execution to the after insert event only, preventing the trigger body from running during before insert, after update or other contexts.

Why this answer

Checking Trigger.isAfter and Trigger.isInsert ensures the code runs only during the desired trigger event.

238
MCQmedium

A developer is writing a Visualforce page with custom controller logic and needs to ensure that database operations are executed transactionally. What happens by default when an unhandled exception occurs during a controller action method?

A.The entire transaction is rolled back.
B.The user is redirected to the login page.
C.Only partial records are saved; successful ones are committed.
D.Changes are committed and an email is sent to the admin.
AnswerA

Visualforce controller action methods inherently execute within a standard database transaction context that satisfies the requirement for transactional integrity. When an unhandled exception halts execution, the Salesforce platform automatically triggers a complete rollback of any database DML operations performed up to that point. This atomic mechanism prevents partial data commits, ensuring that no corrupted or incomplete records persist in the database, thereby fulfilling the explicit need for safe, all-or-nothing execution during custom controller logic.

Why this answer

In Visualforce with a custom controller, an unhandled exception during a controller action method causes the entire transaction to roll back by default. Salesforce wraps the request in a database transaction, so any DML performed before the exception is undone, preserving atomicity.

Exam trap

Salesforce-PD1 often tests the misconception that partial DML commits on exception, when in fact the default behavior is full transaction rollback unless the exception is caught.

How to eliminate wrong answers

Option B is wrong because an unhandled exception produces an error page, not a login redirect; authentication failures cause redirects, not controller exceptions. Option C is wrong because Salesforce does not partially commit — the transaction is atomic, so successful DML before the exception is rolled back. Option D is wrong because changes are not committed on exception, and no admin email is automatically sent for controller exceptions.

239
MCQmedium

A developer has a Lightning Web Component with a reactive property 'recordId'. How should the property be decorated to ensure it receives the current record ID when placed on a record page?

A.@wire recordId;
B.@track recordId;
C.@wire(getRecord) recordId;
D.@api recordId;
AnswerD

Decorating the `recordId` property with the `@api` decorator exposes it as a public property, satisfying the requirement to dynamically receive context from the hosting Lightning record page. When placed on a record page, the Salesforce framework automatically injects the current record's ID into this reactive property, enabling the component to initialise data fetching or perform record-specific logic without requiring manual configuration by the administrator.

Why this answer

The @api decorator makes a property public and reactive, allowing a parent component or the Lightning record page to pass the recordId into the component. On a record page, the framework automatically injects the current record ID into any public property named recordId. Without @api, the property is private and will not receive the value.

Exam trap

Salesforce-PD1 often tests the confusion between @api (public property for parent-to-child and record page injection) and @wire (data binding to Apex or UI API adapters).

How to eliminate wrong answers

Option A is wrong because @wire is used to wire a property or function to an Apex method or a UI API adapter, not to expose a property for parent-to-child communication. Option B is wrong because @track is used for making private fields reactive for internal changes; it does not make the property public or receive values from the record page. Option C is wrong because @wire(getRecord) is a specific adapter call to fetch record data, not a decorator for receiving the recordId; it also requires additional parameters and does not simply expose the ID.

240
Multi-Selectmedium

Which TWO tools are effective for monitoring asynchronous Apex jobs?

Select 2 answers
A.Setup > Security
B.Setup > Debug Logs
C.Setup > Apex Jobs
D.Querying the AsyncApexJob object
E.Setup > Flows
AnswersC, D

The Apex Jobs page in the Salesforce Setup menu provides a centralised queue interface that directly satisfies the requirement to monitor asynchronous Apex jobs. Administrators and developers can use this native tool to view the real-time status, execution time, method names, and error details of scheduled jobs, batch apex, future methods, and queueable apex. It tracks job lifecycles through states like Queued, Processing, Completed, and Failed, enabling rapid troubleshooting and operational oversight without requiring custom code or external logging infrastructure.

Why this answer

Setup > Apex Jobs (option C) is correct because this Salesforce setup page lists asynchronous Apex jobs—such as Batch Apex, Queueable, future methods, and scheduled jobs—along with their status, submitted time, and completion details, making it a primary monitoring tool. Querying the AsyncApexJob object (option D) is correct because it exposes the same job records via SOQL/SOQL-based tooling, allowing developers to filter by Status, JobType, CreatedDate, and other fields for programmatic or custom monitoring. Option A (Setup > Security) is incorrect because it covers security policies like password and session settings, not job monitoring.

Option B (Setup > Debug Logs) is incorrect because debug logs capture execution details for troubleshooting, not the overall status of asynchronous jobs. Option E (Setup > Flows) is incorrect because it manages Flow automation, not Apex asynchronous job execution.

Exam trap

The trap here is confusing Debug Logs (transient, per-user execution traces) with Apex Jobs (persistent job status records)—candidates often pick Debug Logs thinking it 'monitors' async work, but it does not aggregate job outcomes.

241
MCQeasy

A developer wants to include a custom styling hook to override a standard Lightning Design System component token in a Lightning Web Component. Where should this CSS custom property be defined?

A.Inside the component controller JavaScript file (.js)
B.In the component's cascading style sheet file (.css)
C.In a separate Static Resource uploaded to Salesforce
D.In the component's configuration file (.js-meta.xml)
AnswerB

Defining the custom property directly within the component's cascading style sheet file (`.css`) satisfies the requirement to scope the SLDS component token override specifically to that Lightning Web Component. Salesforce requires component-level styling hooks to be declared in the local stylesheet so that the Shadow DOM encapsulation correctly applies the scoped custom property (`--slds-...`) to override the standard token values without unintentionally bleeding styles into other DOM elements on the page.

Why this answer

Lightning Web Components use standard CSS custom properties (design tokens) to allow styling overrides, and these must be defined in the component's .css file. The CSS file is where SLDS styling hooks are declared, scoped to the component's shadow DOM, so the override applies only to that component.

Exam trap

The trap is assuming styling hooks can be set in JS or metadata files — candidates who are unfamiliar with shadow DOM scoping often pick the JS file, but CSS custom properties must live in the .css file.

How to eliminate wrong answers

Option A is wrong because JavaScript files cannot define CSS custom properties — styling is not a JS concern, and the LWC framework does not read style tokens from JS. Option C is wrong because Static Resources are for uploading files like images or third-party libraries, not for defining component-scoped CSS tokens; they cannot be applied as live styles to a component's shadow DOM. Option D is wrong because the .js-meta.xml file configures component metadata (targets, API version, exposed properties), not styling — CSS custom properties have no place there.

242
MCQeasy

Which best practice should be followed when writing Apex triggers to ensure bulkification?

A.Always query inside a for loop for every record.
B.Design triggers to process collections of records in bulk using collections and bulk SOQL queries.
C.Use future methods for every trigger execution.
D.Hardcode record IDs in trigger logic for performance.
AnswerB

Triggers fire once per DML operation with up to 200 records, so iterating and querying per record exhausts governor limits. Processing Trigger.new collections and issuing bulk SOQL satisfies the bulkification constraint by keeping query and DML counts constant regardless of record volume.

Why this answer

Triggers must be written to handle collections of records (Trigger.new / Trigger.old) rather than single records.

243
MCQhard

During the Salesforce save order of execution, when are before triggers executed relative to custom validation rules?

A.Before triggers execute after custom validation rules.
B.Before triggers execute after the record is committed to the database.
C.Before triggers execute before custom validation rules.
D.Before triggers execute concurrently with custom validation rules.
AnswerC

Custom object saves initiate the execution of before triggers immediately prior to the evaluation of custom validation rules. This precise sequencing ensures that Apex code can programmatically populate or modify field values before data integrity checks are enforced by the platform. Because before triggers execute first, any field updates made within the trigger logic are included in the subsequent validation rule evaluation, satisfying the exact chronological requirement defined in the Salesforce save order of execution.

Why this answer

Before triggers execute before custom validation rules are evaluated, allowing developers to modify field values before validation checks run.

244
MCQeasy

A developer needs to ensure that a specific Apex method runs asynchronously because it makes a callout to an external REST API from a standard user interface controller. Which annotation must be added to the method?

A.@ReadOnly
B.@InvocableMethod
C.@future(callout=true)
D.@AuraEnabled(callout=true)
AnswerC

Standard user interface controllers execute synchronously within the request-response lifecycle, which strictly prohibits synchronous web service callouts to external REST APIs. Adding the `@future(callout=true)` annotation defers the Apex method execution to a separate asynchronous background thread managed by Salesforce. This specific parameter explicitly overrides the default restriction that blocks callouts from asynchronous contexts, thereby satisfying the platform constraint for integrating external endpoints from standard UI interactions without freezing the user interface.

Why this answer

The @future(callout=true) annotation allows an Apex method to run asynchronously and enables it to perform HTTP callouts.

245
Multi-Selecthard

Which THREE statements are true regarding asynchronous Apex governor limits and execution behavior? (Choose three.)

Select 3 answers
A.Asynchronous Apex jobs execute in their own separate transaction with independent governor limits.
B.Future methods can be chained indefinitely without any depth limitations.
C.Queueable Apex jobs return an AsyncApexJob ID that can be queried to track job progress and status.
D.Batch Apex jobs cannot make external web service callouts.
E.Asynchronous Apex transactions have a higher CPU time limit of 60,000 milliseconds compared to synchronous transactions.
AnswersA, C, E

Asynchronous Apex processes transactions independently from the triggering request, directly satisfying the governor limit isolation constraint mentioned in the stem. By decoupling execution into a separate thread, Salesforce allocates a fresh set of system resources and governance boundaries—such as separate SOQL query limits, DML statements, and CPU time—ensuring that long-running or resource-heavy background processes do not exhaust the synchronous transaction limits of the originating user request.

Why this answer

Asynchronous jobs have higher limits (heap, CPU time), run in separate transactions, and can be monitored via AsyncApexJob.

246
MCQhard

A developer has a trigger that updates related child records. To prevent recursive trigger execution when updates ripple through child triggers, what is a standard best practice design pattern?

A.Using Flow Builder instead of Apex triggers for all child records.
B.Disabling all triggers via Custom Settings permanently.
C.Using a static boolean flag in a utility class to track execution state.
D.Wrapping every DML statement in a try-catch block.
AnswerC

A static Boolean flag in a utility class persists for the transaction, letting the trigger skip re-entry when child updates fire it again. This satisfies the requirement to prevent recursive trigger execution during ripple updates.

Why this answer

Using a static boolean flag in a helper class is the classic pattern to prevent recursive trigger execution in Salesforce.

247
Multi-Selectmedium

Which THREE pieces of information are displayed in the Apex Test Execution page?

Select 3 answers
A.Code Coverage Percentage.
B.Execution Status.
C.Test Class Name.
D.Execution Time.
E.User who initiated the test.
AnswersB, C, D

The Apex Test Execution page within the Salesforce Developer Console provides real-time visibility into whether test methods are queued, processing, or completed, directly satisfying the requirement to display the execution status of running tests. Developers rely on this specific indicator to monitor asynchronous test batch progress across multiple org environments before deployment verification steps can proceed.

Why this answer

The page shows class name, status, and duration.

248
Multi-Selecthard

A developer is troubleshooting a transaction that exceeds governor limits due to SOQL queries. Which THREE techniques help prevent hitting SOQL query limits in Apex? (Choose THREE.)

Select 3 answers
A.Using maps and collections to store query results and perform in-memory lookups instead of querying inside loops.
B.Writing queries that retrieve only the specific fields and records required using WHERE clauses.
C.Using relationship queries (parent-to-child or child-to-parent) to retrieve related data in a single query.
D.Executing SOQL queries inside a for loop iterating over all child records.
E.Calling Database.query() for every single record processed in a trigger.
AnswersA, B, C

Querying inside a loop easily breaches the synchronous governor limit of 100 SOQL queries per transaction. Storing query results in maps and collections allows developers to fetch all required data in a single aggregate query upfront, satisfying the core constraint of reducing query execution frequency. Subsequent lookups are then performed entirely in-memory against the collection rather than hitting the database repeatedly, drastically lowering resource consumption and preventing limits from being exceeded.

Why this answer

Avoiding queries in loops, using aggregate queries, and caching results in maps/collections help avoid SOQL query limit issues.

249
Multi-Selectmedium

Which TWO techniques can be used to pass data from a parent component to a child Lightning Web Component? Choose 2 answers.

Select 2 answers
A.Using application events via $A.get('e...')
B.Calling public @api methods defined on the child component instance from the parent JavaScript.
C.Directly modifying child private properties using DOM queries.
D.Using global window variables.
E.Binding properties to public @api properties on the child component in the parent template.
AnswersB, E

Exposing methods with the `@api` decorator on the child component allows the parent component to invoke them directly via the child's DOM element reference. This satisfies the requirement to pass data downwards from parent to child because the parent's JavaScript controller can supply parameters when calling the public method, effectively pushing data and triggering behaviour within the child context upon demand.

Why this answer

Data is passed down via public properties decorated with @api or by invoking public child methods.

250
MCQhard

A developer implements a Schedulable class to run a daily cleanup job. What is the maximum number of scheduled Apex jobs that can be simultaneously active in an org?

A.500
B.50
C.100
D.250
AnswerC

Salesforce enforces a strict platform governor limit of 100 simultaneously active scheduled Apex jobs per organisation, which directly satisfies the scheduling constraint mentioned in the stem. When a developer programs a Schedulable class for daily execution using `System.schedule`, the resulting job enters the Apex queue and consumes one of these allocated slots. Attempting to schedule an excess job beyond this threshold throws a runtime exception, meaning administrators and developers must monitor active schedules to ensure daily automated routines remain within this capacity.

Why this answer

Salesforce enforces a strict limit of 100 simultaneous scheduled Apex jobs per org.

251
MCQhard

An Apex trigger executes a query inside a for-loop to fetch related child records for every parent Account in Trigger.new. The developer notices that when a data load of 200 accounts occurs, the governor limit for total SOQL queries issued is exceeded. How should the developer refactor the code?

A.Annotate the trigger with @ReadOnly to increase the query limit.
B.Wrap the query in a try-catch block and catch the QueryException.
C.Use the Database.executeBatch method to process each account in a separate transaction.
D.Collect the Account IDs in a Set and execute a single SOQL query outside the loop using the IN operator.
AnswerD

Moving the query outside the loop replaces 200 per-parent SOQL calls with one bulk query, satisfying the total SOQL governor limit. Gathering IDs into a Set and filtering with IN preserves correctness while issuing a single query.

Why this answer

To avoid hitting the governor limit of 100 SOQL queries per transaction, queries must be moved outside of loops and bulkified using collections.

252
MCQhard

When a record-triggered flow performs an action that causes a trigger to fire, which order of execution phase is this?

A.The flow fails
B.The trigger is queued for later
C.The trigger executes immediately in the same transaction
D.The trigger is ignored
AnswerC

Record-triggered flows configured to run before or after save operate within the exact same database transaction as the DML operation that initiated them. When such a flow performs an action that subsequently causes an Apex trigger or another automation to fire, that secondary trigger satisfies the stem's condition by executing immediately within that very same transactional context, rather than being deferred or routed asynchronously.

Why this answer

This is part of the re-entrant execution, where Salesforce processes the trigger as part of the flow's transaction.

253
MCQhard

A developer creates a Lightning Web Component that consumes data from a wire adapter. The wire adapter returns an object with 'data' and 'error' properties. What is this pattern called in LWC?

A.Event emitter pattern
B.Promise chaining
C.Async/await callback pattern
D.Wired property / result object pattern
AnswerD

Consuming data via a wire adapter that returns an object containing both `data` and `error` properties explicitly satisfies the wired property or result object pattern in Lightning Web Components. When a wire adapter is provisioned as a property rather than a function, Salesforce delivers an immutable result object encapsulating these two distinct states. This architecture allows developers to declaratively handle both successful payload retrieval and exception states seamlessly within the component lifecycle without manually invoking imperative Apex or managing asynchronous promises.

Why this answer

Wire adapters return a wrapper object containing data and error properties.

254
MCQeasy

Which context variable should a developer use in an Apex trigger to determine if the trigger was fired by an update operation rather than an insert?

A.Trigger.isExecuting
B.Trigger.isBefore
C.Trigger.isInsert
D.Trigger.isUpdate
AnswerD

`Trigger.isUpdate` returns a Boolean value of true specifically when an update DML operation initiates the execution context, allowing developers to cleanly separate update logic from insert logic. This satisfies the stem constraint of determining whether an update operation fired the trigger rather than an insert, directly evaluating the operational event context provided by the platform runtime without requiring manual inspection of record ID fields.

Why this answer

Trigger.isUpdate returns true if the trigger was fired due to an update operation.

255
MCQeasy

A developer is building a Lightning Web Component that must be made available for use on Lightning Record Pages. Which configuration tag must be included in the component's metadata file?

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

The `lightning__RecordPage` target in the metadata file exposes the component for placement on Lightning Record Pages, satisfying the stem's requirement. Other targets, such as `lightning__AppPage` or `lightning__HomePage`, permit different page types only. Without this specific target declared, the component cannot be added to record pages.

Why this answer

To expose an LWC on a Lightning Record Page, the component's .js-meta.xml file must include the <target>lightning__RecordPage</target> tag. This target tells the platform that the component is eligible to be dragged onto record pages in Lightning App Builder, and it is the specific configuration required for record-page availability.

Exam trap

Salesforce PD1 often tests the exact target name for a given surface; candidates confuse lightning__RecordPage with lightning__AppPage or lightning__HomePage because all are 'page' targets but apply to different contexts.

How to eliminate wrong answers

Option A is wrong because lightning__UtilityBar targets the utility bar (a persistent footer bar for tools like notes and recent items), not record pages. Option B is wrong because lightning__GlobalAction exposes the component as a global quick action, not as a record page component. Option D is wrong because lightning__AppPage targets a custom Lightning app page (a standalone page in the app), not a record page tied to an object record.

256
Multi-Selecthard

Which THREE items are best practices when setting up test data using @TestSetup methods? (Choose three.)

Select 3 answers
A.Perform time-consuming operations or bulk data generation once to avoid hitting governor limits in separate test methods.
B.Hardcode specific record IDs assigned during @TestSetup into downstream test assertions.
C.Create parent records (such as Accounts) that can be queried and associated with child records in individual test methods.
D.Call external REST callouts inside the @TestSetup method to fetch live seed data.
E.Modify records created in @TestSetup within test methods without worrying about state pollution, because Salesforce automatically rolls back modifications made by each test method.
AnswersA, C, E

Using the `@TestSetup` annotation executes the enclosed method once before any test methods in the class run, sharing the inserted records across all tests within that execution context. This mechanism directly satisfies the requirement to perform time-consuming operations or bulk data generation once, preventing repeated DML statements and SOQL queries that would otherwise accumulate across individual test methods and rapidly exhaust cumulative governor limits such as DML rows and CPU time limits.

Why this answer

Option A is correct because @TestSetup runs once per test class and its resulting data is available to every test method, so performing expensive or bulk data generation there conserves governor limits (DML statements, CPU time, SOQL queries) that would otherwise be consumed repeatedly in each test method. Option C is correct because creating parent records such as Accounts in @TestSetup lets individual test methods query those records and build child records (for example Contacts or Opportunities) against them, which is the intended pattern for reusable seed data. Option E is correct because Salesforce wraps each test method in its own transaction and rolls back any changes made during that method, so modifications to @TestSetup records in one test method do not leak into another; the @TestSetup data is restored to its original state for the next method.

Option B is not a best practice because record IDs are assigned at runtime and hardcoding them makes tests brittle and non-portable across orgs; tests should query the records instead. Option D is not a best practice because callouts are not allowed in @TestSetup (and generally not in test methods without a mock), so external REST callouts would fail; seed data should be created locally or via mock callouts.

257
Multi-Selecteasy

Which THREE data types are primitive data types supported in Apex? (Choose three.)

Select 3 answers
A.Boolean
B.WorkflowRule
C.Integer
D.LightningComponent
E.String
AnswersA, C, E

Boolean is a fundamental primitive data type natively supported in Apex, directly satisfying the stem's constraint to select a primitive data type. In Apex, primitive types are passed by value and represent single, indivisible values rather than complex database objects or sObjects. The Boolean type specifically holds a truth value of true, false, or null, making it one of the foundational building blocks alongside other primitives like Integer, Double, and String for basic variable declarations and logical evaluations within developer code.

Why this answer

Apex supports standard primitive types including Boolean, Integer, and String.

258
MCQeasy

Which log level displays the most information?

A.WARN.
B.DEBUG.
C.INFO.
D.FINEST.
AnswerD

Salesforce debug logging hierarchy dictates that `FINEST` generates the absolute highest volume of data by capturing all database queries, heap allocations, workflow triggers, and custom debug statements at maximum verbosity. This directly satisfies the constraint in the stem to display the most information, whereas broader levels like `INFO` or `DEBUG` selectively filter out granular execution details to reduce log file sizes.

Why this answer

In Salesforce debug logs, the log levels from lowest to highest verbosity are NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, and FINEST. FINEST displays the most detailed information, including internal execution details, making it the most verbose level.

Exam trap

Salesforce PD1 often tests the misconception that DEBUG is the most verbose level, when actually FINEST provides the most detailed information.

How to eliminate wrong answers

Option A is wrong because WARN is a relatively low level that only logs warning messages, not detailed debug information. Option B is wrong because DEBUG is less verbose than FINEST; it logs debug messages but not the finest granular details. Option C is wrong because INFO is even less verbose than DEBUG, logging only informational messages.

259
Multi-Selecthard

Which THREE things can a developer do with the Salesforce CLI?

Select 3 answers
A.Modify the Org's license type.
B.Query data from an org.
C.Update user passwords.
D.Create a scratch org.
E.Deploy metadata to an org.
AnswersB, D, E

Developers can efficiently retrieve and inspect records directly from a Salesforce org by executing the `sf data query` command via the Salesforce CLI. This capability directly satisfies the requirement in the stem to query data from an org, bypassing the Salesforce user interface or custom code development. By leveraging SOQL syntax within the terminal, developers can rapidly validate data models, troubleshoot record states, and extract datasets for local testing or CI/CD pipeline automation without needing to launch a developer console.

Why this answer

Option B is correct because the Salesforce CLI provides the `sf data query` (formerly `sfdx force:data:soql:query`) command, which lets a developer run SOQL queries against an org and retrieve records. Option D is correct because the CLI includes the `sf org create scratch` (formerly `sfdx force:org:create`) command, which provisions scratch orgs from a Dev Hub using a definition file or flags. Option E is correct because the CLI supports metadata deployment via `sf project deploy start` (formerly `sfdx force:source:deploy` or `force:mdapi:deploy`), pushing source or metadata components to an org.

Option A is not valid because license type is an org-level setting managed through the Company Information page in Setup or via the appropriate licensing/contract process, not through the Salesforce CLI. Option C is not valid because user password resets are performed in Setup (Users) or via the System Administrator profile's reset action, not through a standard Salesforce CLI command.

260
MCQeasy

Which of these is NOT a valid testing best practice?

A.Testing for bulk records.
B.Using System.assertEquals.
C.Using @isTest.
D.Hard-coding record IDs.
AnswerD

Hard-coding record IDs directly violates standard deployment best practice because identifiers vary between environments such as sandboxes and production orgs. When test classes contain static record IDs, queries return null results or runtime exceptions upon deployment because those specific database keys do not exist in the target environment. Robust tests instead query existing records or dynamically instantiate test data using Apex logic to ensure reliable execution across all Salesforce deployments.

Why this answer

Hard-coding data is a bad practice.

261
MCQhard

When testing asynchronous Apex, how do you ensure that the scheduled job has finished before asserting results?

A.Use Test.stopTest()
B.Query the AsyncApexJob object
C.Use System.runAs()
D.Use Thread.sleep()
AnswerA

Invoking `Test.stopTest()` immediately forces the execution of all asynchronous processes, including scheduled jobs, queued flex queue items, and future methods, that were enqueued within the preceding `Test.startTest()` block. This mechanism directly satisfies the requirement to ensure a scheduled job finishes before running assertion logic by synchronising the asynchronous execution thread with the test context, thereby guaranteeing that all database side-effects are fully committed and available for inspection when the subsequent assertion statements execute.

Why this answer

Test.stopTest() forces any asynchronous processes, such as @future or Schedulables, to execute before the code execution continues.

262
MCQmedium

A developer is writing a test class for an Apex trigger and needs to insert test Account records. Best practices recommend bypassing hardcoded IDs. Which annotation should be placed on the test setup method to create common test data efficiently?

A.@IsTest(SeeAllData=true)
B.@TestVisible
C.@RemoteAction
D.@TestSetup
AnswerD

@TestSetup runs once before all test methods in the class, creating shared Account records that every method reuses. This satisfies the stem's efficiency and hardcoded-ID-avoidance constraints, since data is inserted via normal DML rather than fixed record IDs.

Why this answer

The @TestSetup annotation allows developers to create test records once and make them available for all test methods in the class.

263
MCQmedium

What is the primary benefit of using a Sandbox for development?

A.It allows access to the full production database automatically.
B.It increases the number of available governor limits.
C.It allows development without affecting production data.
D.It automatically deploys code to production.
AnswerC

Isolating custom code, configuration changes, and unit testing within a completely separate metadata and database replica ensures that live user transactions and enterprise records remain entirely uncompromised. This directly satisfies the core constraint in the question stem regarding safe development practices by providing an isolated execution environment. Developers can write Apex, deploy declarative automation, and execute destructive operations without risking accidental data corruption or schema locks in the live production org.

Why this answer

Sandboxes provide an isolated environment to prevent impact on production data or processes.

264
Multi-Selecthard

A developer is troubleshooting an Apex trigger recursion issue where an update operation triggers itself infinitely. Which THREE strategies can the developer use to safely prevent this recursion? Choose 3 options.

Select 3 answers
A.Call Limits.getQueries() at the start of every trigger to abort if limits are near.
B.Utilize Custom Settings or Custom Metadata to provide a global toggle to turn off triggers dynamically.
C.Wrap all DML statements in a try-catch block that catches recursion exceptions.
D.Compare old and new field values using Trigger.oldMap and Trigger.newMap to check if relevant fields actually changed.
E.Use a static boolean variable in a helper class set to false after the first execution.
AnswersB, D, E

Utilising Custom Settings or Custom Metadata enables developers to define a global toggle that can be evaluated at the beginning of an Apex trigger execution context. By checking this configurable boolean flag before running the trigger logic, administrators or developers can dynamically bypass the recursive execution path without needing a code deployment. This satisfies the requirement to safely prevent infinite recursion by providing an externally manageable switch to halt recurring update operations.

Why this answer

Option B is correct because Custom Settings or Custom Metadata can store a global bypass flag that the trigger checks before executing, allowing developers to disable trigger logic dynamically without deploying code changes, which safely breaks recursive update loops. Option D is correct because comparing Trigger.oldMap and Trigger.newMap lets the trigger verify that the fields it cares about actually changed before performing DML, so an update that does not modify relevant fields will not re-fire the same logic and cause infinite recursion. Option E is correct because a static Boolean variable in a helper class persists for the duration of a single transaction, so setting it to false after the first execution prevents the trigger from running its logic again during the same transaction's recursive DML.

Option A is not appropriate because Limits.getQueries() only reports the number of SOQL queries already issued and aborting near governor limits does not logically prevent recursion. Option C is not appropriate because recursion is not an exception that can be caught; wrapping DML in try-catch does not stop the trigger from re-invoking itself.

265
MCQhard

A developer encounters a 'System.AsyncException: Maximum queueable jobs added to the queue' error. What caused this exception?

A.Running more than 500 batch jobs simultaneously.
B.Exceeding the daily asynchronous Apex limit of 250,000.
C.Making more than 100 callouts in a future method.
D.Exceeding the maximum number of 50 queued jobs in a single transaction.
AnswerD

Queuing more than 50 jobs in a single transaction directly triggers this `System.AsyncException` because the asynchronous framework enforces a strict governor limit of 50 `System.enqueueJob` calls per execution context. When a developer attempts to exceed this ceiling—typically through recursive queueable chains or bulk-triggered asynchronous processing—the platform halts execution to protect shared resources. This specific limitation prevents runaway loops from monopolising multi-tenant server capacity, making this option the exact cause of the described error.

Why this answer

Exceeding the limit of 50 queued jobs added to the flex queue in a single transaction triggers this AsyncException.

266
MCQhard

A developer receives a System.LimitException: Too many SOQL queries: 101 when running a complex unit test. The test class inserts a large volume of test records that inadvertently cause a trigger to execute multiple queries inside a loop. What is the most effective way to reset the governor limits specifically for the code being tested?

A.Wrap the test assertion code between Test.startTest() and Test.stopTest().
B.Mark the test method with @isTest(SeeAllData=true).
C.Wrap the trigger logic in a Database.setSavepoint() block.
D.Use Limits.getLimitQueries() inside the test method.
AnswerA

Test.startTest() resets governor limits, giving the code between it and Test.stopTest() a fresh set of SOQL, DML and CPU allocations. Placing assertions inside that block isolates the tested logic from the 101-query limit already consumed by setup and trigger execution.

Why this answer

Test.startTest() resets all governor limits for the code executed immediately following it, up until Test.stopTest().

267
MCQhard

A developer needs to catch unhandled JavaScript errors in a Lightning Web Component hierarchy so the entire app doesn't crash. Which lifecycle hook handles errors thrown by descendant components?

A.errorCallback
B.catchCallback
C.disconnectedCallback
D.faultCallback
AnswerA

The `errorCallback()` lifecycle hook acts as an error boundary for a Lightning Web Component, directly satisfying the requirement to catch unhandled errors thrown by descendant components in the hierarchy. When a child component throws an error during rendering, in a lifecycle hook, or in an event handler, the framework automatically invokes this method on the nearest ancestor implementing it, receiving the error object and stack trace. This containment prevents the entire application from crashing and allows developers to render an alternative user interface.

Why this answer

errorCallback() is invoked when a descendant component throws an error in any of its lifecycle hooks or event handlers.

268
MCQeasy

A developer needs to verify code coverage across an entire Apex organization before deploying code to production. What is the minimum overall Apex code coverage required by Salesforce for production deployment?

A.100%
B.50%
C.75%
D.85%
AnswerC

Salesforce enforces a minimum of 75% overall Apex code coverage before any production deployment, satisfying the stem's requirement to verify coverage across the entire organisation. Each trigger must also achieve 75% coverage individually, and all tests must pass, so this threshold is the binding constraint for deployment.

Why this answer

Salesforce requires a minimum of 75% overall Apex code coverage for deployment to a production organization.

269
MCQeasy

Which governor limit applies to the total CPU time in a single synchronous Apex transaction?

A.60,000 milliseconds
B.5,000 milliseconds
C.120,000 milliseconds
D.10,000 milliseconds
AnswerD

Synchronous Apex transactions enforce a strict CPU time limit of 10,000 milliseconds to prevent runaway processes from monopolising multitenant server resources. This specific constraint directly addresses the governor limit concerning total CPU time in a single synchronous execution context, distinguishing it from the 60,000-millisecond threshold allocated exclusively to asynchronous transactions.

Why this answer

The synchronous CPU time limit is 10,000 milliseconds (10 seconds).

270
Multi-Selecthard

Which THREE requirements must be met when implementing a custom Lightning Web Component pagination control? Choose 3 answers.

Select 3 answers
A.Slice the master dataset array based on current offset and limit calculations.
B.Use standard Visualforce standardSetController inside the LWC JavaScript.
C.Disable navigation buttons (Next/Previous) when boundary conditions are reached.
D.Maintain reactive properties for the current page number and page size.
E.Directly mutate the server database on every page click.
AnswersA, C, D

Pagination in a custom Lightning Web Component requires manual data slicing to manage large collections efficiently within the client-side JavaScript controller. Because Salesforce sets strict performance boundaries and DOM rendering limits for browser-based components, loading an entire master dataset simultaneously degrades user experience. Calculating precise array slices using dynamic offset and limit variables ensures that only the subset of records currently visible on the active page is rendered in the DOM, satisfying the fundamental performance and data-handling requirements of a custom pagination control.

Why this answer

Option A is correct because a custom LWC pagination control must compute the visible subset of records by slicing the master dataset array using the current offset (page number × page size) and the page size limit, since LWC has no built-in pagination primitive. Option C is correct because the Next and Previous buttons must be disabled when boundary conditions are reached — Previous at page 1 and Next at the last page — to prevent out-of-range navigation and provide correct UX. Option D is correct because the component must track the current page number and page size as reactive properties (e.g., @track or standard reactive fields) so that changes trigger re-rendering and recomputation of the sliced data.

Option B is incorrect because Visualforce's standardSetController is a Visualforce/Apex construct and cannot be used inside LWC JavaScript; pagination in LWC is handled client-side or via Apex methods. Option E is incorrect because mutating the server database on every page click is unnecessary and harmful — pagination should only change the client-side view, not persist data on each navigation.

Exam trap

Salesforce PD1 often tests the misconception that Visualforce controllers (standardSetController) can be reused in LWC, or that pagination requires server-side mutation on every click.

271
MCQmedium

A developer is using Salesforce CLI to create a temporary environment for feature development and testing that includes all source code and shape settings. Which CLI command should the developer use to create this temporary environment?

A.sf org login web
B.sf org create sandbox
C.sf project retrieve start
D.sf org create scratch
AnswerD

The `sf org create scratch` command directly satisfies the requirement to create a temporary, disposable environment for feature development and testing by provisioning a scratch org based on a defined configuration file and shape settings. This command connects to a Salesforce DX hub org to spin up a fully configurable, short-lived development workspace that encapsulates all source code and metadata, distinguishing it from commands that merely authenticate existing production or sandbox environments.

Why this answer

sf org create scratch creates a scratch org based on a definition file.

272
MCQmedium

A developer is implementing a Batch Apex class to process 500,000 Contact records. Which method defines the starting point and retrieves the records to be processed?

A.void execute(Database.BatchableContext BC, List<SObject> scope)
B.void finish(Database.BatchableContext BC)
C.Database.QueryLocator start(Database.BatchableContext BC)
D.Database.BatchableContext start(Database.BatchableContext BC)
AnswerC

`Database.QueryLocator` is the correct return type because the scenario requires processing a massive volume of 500,000 Contact records. The `start` method utilising a QueryLocator allows the Apex runtime to bypass standard governor limits by using a lazy-loading cursor that can query up to 50 million records. In contrast, an Iterable or direct `List` return type would restrict the dataset to 50,000 records due to standard SOQL row limits, making the QueryLocator essential for handling large-scale data volumes efficiently in Batch Apex.

Why this answer

The start method of a Database.Batchable class returns either a Database.QueryLocator or an Iterable that defines the records to be processed.

273
Multi-Selectmedium

Which TWO actions should a developer take when handling errors returned by an imperative Apex call in a Lightning Web Component? Choose 2 answers.

Select 2 answers
A.Call ApexPages.addMessage() to display the error on screen.
B.Extract the error message from the error object structure (e.g., error.body.message).
C.Rethrow the error as an unhandled Java exception.
D.Catch the error using a .catch() block or try/catch with async/await.
E.Use standard window.alert() for all error messaging.
AnswersB, D

Imperative Apex calls in Lightning Web Components return errors as JavaScript objects whose structure typically places the main description within the `error.body.message` property. Accessing this nested path directly satisfies the requirement to safely extract and display failure details returned from the server. Relying on this standard Lightning Data Service and imperative error structure ensures developers can reliably parse backend exceptions and present meaningful feedback to the user interface.

Why this answer

Option B is correct because when an imperative Apex call fails, the promise rejects with a JavaScript error object whose useful details live in nested properties such as error.body.message (and error.body.pageErrors or error.body.fieldErrors), so the developer must extract the message from that structure to surface a meaningful error. Option D is correct because imperative Apex calls return a Promise, so errors must be handled by chaining a .catch() handler or by wrapping the call in try/catch when using async/await; otherwise the rejection is unhandled. Option A is wrong because ApexPages.addMessage() is a server-side Apex method for Visualforce pages, not for Lightning Web Components.

Option C is wrong because Apex is not Java and rethrowing as an unhandled Java exception is neither possible nor a valid LWC error-handling pattern. Option E is wrong because window.alert() is a blocking browser dialog and is not the recommended way to present errors in a Lightning Web Component, which should use lightning-toast or inline UI instead.

Exam trap

Salesforce PD1 often tests the confusion between Visualforce error handling (ApexPages.addMessage) and LWC error handling, and candidates may incorrectly assume that errors are automatically displayed or that alert is acceptable.

274
MCQhard

A developer needs to chain asynchronous jobs. Which interface allows for a single job to be queued from within the execution of another?

A.Queueable
B.Batchable
C.Schedulable
D.Future
AnswerA

`Queueable` implements the `System.Queueable` interface, which satisfies the requirement to chain asynchronous jobs by allowing a job to be queued from within the execution of another using `System.enqueueJob`. Unlike the `@future` annotation, which does not support chaining, `Queueable` returns an `ID` that can be monitored and provides a mechanism to pass complex data types such as sObject records or custom Apex objects, making it the ideal solution for sequential asynchronous processing.

Why this answer

Queueable Apex allows for chaining jobs by calling System.enqueueJob within the execute method.

275
MCQhard

A developer is using 'Test.isRunningTest()' in their production code. Why is this generally considered a poor practice?

A.It creates different code execution paths between test and production
B.It causes the test to fail
C.It causes excessive governor limit usage
D.It is not supported in production
AnswerA

Test.isRunningTest() branches execution, so production and test runs follow different code paths. The tested path never exercises the production branch, meaning tests can pass while production behaviour remains unverified, undermining the reliability of coverage and assertions.

Why this answer

While sometimes necessary, relying on it can lead to code paths that are not tested in production exactly as they execute in tests.

276
MCQmedium

A developer is creating a reusable LWC utility and needs to invoke an Apex method imperatively. The method accepts a record ID parameter. What is the correct way to pass this parameter in JavaScript?

A.Pass the parameter as an object with property names matching the Apex method parameters: getAccount({ accountId: recordId })
B.Pass the parameter as a positional string argument: getAccount({recordId})
C.Bind the parameter using the @api decorator inside the JavaScript function body.
D.Assign the parameter to the window.apexParams object prior to invocation.
AnswerA

Imperative Apex method calls in Lightning Web Components require parameters to be structured as an object where the property names explicitly match the parameter definitions expected by the Apex controller. This exact syntax satisfies the requirement to invoke the method while passing a record ID parameter, ensuring the JavaScript wire adapter or imperative promise correctly serialises and maps the arguments to the backend method signature.

Why this answer

When invoking an Apex method imperatively from LWC, parameters must be passed as a single object where the keys match the Apex method parameter names exactly. For an Apex method like getAccount(Id accountId), the JavaScript call should be getAccount({ accountId: recordId }). This ensures the correct mapping of values to parameters.

Exam trap

SALESFORCE-PD1 often tests the correct syntax for imperative Apex calls, and candidates may mistakenly pass parameters as positional arguments or use incorrect object keys.

How to eliminate wrong answers

Option B is wrong because passing a positional argument like {recordId} does not match the Apex parameter name 'accountId', and the object key must match the Apex parameter name. Option C is wrong because the @api decorator is used to expose properties or methods from a component, not to bind parameters for Apex calls. Option D is wrong because there is no window.apexParams object; parameters are passed directly in the imperative call.

277
MCQhard

An Apex trigger performs a callout to an external web service and a developer is writing a unit test for this trigger. How should the developer handle the callout during the test execution?

A.Use System.runAs() to execute the test under a user with API Enabled permissions
B.Use Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator())
C.Wrap the trigger logic inside a Test.startTest() and Test.stopTest() block without mocks
D.Set the remote site setting dynamically inside the test method before the trigger fires
AnswerB

Test.setMock registers a mock callout implementation so the Apex runtime intercepts outbound HTTP requests instead of performing real network I/O. This satisfies the governor limit prohibiting callouts from tests, letting the trigger's callout path execute deterministically while the mock returns the stubbed HttpResponse your assertions verify.

Why this answer

Apex runtime throws an exception if a callout is attempted in a test without being mocked. The developer must implement the HttpCalloutMock interface and use Test.setMock().

278
MCQeasy

Which trigger context variable should a developer use to access the map of old record versions prior to the update operation?

A.Trigger.old
B.Trigger.newMap
C.Trigger.oldMap
D.Trigger.new
AnswerC

Trigger.oldMap supplies the pre-update record versions keyed by Salesforce record ID, which is exactly the map of old versions the stem requests. Trigger.old returns only a list, so it cannot provide ID-based lookup during update operations.

Why this answer

Trigger.oldMap provides a map of IDs to the old versions of the SObject records for update and delete triggers.

279
MCQmedium

Which of the following describes the behavior of Test.stopTest()?

A.It clears all variables created in the test.
B.It forces all queued asynchronous jobs to complete.
C.It resets the debug logs.
D.It stops all further execution of the test class.
AnswerB

Asynchronous operations such as future methods, queueable jobs, and batch processes initiated within a test context are held in a queue until `Test.stopTest()` is executed. This method acts as a synchronization barrier, forcing all accumulated asynchronous transactions to run synchronously to completion before any subsequent code executes. This mechanism directly satisfies the requirement to test asynchronous Apex code reliably within governor limits, ensuring that assertions regarding the completed database state can be evaluated immediately afterward.

Why this answer

Test.stopTest() forces all asynchronous jobs queued during the test — future methods, batch jobs, and queueable jobs — to execute synchronously before the method returns. This allows the test to make assertions on the results of asynchronous processing within the same test method.

Exam trap

The trap is confusing Test.stopTest() with a test-terminating statement — it does not stop the test or clear state; it only flushes queued async work, and execution continues afterward.

How to eliminate wrong answers

Option A is wrong because Test.stopTest() does not clear variables — variable scope is governed by normal Apex scoping rules, and test data is rolled back separately at the end of the test method. Option C is wrong because Test.stopTest() has no effect on debug logs; debug log configuration is managed through the Developer Console or Setup, not through test methods. Option D is wrong because Test.stopTest() does not halt test execution — code after stopTest continues to run, which is precisely why assertions are placed after it.

280
Multi-Selectmedium

Which TWO features of @isTest(SeeAllData=true) should a developer be aware of?

Select 2 answers
A.It speeds up test execution.
B.It is required for testing standard objects.
C.It ignores all governor limits.
D.It makes tests results dependent on the org's existing data.
E.It exposes all existing data in the org to the test method.
AnswersD, E

Utilising `@isTest(SeeAllData=true)` overrides the default test isolation behaviour in Salesforce, meaning unit tests bypass the empty-org sandbox restriction and instead query actual records present in the database. Consequently, test execution relies directly on pre-existing configuration and records within that specific environment. This directly satisfies the stem constraint requiring developers to be aware that test results become dependent on the org's existing data, which can cause intermittent failures if underlying records are modified or deleted.

Why this answer

It grants access to all org data and can lead to unexpected test results.

281
MCQeasy

A developer wants to inspect the code coverage of individual classes directly within the Salesforce Developer Console. Under which tab can the developer view this breakdown?

A.Tests tab
B.Query Editor tab
C.DOM Inspector tab
D.Logs tab
AnswerA

The Developer Console provides the **Tests** tab specifically to execute test suites and evaluate resulting metrics, including individual code coverage breakdowns per Apex class. This directly satisfies the requirement to inspect coverage data inside the Developer Console rather than relying on external tooling or the Setup menu. By navigating to this tab after running tests, a developer can immediately review aggregate and per-class execution percentages to ensure compliance with deployment thresholds.

Why this answer

The Tests tab in the Developer Console displays test execution status, test results, and code coverage percentages by class.

282
MCQmedium

A developer wants to ensure that a custom Apex controller method can be invoked securely from a Lightning Web Component. Which annotation must be applied to the method?

A.@AuraEnabled
B.@InvocableMethod
C.@RemoteAction
D.@WebService
AnswerA

Applying the `@AuraEnabled` annotation to a custom Apex method explicitly exposes it to the Lightning Component framework, satisfying the security and accessibility requirement needed for a Lightning Web Component to invoke server-side logic. Without this annotation, the controller method remains hidden from client-side JavaScript execution in the Salesforce platform, preventing unauthorised or accidental remote calls. Additionally, setting `@AuraEnabled(cacheable=true)` allows read-only methods to cache data on the client side, optimising performance when fetching records from the database.

Why this answer

@AuraEnabled enables methods to be called from Lightning components and can also cache data.

283
MCQmedium

How can a developer inspect the state of a private variable within a class during unit testing?

A.Change the class to @isTest.
B.Use the @TestVisible annotation.
C.There is no way to inspect private variables.
D.Make the variable public.
AnswerB

Annotating a private variable or method with `@TestVisible` grants test classes access to modify and inspect encapsulated state that would otherwise remain strictly hidden due to access modifier constraints. This specific Apex annotation satisfies the requirement to test private variables without unnecessarily loosening their encapsulation in production code, because the platform intentionally lowers the visibility restriction exclusively during execution of unit tests sharing the same context.

Why this answer

The @TestVisible annotation allows a test method in the same class or a test class in the same namespace to access private or protected members of the annotated class without changing the member's visibility for production code. This preserves encapsulation in production while enabling white-box testing of internal state. It can be applied to private variables, methods, and inner classes.

Exam trap

The trap here is confusing @isTest (which marks test code and exempts it from limits) with @TestVisible (which opens private members to test code) — candidates who skim often pick @isTest thinking it grants visibility.

How to eliminate wrong answers

Option A is wrong because @isTest is an annotation applied to test classes or test methods to prevent them from counting against org limits — it does not grant access to private members of another class. Option C is wrong because @TestVisible explicitly provides a supported mechanism to inspect private variables during tests, so the claim that no way exists is false. Option D is wrong because making the variable public weakens encapsulation in production code just to satisfy a test, which is an anti-pattern that @TestVisible was designed to avoid.

284
MCQhard

A developer needs to implement a custom logging framework. Which Apex data type should be used to represent a variable that can store any primitive value, sObject, or collection dynamically?

A.Any
B.Variant
C.Object
D.Dynamic
AnswerC

The `Object` data type in Apex is the universal base type capable of implicitly casting to and from any primitive data type, sObject, or collection. This satisfies the strict architectural constraint in the stem requiring a single dynamic variable type to store heterogeneous payloads without prior type casting. Unlike strongly typed declarations or generic wrappers, `Object` variables evaluate their runtime type dynamically, allowing developers to write flexible logging routines that accept arbitrary data structures at execution time.

Why this answer

The Object data type is the base data type in Apex and can hold any value, including primitives, sObjects, and collections.

285
MCQeasy

When should a developer use a record-triggered flow instead of a scheduled path in a flow?

A.When processing millions of historical records nightly.
B.When making external web service callouts synchronously.
C.When actions need to execute 30 days after a contract is signed.
D.When actions need to occur instantly upon record creation.
AnswerD

Record-triggered flows execute synchronously in real time upon record creation or update, which directly satisfies the requirement for instant action specified in the stem. Unlike scheduled paths—which introduce a time delay by queuing actions for execution at a specific date/time or after a set offset—immediate execution bypasses the asynchronous schedule engine entirely. This ensures business logic and database writes occur within the immediate transaction context, preventing latency when immediate data processing is mandated.

Why this answer

Record-triggered flows execute immediately upon record creation or update, whereas scheduled paths run at a specific time offset.

286
MCQhard

A developer is writing a custom wire adapter or working with custom data in LWC and needs to manually provision data or force a refresh of wire data. Which function should be imported from lightning/uiRecordApi or related wire modules?

A.reloadRecord
B.updateRecordCache
C.getRecordRefresh
D.refreshApex
AnswerD

`refreshApex` is the correct function to import because it imperatively provisions data and forces a refresh of cached wire data by invalidating the cache for a specific Apex method promise. This directly satisfies the requirement to manually provision data or force a refresh when working with custom data adapters or Apex-based wire services in Lightning Web Components, where standard record-level mutation functions from `lightning/uiRecordApi` are inapplicable.

Why this answer

refreshApex is used to imperatively refresh data provisioned by an Apex wire adapter.

287
Multi-Selectmedium

Which TWO of the following are valid ways to trigger an Apex test run?

Select 2 answers
A.From the User record.
B.By editing an Apex class.
C.Apex Test Execution page in Setup.
D.From a Workflow Rule.
E.Developer Console.
AnswersC, E

Running Apex tests directly from the Apex Test Execution page in Setup satisfies the requirement to trigger an Apex test run through the standard administrative interface provided within the Salesforce user web application. Administrators and developers use this specific setup tool to select individual classes or suites manually, monitor queue status, and view immediate test results without needing external tooling or API integrations.

Why this answer

Tests can be run from the Developer Console and from the Apex Test Execution page.

288
MCQmedium

You are debugging a performance issue in an Apex trigger. You want to see the database resource usage. Which debug log level should you set for the Database category?

A.ERROR
B.FINEST
C.INFO
D.DEBUG
AnswerB

Setting the Database category to FINEST captures granular execution details, including exact database resource usage, query plans, and the number of rows processed by SOQL queries and DML statements. This level of verbosity satisfies the requirement to inspect database performance constraints by revealing underlying governor limit consumption and query execution times that lower log levels omit.

Why this answer

To see detailed database resource usage in a debug log, the Database category must be set to FINEST, which logs SOQL queries, DML operations, and their execution details including row counts and timing. FINEST provides the most granular level of database activity, which is necessary for performance debugging.

Exam trap

Salesforce PD1 often tests the distinction between log levels, tricking candidates into choosing DEBUG or INFO when the question requires the most granular level, FINEST, for detailed resource usage.

How to eliminate wrong answers

Option A is wrong because ERROR only logs database errors, not the full resource usage or query details needed for performance analysis. Option C is wrong because INFO logs basic database operations but lacks the granular detail (e.g., query plans, row counts, timing) that FINEST provides. Option D is wrong because DEBUG is an intermediate level that logs more than INFO but still not the full detail of FINEST, which is required to see comprehensive database resource usage.

289
Multi-Selectmedium

A developer is designing a Lightning Web Component that needs to be conditionally displayed in different Salesforce containers. Which TWO targets are valid entries in the component's js-meta.xml configuration file? (Choose TWO)

Select 2 answers
A.lightning__CustomField
B.lightning__HomePage
C.lightning__ApprovalProcess
D.lightning__ApexClass
E.lightning__RecordPage
AnswersB, E

Enabling a component to appear on a home page container directly satisfies the requirement for conditional display across different Salesforce locations. The `lightning__HomePage` target explicitly grants permission for the Lightning Web Component to be added specifically to home pages via the Lightning App Builder, fulfilling one of the necessary container placement options specified in the stem while adhering to the metadata configuration schema.

Why this answer

Option B, lightning__HomePage, is a valid target because it allows the Lightning Web Component to be exposed on the Home page in Lightning Experience, which is one of the supported containers for conditional display. Option E, lightning__RecordPage, is also valid because it lets the component be placed on record pages, another standard Lightning Experience container. The other options are not valid targets: lightning__CustomField, lightning__ApprovalProcess, and lightning__ApexClass are not recognized js-meta.xml targets for exposing an LWC in a Salesforce container.

Therefore, only B and E are correct.

Exam trap

Salesforce PD1 often tests the distinction between valid and invalid LWC targets, and candidates may confuse targets with other metadata types like custom fields or Apex classes.

290
MCQhard

What happens if a test class has a method annotated with @testSetup that fails to insert data?

A.The test execution proceeds, but without data.
B.The platform ignores the @testSetup failure.
C.The entire test class fails to execute.
D.Only the first test method fails.
AnswerC

When a method annotated with `@testSetup` fails during execution, such as encountering a DML exception when attempting to insert test data, the entire transaction for that setup method is rolled back. Because the setup data is mandatory for the subsequent test methods in the class, the Apex test runner immediately aborts the execution of the entire test class. This satisfies the constraint that a failure in the `@testSetup` method prevents any other test methods within that class from running, as the prerequisite state cannot be established.

Why this answer

When a method annotated with @testSetup fails — for example, because a DML insert throws an exception — the entire test class is aborted and no test methods execute. The @testSetup method runs once before all test methods in the class, so its failure prevents the shared test data from being created and the platform marks the whole class as failed.

Exam trap

SALESFORCE-PD1 often tests the scope of @testSetup failures, and candidates incorrectly assume the failure is isolated to a single test method or that execution continues with empty data.

How to eliminate wrong answers

Option A is wrong because test execution does not proceed without data; the @testSetup failure halts the class before any test method runs. Option B is wrong because the platform does not ignore the failure — it surfaces it as a test failure for the class. Option D is wrong because it is not limited to the first test method; the failure blocks all test methods in the class, not just one.

291
MCQeasy

A developer needs to store a collection of unique customer email addresses in Apex and check for existence efficiently. Which collection type should the developer use?

A.Queueable
B.List
C.Map
D.Set
AnswerD

Set stores only unique elements and provides constant-time contains() lookups via hashing, so duplicate emails collapse automatically and existence checks avoid scanning. This satisfies the uniqueness and efficient existence-checking constraints, which List and Map do not address as directly.

Why this answer

A Set is a collection of unique elements and provides efficient lookup using methods like contains(), making it ideal for checking existence.

292
MCQmedium

When should a developer choose a Record-Triggered Flow over an Apex trigger for automating record updates before save?

A.When the automation requires complex external web service callouts.
B.When handling recursive trigger execution across multiple custom objects.
C.When performing complex DML operations on up to five related child objects.
D.When updating fields on the same record being saved for better performance and maintainability.
AnswerD

Record-Triggered Flows operating in "Fast Field Updates" (before-save) mode execute within the same transaction without triggering an additional recursive save, satisfying the requirement to update fields on the same record efficiently. This architectural design avoids the overhead of traditional Apex triggers, which require explicit field assignment followed by a separate database operation context, thereby significantly reducing CPU time limits and improving overall maintainability through a declarative interface.

Why this answer

Before-save record-triggered flows execute faster than Apex before-triggers and are fully declarative, making them the preferred choice for same-record field updates.

293
MCQeasy

Which trigger event handles the restoration of records from the Recycle Bin?

A.Before Undelete and After Undelete
B.Before Insert and After Insert
C.Before Update
D.Before Delete and After Delete
AnswerA

Apex triggers support `before undelete` and `after undelete` context variables specifically to handle record restoration from the Recycle Bin, satisfying the exact trigger event constraint specified in the stem. Developers can leverage these specific events to execute validation rules, modify field values before the records are fully restored, or perform post-restoration logging and related-record updates. No other trigger events fire during the undelete lifecycle phase, making these the mandatory hooks for intercepting and processing restored data.

Why this answer

Undelete triggers handle records restored from the recycle bin.

294
MCQhard

A developer needs to abort a scheduled Apex job programmatically from within a test class or maintenance script. Which method should be used?

A.System.cancelJob()
B.apexJob.terminate()
C.Database.stopBatch()
D.System.abortJob()
AnswerD

`System.abortJob()` accepts the unique string identifier (`ID`) of a scheduled Apex job and terminates its execution pipeline programmatically. This satisfies the core constraint of the stem—the requirement to abort a scheduled job via code rather than manually through the Salesforce user interface. By passing the `CronTrigger` ID returned upon job scheduling, developers can reliably clean up asynchronous queues during test class execution or maintenance scripts without relying on external administrative intervention.

Why this answer

System.abortJob(jobId) cancels a scheduled or flex-queued asynchronous job.

295
Multi-Selectmedium

Which TWO best practices should developers follow when implementing Queueable Apex chaining? (Choose two.)

Select 2 answers
A.Chain multiple queueable jobs simultaneously within a single synchronous transaction without limits.
B.Use future methods inside queueable execute methods instead of chaining queueable jobs.
C.Ensure that chained jobs handle governor limits and bulk data efficiently in each execution context.
D.Implement exit criteria or conditional checks to prevent infinite job chaining loops.
E.Hardcode all job IDs to ensure static binding between jobs.
AnswersC, D

Queueable Apex chaining initiates a new execution context with every subsequent job, which resets the governor limit counters. However, relying on this reset without designing for efficiency in each context can quickly lead to exhaustion of cumulative limits such as daily asynchronous Apex execution caps or heap size thresholds. By handling bulk data and governor limits properly within every chained link, developers ensure the transaction remains well within Salesforce platform boundaries, satisfying the requirement for robust execution and scalability across multi-step asynchronous processes.

Why this answer

Chaining queueable jobs should be conditional to avoid infinite loops and should monitor flex queue limits.

296
MCQmedium

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

A.repeat:for
B.for:each
C.apex:repeat
D.aura:iteration
AnswerB

The `for:each` directive satisfies the requirement to iterate over a list of items directly within a Lightning Web Component HTML template. When combined with the `for:item` directive and a unique `key` attribute on the rendered elements, it maps each item in the JavaScript array to the DOM. This declarative syntax provides the native mechanism needed to render repetitive structures efficiently without requiring imperative JavaScript manipulation.

Why this answer

LWC templates use the for:each directive to iterate over arrays, with for:item specifying the iteration variable and for:index providing the optional index. Each iterated element must have a unique key attribute (typically the record Id) to help the framework's diffing algorithm efficiently update the DOM.

Exam trap

The trap is mixing up iteration syntax across Salesforce frameworks — candidates who have written Visualforce or Aura code often select apex:repeat or aura:iteration out of habit, forgetting that LWC uses the distinct for:each directive.

How to eliminate wrong answers

Option A is wrong because repeat:for is not a valid LWC directive — the syntax is for:each, and there is no repeat:for construct in LWC templates. Option C is wrong because apex:repeat is a Visualforce iteration component, not usable in LWC templates. Option D is wrong because aura:iteration is the Aura component iteration tag, which belongs to the older Aura framework, not LWC.

297
MCQmedium

A developer is deploying a profile and custom fields using an Unmanaged Change Set. Upon deployment, some custom field permissions fail to apply correctly in production. What is the most likely cause of this behavior?

A.Unmanaged change sets require manual XML editing prior to upload.
B.Change sets do not support the deployment of custom fields under any circumstances.
C.Field-level security settings on profiles are sometimes omitted or overridden if the target profile already exists and has conflicting security configurations.
D.Profiles cannot be included in outbound change sets.
AnswerC

Unmanaged change sets frequently encounter deployment discrepancies when updating pre-existing profiles in a target production environment. Because the target profile already exists, field-level security configurations included in the inbound change set can be partially ignored or overridden by existing conflicting permissions within that destination org. This directly explains why the custom field permissions failed to apply correctly during the deployment, despite being explicitly defined in the source package.

Why this answer

Profiles and permission sets in change sets require careful component selection, and field-level security is often best handled via permission sets or post-deployment steps.

298
Multi-Selecthard

Which THREE strategies are recommended for improving the performance of Lightning Web Components rendering large lists of data? Choose 3 answers.

Select 3 answers
A.Use synchronous imperative Apex calls inside template iterators.
B.Provide a unique, stable 'key' attribute (such as record Id) on each iterated element in for:each loops.
C.Implement pagination or virtual scrolling / lazy loading for large datasets.
D.Avoid heavy computations inside template getter properties called during renders.
E.Render all 10,000 records at once in a single flat DOM tree without pagination.
AnswersB, C, D

Providing a unique, stable `key` attribute on each iterated element directly satisfies the requirement for rendering large lists of data efficiently. The Lightning Web Components framework relies on the `key` value within `for:each` directives to uniquely identify DOM nodes during the virtual DOM reconciliation process. When the underlying array updates, the diffing algorithm uses these stable keys to track item insertions, deletions, and reordering accurately. This mechanism prevents the browser from having to needlessly destroy and recreate entire DOM subtrees, thereby optimising rendering performance and preserving internal component state.

Why this answer

Option B is correct because giving each iterated element a unique, stable key (e.g., the record Id) in for:each loops lets the Lightning Web Components engine's diffing algorithm track items across re-renders and reuse DOM nodes instead of destroying and recreating them, which dramatically reduces rendering work. Option C is correct because pagination, virtual scrolling, or lazy loading limits the number of rows actually rendered in the DOM at any time, so the browser only paints a small window of records rather than the entire dataset, keeping render and layout times low. Option D is correct because getter properties referenced in a template are re-evaluated on every render cycle, so placing heavy computation or data transformation there multiplies the cost across all rows; moving that logic to one-time initialization or cached properties avoids repeated expensive work.

Option A is not recommended because synchronous imperative Apex calls block the client thread and, when invoked inside iterators, can fire one call per row, causing severe latency and governor-limit pressure. Option E is incorrect because rendering all 10,000 records at once in a single flat DOM tree creates an enormous DOM, causing slow initial render, sluggish scrolling, and high memory usage, which is exactly the anti-pattern these strategies are meant to avoid.

Exam trap

The trap is selecting options that seem intuitive but actually harm performance, such as rendering all records at once or using synchronous calls in loops; candidates may not realize the impact on rendering.

299
MCQmedium

An Apex trigger needs to update fields on the same record that is currently being inserted in a Before Insert trigger context. How should the developer implement this update?

A.Use an immediate DML statement update Trigger.new; inside the trigger.
B.Instantiate a separate list of the same records and call database.insert().
C.Utilize an after insert trigger to perform an update DML operation.
D.Assign values directly to the fields on the records in Trigger.new.
AnswerD

In a `Before Insert` trigger context, records exist solely in memory and have not yet been committed to the database. Directly assigning values to fields on the records within `Trigger.new` modifies the sObject instances in-flight, which satisfies the stem requirement to update fields on the same record currently being inserted. Because this manipulation occurs prior to the database insertion, no explicit `DML` statement such as `update` is required or even permitted, avoiding recursion and unnecessary governor limit consumption.

Why this answer

In a before insert trigger, records are already in memory and have not yet been saved to the database. Developers can modify fields directly on the Trigger.new records without calling an explicit DML operation.

300
MCQhard

A developer writes an Apex trigger that performs a DML operation on Account records. The Account has a Roll-Up Summary field calculated from child Contact records. What happens during the order of execution regarding roll-up summary field calculations?

A.Roll-up summary fields are calculated before before-triggers fire.
B.Roll-up summaries are deferred until a nightly batch runs.
C.Roll-up summary fields on the parent record are calculated after child DML and can trigger parent-level rules and triggers.
D.Roll-up summary calculations never trigger parent triggers.
AnswerC

Roll-up summary fields recalculate on the parent after child DML commits, satisfying the stem's ordering constraint. This recalculation then fires parent-level validation rules and triggers, so the developer must anticipate recursive or duplicate execution. Unlike formula fields, which compute at query time, roll-ups persist and drive automation.

Why this answer

Roll-up summary fields are recalculated by Salesforce after DML operations on child records and before the transaction completes, triggering parent rules.

Page 3

Page 4 of 5

Page 5

All pages