Courseiva

Salesforce Certified Platform Developer I (SALESFORCE-PD1) (SALESFORCE-PD1) — Questions 1–75

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

Page 1 of 5

Page 2
1
MCQhard

A developer implements a Queueable class that makes an external REST callout. The developer needs to test this class using Test.startTest() and Test.stopTest(). What is required for the callout to succeed in the test method?

A.Set the remote site setting active in the test context.
B.Implement the HttpCalloutMock interface and assign it using Test.setMock()
C.Use the Database.AllowsCallouts interface on the test class.
D.Wrap the callout in a try-catch block to bypass test restrictions.
AnswerB

Platform asynchronous execution, including Queueable jobs, prohibits live outbound HTTP requests during tests to prevent unpredictable external dependencies. To satisfy the requirement for making an external REST callout within a test method, implementing the `HttpCalloutMock` interface and registering it via `Test.setMock()` intercepts the runtime request and supplies a pre-configured fake response. This mechanism bypasses the platform's execution block, allowing the callout logic to complete successfully when `Test.stopTest()` synchronously flushes the asynchronous queue.

Why this answer

Callouts are not allowed in test methods unless mocked. The test must implement the HttpCalloutMock interface to simulate the response.

2
MCQeasy

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

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

`<apex:slds />` is the correct component because it explicitly satisfies the requirement to include standard Salesforce styling and modern icons within a Visualforce page. By adding this single tag to the top of the markup, the page automatically loads the Salesforce Lightning Design System (SLDS) stylesheet and asset library without requiring manual static resource uploads or custom CSS configuration, providing native access to Lightning Design System styling tokens and SVG icons.

Why this answer

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

3
MCQmedium

What must be true for a developer to deploy Apex code to a production environment?

A.The code must have 100% test coverage
B.Tests do not need to be run if the code was tested in sandbox
C.Only the new classes require coverage
D.All tests must pass and coverage must be at least 75%
AnswerD

Deploying Apex code to a production environment is strictly governed by Salesforce platform constraints designed to maintain baseline software quality. Specifically, the deployment engine enforces a hard requirement that all local unit tests must execute successfully without failure, alongside a mandatory aggregate code coverage threshold of at least 75% across all custom Apex classes and triggers. If either of these validation criteria fails during the deployment request, the entire transaction is automatically rolled back by the metadata service.

Why this answer

Deploying Apex to production requires that all tests in the org pass and that overall Apex code coverage is at least 75%. Salesforce enforces this at deployment time; if any test fails or coverage falls below the threshold, the deployment is rejected. Coverage is calculated across all Apex classes and triggers in the org, not just the newly deployed code.

Exam trap

The trap is the specific number — candidates often confuse the 75% org-wide minimum with a per-class requirement or mistakenly believe 100% coverage is mandated for production deployments.

How to eliminate wrong answers

Option A is wrong because 100% coverage is not required — the platform enforces a 75% minimum, and demanding 100% would be an unrealistic and incorrect standard. Option B is wrong because tests are always run during production deployments regardless of sandbox testing; sandbox results do not carry over. Option C is wrong because coverage is measured org-wide, not just on new classes — existing classes with low coverage can drag the overall percentage below 75% and block deployment.

4
MCQmedium

A developer is writing a Batch Apex class to update 50,000 records. Which method must be implemented to define the scope of records to be processed?

A.initialize
B.execute
C.finish
D.start
AnswerD

The `start` method is mandatory in any Batch Apex implementation because it directly satisfies the requirement to define the scope of 50,000 records by returning either a `Database.QueryLocator` or an `Iterable`. This specific method establishes the exact collection of records passed to the `execute` method, allowing the platform to manage large data volumes efficiently by breaking the overarching workload into smaller, manageable sub-batches.

Why this answer

The start method in the Database.Batchable interface returns a QueryLocator or Iterable to define the records.

5
MCQmedium

When evaluating whether to use Flow Builder or an Apex trigger for record automation, which scenario best justifies choosing an Apex trigger over a Record-Triggered Flow?

A.Sending a simple email alert when a Case status changes.
B.Executing custom callouts and complex recursive logic across multiple related parent and child objects in bulk.
C.Displaying a custom validation error message on a field.
D.Updating a field on the same record before it is saved.
AnswerB

Complex recursive logic spanning multiple related parent and child objects alongside custom callouts handled asynchronously in bulk directly satisfies the architectural threshold where declarative limits of Record-Triggered Flows are exceeded. Apex triggers provide precise execution context control, recursive static variable state management, and the imperative execution power required to orchestrate heavy transactional processing without hitting declarative governor limits or encountering infinite recursion issues inherent in complex multi-object graphs.

Why this answer

Apex triggers are recommended over flows when handling complex multi-object transactional logic, callouts, or heavy bulk operations where performance and fine-grained control are paramount.

6
MCQeasy

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

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

The `renderedCallback()` lifecycle hook executes every time a component finishes rendering its HTML template, satisfying the requirement to run logic after *every* render cycle. Unlike `connectedCallback()`, which fires only once when the component is inserted into the DOM, `renderedCallback()` is called after initial rendering and subsequent re-renders triggered by reactive property changes. This makes it suitable for integrating third-party JavaScript libraries or performing manual DOM manipulations that must remain synchronised with the latest component state.

Why this answer

The renderedCallback hook is invoked after every render of the component, including the initial render and subsequent re-renders. It is used for logic that needs to run after the DOM is updated, such as manipulating the DOM or accessing rendered elements.

Exam trap

Salesforce PD1 often tests the frequency of renderedCallback versus connectedCallback; candidates may incorrectly think renderedCallback runs only once, but it runs after every render.

How to eliminate wrong answers

Option A is wrong because the constructor is called once when the component is created, before rendering, and is not called again on re-renders. Option B is wrong because connectedCallback is called only when the component is inserted into the DOM, not after every render. Option C is wrong because errorCallback is called when a descendant component throws an error, not after render.

7
MCQeasy

What is the primary purpose of the Model-View-Controller (MVC) design pattern implementation in Lightning Web Components (LWC)?

A.To convert Apex triggers into asynchronous jobs
B.To bypass Salesforce governor limits automatically
C.To separate data, user interface, and application logic into distinct components
D.To enforce field-level security without writing code
AnswerC

MVC divides LWC code so the model holds data and business logic, the template renders the view, and the controller handles user interaction. This separation satisfies the requirement for distinct components, improving maintainability, testability and reuse across the application.

Why this answer

MVC separates application data (Model), user interface (View), and business logic/event handling (Controller) to promote modularity and maintainability.

8
MCQeasy

A developer needs to invoke an asynchronous method from a standard synchronous Apex trigger. The asynchronous method must be annotated with which keyword?

A.@AuraEnabled
B.@future
C.@InvocableMethod
D.@testVisible
AnswerB

The `@future` annotation is specifically designed to satisfy the execution context constraint of a synchronous Apex trigger, which cannot directly call asynchronous methods or make outbound callouts without deferred processing. By marking the method with `@future(callout=true)` or a standard future method, the Salesforce runtime queues the execution to run asynchronously in a separate thread once the current synchronous transaction finishes. This bypasses governor limits and resolves the architectural conflict inherent in triggering out-of-process operations from database event hooks.

Why this answer

Methods intended to run asynchronously outside the current request must be annotated with @future.

9
MCQmedium

A developer wants to test an asynchronous future method. Where must the developer place the asynchronous code execution so that it runs synchronously and within the test context?

A.Inside a System.runAs() block
B.Within a try-catch block
C.Inside a Database.executeBatch block
D.Between Test.startTest() and Test.stopTest()
AnswerD

Placing the callout between Test.startTest() and Test.stopTest() forces asynchronous future methods to execute synchronously once Test.stopTest() runs, returning control only after completion. This satisfies the stem's requirement that the code runs within the test context, letting the developer assert on results immediately.

Why this answer

Test.startTest() and Test.stopTest() bracket the code block where asynchronous processes like future methods, batch jobs, and queueables are forced to execute synchronously.

10
MCQeasy

A developer needs to schedule a class to run nightly at midnight to clean up stale audit records. Which interface must the class implement?

A.System.Schedulable
B.Database.AllowsCallouts
C.Queueable
D.Database.Batchable<SObject>
AnswerA

Implementing the `System.Schedulable` interface is required because it exposes the `execute(SchedulableContext sc)` method, which enables Apex code to run asynchronously at specified times and dates via Cron expressions. This directly satisfies the requirement in the stem to schedule a class to run nightly at midnight, whereas standard synchronous execution or trigger frameworks lack the temporal capability needed for automated, recurring background maintenance jobs.

Why this answer

To use Schedulable Apex, the class must implement the Schedulable interface, which contains the execute(SchedulableContext SC) method.

11
Multi-Selecthard

Which THREE techniques help prevent hitting governor limits when writing SOQL queries in Apex? Choose 3 answers.

Select 3 answers
A.Omitting LIMIT clauses on large queries to ensure all records are fetched at once.
B.Filtering queries using indexed fields (such as Id, Name, or external IDs) where possible.
C.Querying records into lists rather than single sObject variables when multiple records match.
D.Using bind variables to pass collection criteria into SOQL WHERE clauses.
E.Placing SOQL queries inside helper methods called within loops.
AnswersB, C, D

Query optimisation through indexed fields directly addresses the requirement to prevent SOQL governor limits by drastically reducing database scan times. Standard fields like Id and Name, alongside custom indexed or external ID fields, allow the Salesforce query optimizer to bypass complete table scans and retrieve records via a B-tree lookup structure. This targeted retrieval consumes significantly fewer CPU time and database query resources, ensuring transactions execute well within strict multi-tenant resource boundaries.

Why this answer

Best practices include querying into collections, using bind variables, and filtering with indexed fields.

12
MCQmedium

A developer needs to pass a custom SObject record with related child lists into an asynchronous execution context. Which asynchronous Apex feature supports passing non-primitive types such as custom Apex objects or sObject collections?

A.Scheduled Apex
B.Future methods
C.Queueable Apex
D.Trigger asynchronous execution blocks
AnswerC

Queueable Apex successfully satisfies the constraint of passing non-primitive types, such as sObject collections with related child lists, because it allows member variables of any data type to be directly serialised within the class state. Unlike `@future` methods, which are strictly limited to primitive data types and collections of primitives, Queueable classes can implement the `Queueable` interface and maintain complex data structures directly as class properties during the transition into the asynchronous execution context.

Why this answer

Queueable Apex supports member variables of non-primitive types, including sObjects and custom classes.

13
MCQeasy

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

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

The `@api` decorator satisfies the requirement to define a public property that a parent component can set, marking the field as reactive and part of the component's public API. In Salesforce Lightning Web Components, fields are private by default; applying `@api` exposes the property so that parent components can pass data down into the child's template using HTML attributes or JavaScript properties.

Why this answer

The @api decorator in Lightning Web Components marks a property or method as public, making it accessible to parent components. It is the required decorator for any property that a parent needs to set, and it also makes the property reactive. Without @api, the property is private and cannot be set from outside the component.

Exam trap

Salesforce PD1 often tests the confusion between @api and @track, where candidates incorrectly choose @track for parent-to-child property passing, not realizing @track is for private reactivity and @api is for public exposure.

How to eliminate wrong answers

Option A is wrong because @track is used to make a private property reactive for changes to nested object properties or array elements — it does not expose the property to parent components. Option C is wrong because @auraEnabled is an Aura-specific decorator used to expose Aura controller methods to Lightning components, not an LWC decorator for public properties. Option D is wrong because @wire is used to provision data from a Salesforce wire adapter (e.g., getRecord) and does not define a public property for parent-to-child communication.

14
MCQhard

Which of the following describes the behavior of a static variable in Apex?

A.It is stored in the database
B.It is reset for each trigger event
C.It is shared across all users
D.It persists for the duration of the transaction
AnswerD

A static variable in Apex is bound to the execution context of a single transaction, fulfilling the constraint that its state is maintained across multiple class instantiations within that specific request boundary. When triggers, asynchronous processes, or multiple controller methods execute sequentially in the same transaction thread, the static variable retains its assigned value. However, once the transaction completes—whether successfully or via an unhandled exception—the memory allocated for the static variable is immediately cleared, ensuring no data leakage occurs between separate transactional boundaries.

Why this answer

Static variables are scoped to the transaction and persist across the entire trigger execution.

15
MCQeasy

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

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

The `<apex:pageMessages />` component directly satisfies the requirement to display all messages generated by controllers or validation rules simultaneously. It automatically aggregates and renders every message added to the Apex `ApexPages` context, including standard database save exceptions, custom controller `ApexPages.Message` instances, and field-level validation errors triggered during DML operations. By rendering this unified collection in a single block, it provides the precise mechanism needed for comprehensive error handling on a Visualforce page without requiring manual iteration through individual message lists.

Why this answer

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

16
MCQmedium

In the order of execution, when are custom validation rules evaluated relative to Before Triggers?

A.After After Triggers
B.Before Before Triggers
C.Concurrently with After Triggers
D.After Before Triggers
AnswerD

Salesforce executes custom validation rules immediately after before triggers complete during the save process. This specific sequence satisfies the order of execution constraint because before triggers run first to manipulate or set field values on the record, ensuring that any subsequent validation rules evaluate against the final, pre-processed data state before it reaches the database.

Why this answer

Custom validation rules are evaluated after Before Triggers complete.

17
MCQmedium

A developer needs to access private methods in an Apex class for unit testing without making them public. Which annotation is the most appropriate?

A.@RemoteAction
B.@isTest
C.@TestVisible
D.@ReadOnly
AnswerC

The `@TestVisible` annotation explicitly satisfies the requirement to access private or protected methods during unit testing without altering the production access modifier to public. By applying this annotation, test methods gain visibility into private variables and methods within an Apex class, bypassing standard access-level compilation constraints while preserving strict encapsulation in non-test execution contexts.

Why this answer

@TestVisible allows test classes to access private and protected members of a class.

18
Multi-Selectmedium

Which TWO best practices should a developer follow when writing bulkified Apex triggers? (Choose TWO.)

Select 2 answers
A.Perform DML statements and SOQL queries outside of loops by utilizing collections.
B.Hardcode record IDs in trigger logic to route specific test accounts.
C.Use synchronous callouts directly inside before insert triggers.
D.Design code to process collections of records (Trigger.new) rather than single records.
E.Place SOQL queries inside loops to ensure every record gets fresh data.
AnswersA, D

Using collections to process records in bulk directly satisfies the requirement to write bulkified triggers that handle governor limits safely. Salesforce strictly enforces execution limits, including a maximum of 100 SOQL queries and 150 DML statements per transaction. By gathering records into lists or maps and performing database operations outside of iterative loops, a developer ensures the code operates within these runtime constraints regardless of whether a single record or two hundred records are processed simultaneously.

Why this answer

Bulkified triggers must operate on collections (Trigger.new) and avoid SOQL/DML inside loops.

19
Multi-Selecteasy

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

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

Lightning Web Components leverage modern web standards by running on the core ECMAScript, custom elements, and shadow DOM features supported natively by browsers, eliminating the heavy proprietary abstraction layer that Aura requires. This architectural difference directly satisfies the stem's requirement to identify structural contrasts between the two frameworks, as Aura relies on a proprietary component model and framework-specific lifecycle abstractions, whereas LWC executes standard JavaScript and web APIs directly within the browser runtime for improved performance.

Why this answer

Option C is correct because LWC is built on native web standards such as standard JavaScript, HTML templates, and Web Components APIs, so it leverages capabilities already present in modern browsers rather than relying on a proprietary framework layer. Option E is correct because LWC runs on the browser's native engine features (for example, standard DOM APIs and native Shadow DOM), which reduces framework overhead and generally yields better performance than Aura's framework abstractions. Options A, B, and D are not correct: LWC components do contain HTML markup in their templates, LWC is not restricted to desktop (it supports mobile and Salesforce mobile app experiences), and Aura does not use standard Shadow DOM encapsulation—it relies on its own framework-managed encapsulation rather than native Shadow DOM.

Exam trap

The trap is assuming LWC lacks HTML or is desktop-only, or that Aura uses standard Shadow DOM — candidates who haven't internalized that LWC is standards-based and Aura is framework-based pick the wrong statements.

20
MCQhard

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

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

LWC's reactive engine tracks assignments to fields, not deep mutations, so changing a nested property leaves the original reference intact and no rerender triggers. Satisfying the stem's constraint, you must reassign a new object reference (or decorate the field with @track) for internal field changes to propagate.

Why this answer

LWC reactivity is shallow: the framework tracks assignments to the property itself, not mutations to nested fields. Changing obj.field does not trigger re-render because the object reference is unchanged. To make nested changes reactive, reassign the property with a new object (e.g., this.obj = {...this.obj, field: value}) or decorate the property with @track.

Exam trap

Salesforce-PD1 often tests the misconception that LWC provides deep reactivity like some frameworks, when in fact mutations to nested object fields require a new reference or @track.

How to eliminate wrong answers

Option A is wrong because const vs let has no bearing on reactivity; reactive properties are class fields regardless of declaration keyword. Option C is wrong because wrapping in Aura does not enable deep tracking — LWC reactivity is independent of Aura. Option D is wrong because LWC fully supports objects as reactive properties; the limitation is depth, not type.

21
MCQmedium

A developer created a Screen Flow that collects a Case's priority and assigns it to the Case record. After saving the flow and embedding it on a Lightning record page, users report that the Case's Priority field is not updating even though the flow completes without errors. What is the most likely cause?

A.Lightning record pages cannot host Screen Flows that perform DML operations on the same record.
B.The Case object's Priority field is read-only at the field level and must be made editable before any flow can change it.
C.The flow was created with the 'Run in System Mode Without Sharing' setting enabled, blocking field-level updates.
D.The flow lacks an Update Records element to commit the Priority value to the Case record.
AnswerD

Screen Flows do not automatically persist changes to record fields collected via input components. The developer must add an Update Records element that references the Case record variable and maps the collected priority value to the Priority field. Without this explicit DML operation, the flow finishes without modifying the database, which matches the reported symptom.

Why this answer

Screen Flows only persist data when an explicit data element such as Update Records is executed. Collecting a value in a screen component and assigning it to a record variable does not commit the change to the database. The developer must add an Update Records element that maps the collected priority to the Case's Priority field, ensuring the flow performs the required DML.

Exam trap

The trap here is assuming that assigning a screen input to a record variable automatically saves the record, when an explicit Update Records element is required.

22
MCQeasy

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

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

Setting the `standardStylesheets` attribute to true on the `<apex:page>` component directly satisfies the requirement to include standard Salesforce styling. By default, this attribute evaluates to true, which injects the core Salesforce stylesheet into the rendered HTML document. This mechanism ensures that standard user interface elements, such as input fields, labels, and buttons, automatically inherit the native Lightning or Salesforce Classic visual look and feel without requiring custom CSS definitions to be written manually by the developer.

Why this answer

The standardStylesheets attribute on the <apex:page> tag, when set to 'true', includes standard Salesforce styling (CSS) in the Visualforce page. This enables the page to use the standard Salesforce look and feel.

Exam trap

The trap is confusing standardStylesheets with lightningStylesheets, as both relate to styling but serve different purposes; candidates may pick the Lightning-specific attribute incorrectly.

How to eliminate wrong answers

Option A is wrong because lightningStylesheets is an attribute that applies Lightning Experience styles to the page, but it is not the one that includes standard Salesforce styling; it is used to make Visualforce pages look like Lightning. Option C is wrong because applyHtmlTag controls whether the page renders the <html> tag, not styling. Option D is wrong because sidebar controls the display of the sidebar, not styling.

23
Multi-Selectmedium

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

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

Salesforce Lightning Design System (SLDS) utility classes provide a predefined, scalable spacing scale that natively adheres to the platform's responsive design guidelines. Preferring these standard classes over hardcoded CSS rules satisfies the design token constraint by ensuring visual consistency across components while preventing specificity wars and style bleed. This approach leverages the underlying token architecture to automatically adapt padding and margins to varying viewport sizes and context changes without manual overrides.

Why this answer

Option B is correct because SLDS provides utility classes (such as slds-m-around_medium and slds-p-horizontal_small) that implement the design system's spacing scale consistently, so using them instead of hardcoded padding/margin values keeps components aligned with SLDS and themeable. Option E is correct because LWC exposes SLDS design tokens as CSS custom properties (for example var(--lwc-spacingMedium) or var(--lwc-colorBrand)), letting styles reference the design system's values and adapt to theming rather than duplicating literal values. Option A is wrong because sprinkling !important everywhere is an anti-pattern that fights LWC's style encapsulation and makes styles brittle; encapsulation is handled by scoping, not by !important.

Option C is wrong because global stylesheets loaded via <link> in static resources are not the recommended way to style LWC components, which rely on component-scoped CSS files. Option D is wrong because shadow DOM styles cannot be overridden from a parent component's CSS without using supported styling hooks (::part or CSS custom properties), so directly reaching into shadow DOM is not a valid practice.

Exam trap

Salesforce-PD1 often tests LWC styling encapsulation — the trap is choosing !important or global <link> CSS as a shortcut, when the correct answers are SLDS utility classes and design tokens via CSS custom properties.

24
MCQmedium

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

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

The `for:each` directive provides the standard mechanism for rendering lists within Lightning Web Components. By binding the `items` array to the template and assigning each element to the `item` variable, the component dynamically generates DOM elements for every entry in the collection. This approach satisfies the requirement to iterate over a list of items efficiently, ensuring that the UI remains synchronised with the underlying JavaScript data structure while maintaining strict adherence to the declarative template syntax mandated by the framework.

Why this answer

In LWC templates, iteration is performed with the for:each directive: <template for:each={items} for:item="item">. This is the standard LWC syntax for rendering a list, and it requires a for:item attribute to name the current item (and optionally for:index for the index). It is the only correct directive among the options for LWC.

Exam trap

Salesforce PD1 often tests syntax recognition across frameworks; candidates confuse Aura's aura:iteration, Visualforce's apex:repeat, and LWC's for:each, especially when the question doesn't explicitly say 'LWC' in every option.

How to eliminate wrong answers

Option A is wrong because <template repeat={item in items}> is not valid LWC syntax — LWC does not use a repeat attribute; that resembles older templating systems. Option B is wrong because <aura:iteration> is Aura component syntax, not LWC; LWC templates cannot use aura: tags. Option C is wrong because <apex:repeat> is Visualforce syntax used in Apex pages, not in LWC.

25
MCQhard

A developer is writing a trigger on the Contact object that needs to reference old field values during an update operation. In which trigger context variable are these previous values stored?

A.Trigger.new
B.Trigger.previousValues
C.Trigger.newMap
D.Trigger.old
AnswerD

`Trigger.old` is the correct context variable because it stores a collection of `Contact` sObjects representing the pre-update state of records during a DML update operation. This directly satisfies the requirement in the stem to reference old field values when executing a trigger on the `Contact` object. By providing access to the prior versions of records in bulk, it allows developers to compare previous field values against current values found in `Trigger.new` to evaluate changes before committing database transactions.

Why this answer

Trigger.old contains a list of sObject records prior to the update or delete operation.

26
MCQeasy

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

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

Salesforce mandates a precise naming convention and file extension for Lightning Web Component configuration metadata files to ensure the Lightning framework recognises and deploys them correctly. To satisfy the stem's requirement for the correct format, the configuration file must combine the exact component name with the `.js-meta.xml` extension, resulting in `componentName.js-meta.xml`. This specific suffix informs the platform that the XML document defines the component's metadata, such as target device availability and design properties, distinguishing it from standard JavaScript controller or template files within the bundle.

Why this answer

The Lightning Web Component configuration file must be named `componentName.js-meta.xml` — the component's base name followed by `.js-meta.xml`. This file defines the component's metadata, including its API version, targets, and exposed properties, and the naming convention is mandatory for the framework to recognize it.

Exam trap

Salesforce PD1 often tests the confusion between Aura component metadata (`.cmp-meta.xml`) and LWC metadata (`.js-meta.xml`), since both are XML files in component bundles.

How to eliminate wrong answers

Option A is wrong because `.cmp-meta.xml` is the naming convention for Aura components, not LWC. Option B is wrong because `.xml` alone is too generic and does not follow the LWC bundle convention. Option C is wrong because `.config.xml` is not a recognized LWC metadata file extension.

27
Multi-Selectmedium

Which TWO statements about SOQL relationship queries are true? Choose 2 options.

Select 2 answers
A.SOQL supports traversing up to 10 levels of parent relationships.
B.Parent-to-child queries use dot notation on the parent object.
C.Child-to-parent queries require subqueries.
D.Child-to-parent queries use dot notation (e.g., Account.Name).
E.Parent-to-child queries use a subquery inside parentheses.
AnswersD, E

Child-to-parent queries in Salesforce Object Query Language utilise standard dot notation to traverse the data model from a child object to its related parent, successfully satisfying the requirement to identify the correct syntax for traversing relationships. By referencing the relationship name followed by the parent field (for example, `Account.Name` when querying Contacts), developers can retrieve fields from a single related parent record in a single query execution.

Why this answer

Parent-to-child queries use subqueries in parentheses, and child-to-parent queries use dot notation.

28
MCQhard

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

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

The `disconnectedCallback()` lifecycle hook executes precisely when a Lightning web component is removed from the DOM, making it the correct phase to clean up subscriptions and satisfy the requirement to unsubscribe from a message channel upon component destruction. By placing the `uniquelyunsubscribe()` or equivalent removal logic inside this standard browser-aligned callback, developers prevent memory leaks, orphaned event listeners, and errors caused by messages attempting to reach a component that no longer exists in the active DOM tree.

Why this answer

The disconnectedCallback lifecycle hook fires when a component is removed from the DOM, making it the correct place to unsubscribe from a Lightning Message Channel. Failing to unsubscribe here causes memory leaks and errors when messages arrive for a destroyed component.

Exam trap

Salesforce PD1 often tests the pairing of subscribe in connectedCallback with unsubscribe in disconnectedCallback, tricking candidates into choosing renderedCallback or constructor for cleanup.

How to eliminate wrong answers

Option A is wrong because connectedCallback is where you subscribe to the message channel, not unsubscribe — unsubscribing there would immediately cancel the subscription. Option B is wrong because the constructor runs before the component is connected and before any subscription exists; unsubscribing there is meaningless. Option D is wrong because renderedCallback fires after rendering and can run multiple times; unsubscribing there would break the subscription prematurely and repeatedly.

29
Multi-Selecteasy

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

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

Visual Studio Code integrated with the Salesforce Extension Pack serves as the primary officially supported local development environment for building Lightning Web Components. This combination satisfies the core platform requirement for an extensible, industry-standard code editor that natively supports Salesforce DX tooling, Lightning Language Server protocols, and integrated debugging workflows. Developers utilise this local integrated development environment to author markup, JavaScript, and CSS files before deploying the compiled source directly to an org via metadata APIs.

Why this answer

Option B is correct because Salesforce officially supports developing Lightning Web Components in Visual Studio Code using the Salesforce Extension Pack, which provides LWC-specific tooling such as syntax highlighting, code completion, and the ability to deploy and retrieve components to and from an org. Option D is correct because the Salesforce CLI (sfdx/sf) is the officially supported command-line environment for scaffolding, building, testing, and deploying LWC source, and it underpins the VS Code extensions and CI/CD workflows. The remaining options do not belong: Microsoft FrontPage 2003 (A), Eclipse with the legacy Force.com IDE v1 plugin (C), and Dreamweaver MX with custom snippets (E) are obsolete or unrelated web-authoring tools that have no official Salesforce support for LWC development.

Exam trap

Salesforce-PD1 often tests whether candidates recognize the officially supported toolchain versus legacy or unrelated IDEs that look plausible.

30
MCQmedium

A developer needs to process 500,000 records daily and update a custom field based on complex business logic. Which asynchronous Apex feature is specifically designed to handle large batch data processing with flexible scope sizes and built-in transaction monitoring?

A.Future Methods
B.Queueable Apex
C.Batch Apex
D.Schedulable Apex
AnswerC

Batch Apex is specifically designed to handle large volumes of data, such as the 500,000 records mentioned in the stem, by breaking the workload down into manageable chunks known as batches. It satisfies the requirement for flexible scope sizes through the optional `scope` parameter in the `start` method, allowing developers to tune batch sizes from 1 to 2,000 records. Furthermore, it provides built-in transaction monitoring via the `AsyncApexJob` object, enabling developers to track execution status and success rates daily.

Why this answer

Batch Apex is designed for processing large numbers of records (millions) by breaking them down into manageable batches and running them asynchronously.

31
MCQeasy

A developer needs to write a test class for an Apex class that performs DML operations. Which annotation must be used to define the class as a test class?

A.@TestSetup
B.@TestVisible
C.@Test
D.@isTest
AnswerD

To satisfy the requirement of defining an Apex class specifically as a test class for executing DML operations within a unit test context, developers must use the `@isTest` annotation. This exact annotation tells the Salesforce platform that the container is a test utility, granting access to test context methods and isolating database transactions so that DML actions performed during testing do not permanently alter organisational data.

Why this answer

The @isTest annotation is required to define a class as a test class in Apex.

32
MCQmedium

A developer needs to execute a lightweight background task that does not require complex chaining or monitoring. Which asynchronous feature is easiest to implement for a single method call?

A.Batch Apex
B.Schedulable Apex
C.Custom Invocable Action
D.Future Method
AnswerD

A future method is annotated with @future and invoked as a single static call, requiring no job chaining, monitoring or Queueable interface implementation. This makes it the simplest asynchronous option for a lightweight, non-chained background task.

Why this answer

Future methods are the simplest way to run asynchronous code when no complex state or chaining is needed.

33
MCQmedium

Which log level is best for finding logic flow issues without cluttering the log?

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

DEBUG strikes the ideal balance for tracing logic flow because it records user-defined statements and method entries without the excessive verbosity generated by finer levels like FINE or FINER. This specific granularity satisfies the stem's constraint to avoid log clutter while still capturing enough detail to inspect conditional branches, loop iterations, and variable states during execution. Developers rely on this level to isolate control flow paths efficiently within the Apex execution context without overwhelming the debug log storage limits.

Why this answer

DEBUG is the standard level for custom messages and logic tracing.

34
MCQmedium

What is the primary function of a scratch org?

A.A source-driven, ephemeral environment for testing and development.
B.A backup tool for production data.
C.A permanent environment for staging.
D.A tool to migrate Change Sets.
AnswerA

Scratch orgs serve as dedicated, fully customisable Salesforce environments that are created from a project configuration file and connected to an authorised Salesforce DX hub. They satisfy the core requirement for a source-driven, ephemeral environment because their lifespan is intentionally limited—typically lasting between 1 and 30 days—and they can be spun up or torn down dynamically as developers write, test, and push metadata directly from their local version control systems without relying on permanent sandbox infrastructure.

Why this answer

A scratch org is a disposable, source-driven Salesforce environment intended for development, testing, and continuous integration. It is ephemeral, meaning it can be created, used, and then deleted, and its configuration is defined in a JSON file.

Exam trap

Salesforce PD1 often tests the misconception that scratch orgs are permanent or used for data backup, when they are actually ephemeral, source-driven development environments.

How to eliminate wrong answers

Option B is wrong because scratch orgs are not used for backing up production data; they are empty environments for development. Option C is wrong because scratch orgs are temporary, not permanent staging environments. Option D is wrong because scratch orgs do not migrate Change Sets; they are used with Salesforce DX and source control.

35
Multi-Selectmedium

Which THREE criteria are best suited for choosing an Apex Trigger over a Flow?

Select 3 answers
A.Requirement for high-performance, low-latency execution
B.High-volume bulk processing
C.Simple field updates on the same record
D.Sending a simple email alert
E.Complex multi-object logic that exceeds Flow limits
AnswersA, B, E

Apex runs natively on the application server with a compiled execution model, bypassing the database-level overhead and metadata evaluation inherent to declarative tools. This direct runtime compilation delivers the high-performance, low-latency execution required when processing bulkified operations efficiently. Consequently, this satisfies the strict requirement for high-performance, low-latency execution specified in the stem by minimising CPU time and avoiding governor limit bottlenecks during heavy transactional loads.

Why this answer

Complex bulk logic, heavy computational requirements, and performance-critical operations are best handled in Apex.

36
MCQhard

When is an Apex test run automatically executed?

A.Every time a trigger runs.
B.During production deployment.
C.When a record is saved.
D.When a user logs in.
AnswerB

Salesforce automatically executes all local Apex tests during any production deployment to satisfy the strict platform constraint requiring a minimum of 75% overall code coverage and 100% passing results before new custom code or configuration changes can be committed to a live environment. This automated regression testing phase ensures that incoming functional modifications do not break existing business logic, triggers, or asynchronous processes already operating in the production org, thereby safeguarding system stability and data integrity.

Why this answer

Tests are run automatically during deployment and package installation.

37
MCQhard

A developer wants to chain a second asynchronous job from within an executing Queueable Apex job. Which method should be used?

A.System.enqueueJob()
B.Database.executeBatch()
C.apexJob.schedule()
D.Future.runAsync()
AnswerA

`System.enqueueJob()` is the only valid mechanism to chain a second asynchronous job from within an executing Queueable Apex context, directly satisfying the requirement to initiate a subsequent asynchronous process sequentially. Unlike future methods, which cannot be called from another asynchronous execution, `System.enqueueJob()` supports flexible job chaining by returning an ID that can be monitored, allowing developers to execute dependent asynchronous operations reliably within the Governor limit framework.

Why this answer

System.enqueueJob is used inside an execute method of a Queueable class to chain another job.

38
MCQmedium

When debugging a trigger, how can you view the flow of execution including entry and exit points of methods?

A.By examining the heap size.
B.By viewing the Call Stack.
C.By running an Apex report.
D.By checking the Database log.
AnswerB

The Call Stack directly satisfies the requirement to trace the flow of execution and view the entry and exit points of methods during debugging. When an Apex trigger invokes helper methods or service classes, the developer console captures the hierarchical sequence of active stack frames. By inspecting this snapshot at a breakpoint or exception, you can precisely navigate backwards and forwards through nested method calls, satisfying the exact constraint of visualising execution pathways without relying solely on static log text.

Why this answer

The Call Stack in the Debug Log shows the hierarchy of method calls.

39
MCQhard

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

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

Directly invoking a public method on a child component from its container requires a DOM query, satisfying the requirement for upward communication from parent to child in Lightning Web Components. By utilising `this.template.querySelector('c-child-component')`, the parent obtains a direct reference to the child element instance rendered in its template. Once the component reference is secured, appending the explicitly exported function name—decorated with `@api` in the child JavaScript controller—allows the parent to execute the logic synchronously across the component boundary.

Why this answer

In LWC, a parent can call a public method on a child component by querying the child element from the parent's template and invoking the method directly. The child must expose the method with the @api decorator, and the parent uses this.template.querySelector('c-child-component') to obtain the element reference, then calls the method on it. This is the documented pattern for parent-to-child method invocation.

Exam trap

Salesforce-PD1 often tests the direction of LWC communication — the trap is picking events (which flow up) when the question asks for a parent calling a child method (which flows down via querySelector).

How to eliminate wrong answers

Option A is wrong because Lightning Message Service (LMS) is for cross-DOM communication between unrelated components (e.g., Aura and LWC, or across tabs), not for a parent calling a method on its own child. Option B is wrong because @api properties are for passing data down reactively, not for invoking behavior — updating a property does not call a method. Option C is wrong because events bubble up from child to parent, not down; dispatching from the parent and listening in the child inverts the LWC event direction.

40
MCQmedium

A developer is debugging a process that involves asynchronous Apex. Which Debug Log setting is required to see the output of the @future method?

A.Apex Code trace flag set to DEBUG.
B.System log at INFO level.
C.Validation rules set to ON.
D.Profiling level set to FINEST.
AnswerA

Asynchronous Apex execution, such as a `@future` method, runs in a separate transaction from the context that invoked it. Because this detached execution operates independently of the originating thread, generating log output requires a specifically configured trace flag rather than relying solely on default logging levels. Setting the Apex Code trace flag to the `DEBUG` level ensures that the execution context of the asynchronous thread is fully captured, allowing developers to successfully inspect debug statements and system logs generated by the `@future` method.

Why this answer

To see the output of an @future method in debug logs, the Apex Code trace flag must be set to DEBUG or higher. The @future method runs asynchronously, and its debug output is captured under the Apex Code category, so the trace flag must be active for that category.

Exam trap

Salesforce PD1 often tests the misconception that setting the overall log level to INFO or FINEST is sufficient, when actually the Apex Code category must be set to DEBUG or higher to capture @future output.

How to eliminate wrong answers

Option B is wrong because setting the System log to INFO level does not capture Apex Code debug output; the Apex Code category must be set to DEBUG or higher. Option C is wrong because validation rules are unrelated to debug logging of Apex. Option D is wrong because profiling level set to FINEST is not a standard debug log setting; profiling is a separate feature for performance analysis.

41
MCQhard

An application uses a SOSL search to find records across multiple objects. Which return type must be used to capture the results in Apex?

A.List<List<SObject>>
B.Map<String, List<SObject>>
C.SearchResult[]
D.List<SObject>
AnswerA

SOSL returns results grouped by object, so a single flat list cannot hold them. `List<List<SObject>>` preserves that per-object grouping, with each inner list holding matches for one searched object. This satisfies the stem's requirement to capture cross-object results from one SOSL query in Apex.

Why this answer

SOSL search queries return a List of Lists of SObjects (List<List<SObject>>), because a single search can return results across multiple different sObject types.

42
Multi-Selectmedium

A developer is building a custom Lightning Web Component and wants to communicate data from a child component up to its parent component. Which THREE steps are required? (Choose three.)

Select 3 answers
A.Dispatch the event using the this.dispatchEvent() method in the child.
B.Import the wire service adapter in the parent component.
C.Use the @api decorator on a parent property inside the child component.
D.Create a new CustomEvent in the child component's JavaScript file.
E.Add an event listener directive (e.g., onmyevent) to the child component tag in the parent HTML template.
AnswersA, D, E

Custom events in Lightning Web Components are dispatched from the child component using the standard DOM `CustomEvent` API wrapped in the component's `this.dispatchEvent()` method. This fulfills the communication requirement specified in the stem—passing data upward from a child to a parent component—by bubbling the event up the DOM tree where a parent template can listen for it using an event listener directive.

Why this answer

To send data from a child LWC up to its parent, the child must first create the event object with the CustomEvent constructor, as in option D, because CustomEvent carries the payload in its detail property and defines the event name the parent will listen for. Option A is correct because the child must actually fire that event by calling this.dispatchEvent(event), which is the only way an LWC event is propagated to the parent's DOM listener. Option E is correct because the parent must register a listener on the child's tag in its HTML template using the on<eventname> directive (for example onmyevent), which binds the handler that receives the event and its detail data.

Option B is incorrect because wire service adapters are used for reading Salesforce data, not for child-to-parent event communication, and no wire adapter is needed here. Option C is incorrect because @api exposes a public property for the parent to pass data down into the child, which is the opposite direction of the required child-to-parent flow.

43
MCQhard

An Apex trigger needs to prevent records from being saved if a specific validation condition fails. How should the developer reject the DML operation on a specific record?

A.record.addError('Validation failed.');
B.Trigger.rollback();
C.ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error'));
D.throw new ValidationException('Error');
AnswerA

addError() on an SObject instance marks that specific record as failed and blocks its DML while allowing other records in the transaction to save. This satisfies the requirement to reject only the offending record rather than throwing an exception that rolls back the entire operation.

Why this answer

Adding an error message to a record sObject in Trigger.new (e.g., record.addError('Message')) prevents that record from saving and adds an error to the UI/transaction.

44
MCQmedium

A developer needs to execute a batch job every Sunday at midnight. Which interface must the scheduling class implement?

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

Implementing the `Schedulable` interface is required because it exposes the `execute(SchedulableContext)` method, which enables Apex code to run asynchronously according to a specified Cron expression. This directly satisfies the scheduling constraint in the stem to execute the batch job automatically at midnight every Sunday. Developers invoke the batch class from within this scheduled context using `Database.executeBatch()`, combining both interfaces to handle the recurring temporal requirement efficiently within Salesforce governor limits.

Why this answer

Scheduled Apex requires implementing the Schedulable interface.

45
Multi-Selecthard

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

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

Setting up a message channel is a foundational requirement to satisfy the constraint of establishing communication between an Aura component and a Lightning Web Component via the Lightning Message Service. This requires developers to create an XML file with the `.messageChannel-meta.xml` extension placed inside the specific `force-app/main/default/messageChannels/` directory of the Salesforce DX project. This metadata file formally defines the message channel name and its payload fields, making it available for subscription and publication across the different component frameworks.

Why this answer

Option A is correct because LMS requires a message channel to be defined as metadata in XML format inside the /messageChannels/ directory of a Salesforce DX project, which creates the ChannelName__c LightningMessageChannel used by all subscribers and publishers. Option B is correct because the LWC must import the channel reference with the exact scoped module syntax '@salesforce/messageChannel/ChannelName__c' so that publish() and subscribe() can target that specific channel. Option D is correct because the actual messaging is performed by calling publish() and subscribe() (and optionally unsubscribe()) from the 'lightning/messageService' module, which is how the Aura component and LWC exchange messages over the channel.

Option C is not needed because LMS is a client-side, browser-based messaging service and does not involve Apex triggers or server-side listeners. Option E is not required because <target>lightning__MessageChannel</target> is not a valid component target for consuming LMS; the channel is referenced via the import, not via the component metadata targets.

Exam trap

SALESFORCE-PD1 often tests LMS implementation steps, and candidates may mistakenly think that Apex triggers or component metadata targets are required, confusing LMS with other messaging patterns.

46
Multi-Selecteasy

Which TWO methods are used to inspect sObject field metadata dynamically in Apex? Choose 2 options.

Select 2 answers
A.Schema.getGlobalDescribe()
B.System.describeFields()
C.Object.inspect()
D.Database.getMetadata()
E.SObjectType.getDescribe()
AnswersA, E

`Schema.getGlobalDescribe()` successfully satisfies the requirement to inspect sObject field metadata dynamically by returning a map of all sObject tokens keyed by their API names across the entire organization. Developers can iterate through this dynamic map at runtime to programmatically resolve specific object types without hardcoding dependencies, which is essential for generic utility classes and managed packages that must adapt to custom customer schemas.

Why this answer

SObjectType.getDescribe() and Schema.getGlobalDescribe() are used for inspecting schema metadata.

47
MCQhard

A developer has written a Batch Apex class to process millions of records. During execution, some transactions fail due to temporary external web service timeouts. What is the standard behavior of Batch Apex when an unhandled exception occurs in a batch execution?

A.The specific batch scope fails, but the job continues processing subsequent scopes.
B.The entire job pauses indefinitely until an administrator manually resumes it via Setup.
C.The batch framework automatically retries the failed scope up to five times before moving on.
D.The entire batch job immediately aborts and rolls back all previously processed scopes.
AnswerA

Batch Apex commits each scope independently, so an unhandled exception rolls back only that chunk's work while the job proceeds to the next scope. This isolates failures from temporary web service timeouts, allowing remaining records to process without aborting the entire job.

Why this answer

By default, if an unhandled exception occurs in the execute method of a batch class, that specific batch of records fails, and the batch job continues processing the remaining batches, logging the failure.

48
MCQmedium

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

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

Aura markup references a Lightning Web Component using the c: namespace followed by the component's camelCase name, so <c:myLwcComponent /> renders it. This satisfies the stem's requirement for embedding an LWC within an Aura component's markup.

Why this answer

In Aura markup, a Lightning Web Component is referenced using the c: namespace followed by the component's camelCase name, e.g., <c:myLwcComponent />. This is the documented syntax for embedding an LWC inside an Aura component. The c: namespace maps to the default namespace for custom components in the org.

Exam trap

Salesforce-PD1 often tests whether candidates confuse Visualforce tags (apex:), Aura base components (lightning:), and the c: namespace used for custom Aura and LWC references.

How to eliminate wrong answers

Option B is wrong because <apex:includeComponent> is a Visualforce tag for including Visualforce components, not for embedding LWCs in Aura. Option C is wrong because <lightning:lwc> is not a valid Aura tag — there is no such base component for embedding LWCs. Option D is wrong because <aura:component> is the root tag that defines an Aura component itself, and it has no 'include' attribute for referencing other components.

49
Multi-Selectmedium

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

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

To satisfy the visibility and scope requirements of the `@wire` service, an Apex method must be explicitly declared as either `public` or `global` alongside the `static` keyword. This specific modifier combination ensures the Lightning Web Component's client-side JavaScript engine can successfully access and invoke the server-side controller method asynchronously without requiring an instantiated object context.

Why this answer

Option B is correct because an Apex method exposed to Lightning Web Components via @wire must be declared public or global and static, since the wire adapter invokes it without an instance context. Option D is correct because the method must be annotated with @AuraEnabled(cacheable=true); the cacheable=true setting is what allows the wire service to call the method and cache its results on the client. Options A, C, and E are incorrect because a wired Apex method does not need to return a DML result, does not need to return a PageReference, and must not be asynchronous via @future — @future methods cannot be wired and cannot be marked cacheable.

Exam trap

Salesforce-PD1 often tests the misconception that any @AuraEnabled Apex method can be wired, when in fact cacheable=true is a hard requirement that also forbids DML and callouts.

50
MCQeasy

Which governor limit is associated with the total number of SOQL queries issued in a single synchronous transaction?

A.10
B.50
C.100
D.200
AnswerC

Synchronous Apex transactions enforce a strict limit of 100 SOQL queries to prevent poorly optimised code from exhausting shared database resources. This constraint directly satisfies the governor limit associated with the total number of SOQL queries issued in a single synchronous transaction. If a developer attempts to execute a 101st query within the same transaction execution context—often caused by unbulkified queries inside loops—Salesforce immediately throws a `System.LimitException` and halts further processing.

Why this answer

The limit for synchronous SOQL queries is 100.

51
MCQhard

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

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

::slotted() targets elements assigned to a slot from the parent's light DOM, letting the child component style slotted content while respecting shadow DOM encapsulation. It satisfies the stem's constraint of passing styling into specific slots, unlike :host or ::part, which address the host element or exposed parts respectively.

Why this answer

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

52
Multi-Selectmedium

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

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

Custom events provide the standard DOM mechanism for communication moving upwards through a parent-child component hierarchy in Lightning Web Components. By dispatching a `CustomEvent` from a child component and listening for it via an inline event handler on the parent template, developers satisfy the directional constraint of passing data from child to parent. This native browser event model bubbles up the component tree, enabling decoupled upward data flows without requiring shared state or global pub-sub structures.

Why this answer

Option B is correct because in Lightning Web Components, a child component can dispatch a CustomEvent (via this.dispatchEvent(new CustomEvent(...))) that bubbles up the DOM, and a parent component can listen for it using an event handler in its template or with addEventListener, making it the standard mechanism for child-to-parent communication. Option E is correct because Lightning Message Service (LMS) provides a publish-subscribe API (lightning/messageService with publish() and subscribe()) that lets components communicate across the DOM—including between unrelated components, across different component trees, and even with Aura components—by publishing to a message channel. Option A is not valid because a component cannot directly reach into a sibling component's properties; siblings have no direct reference to each other and must communicate through a common parent or a message service.

Option C is not valid because $A.get('e.force:event') is an Aura framework API for application events, and LWC does not support Aura application events; LWC uses CustomEvent or LMS instead. Option D is not valid because LWC components run in a secure, encapsulated environment (Lightning Web Security/synthetic shadow DOM) and sharing state through global window variables is an anti-pattern that breaks encapsulation and is not a supported communication mechanism.

Exam trap

The trap is confusing Aura application events with LWC mechanisms — candidates who learned Aura pick $A.get('e.force:event'), but LWC has no application events and instead relies on CustomEvent and Lightning Message Service.

53
Multi-Selectmedium

A developer is choosing between Future methods and Queueable Apex. Which TWO characteristics are unique to Queueable Apex? (Choose TWO.)

Select 2 answers
A.Queueable Apex methods can be called synchronously from inside formula fields.
B.Queueable Apex returns an AsyncApexJob ID that can be used to monitor job progress.
C.Queueable Apex allows passing complex data types such as sObjects and custom Apex objects.
D.Queueable Apex does not support asynchronous job chaining.
E.Queueable Apex restricts external HTTP callouts entirely.
AnswersB, C

Queueable Apex satisfies the requirement for monitoring asynchronous execution by returning an `ID` of type `AsyncApexJob` when `System.enqueueJob` is invoked. This identifier can be queried directly against the `AsyncApexJob` object to track job status, total job items, and error details. Conversely, standard future methods return `void`, offering no programmatic handle for tracking their progress or completion status within the Salesforce database.

Why this answer

Queueable Apex supports complex objects and job chaining, unlike future methods.

54
MCQmedium

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

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

Displaying a toast notification within a Lightning Web Component requires importing the `ShowToastEvent` constructor directly from the `lightning/platformShowToastEvent` module. This specific module provides the imperative JavaScript API necessary to construct and dispatch the user interface notification event when a record is successfully saved, thereby satisfying the requirement to alert users natively without relying on custom HTML overlays or third-party libraries.

Why this answer

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

55
MCQhard

A developer is writing a batch Apex class. During the execute method, a record fails validation. The developer wants to ensure that successfully processed records in the same batch are committed while failing records are logged without aborting the entire batch. How should the DML be performed?

A.try-catch block around a standard insert statement
B.Database.upsert(records, true)
C.Database.insert(records, false)
D.Standard insert statement (e.g., insert records;)
AnswerC

Using `Database.insert(records, false)` enables partial processing by passing `false` as the second parameter for the allOrNone argument. This satisfies the strict constraint that successfully processed records must be committed while failing records do not abort the entire batch. Instead of rolling back the entire transaction upon encountering a validation error, the runtime flags the specific failed records in the resulting `Database.SaveResult` array, allowing successful database operations to persist.

Why this answer

Using Database.insert(records, false) performs partial DML success, allowing valid records to commit while returning an array of save results for error handling.

56
Multi-Selectmedium

Which TWO conditions must be met for an Apex test method to successfully execute and contribute to code coverage? (Choose two.)

Select 2 answers
A.The test method must accept a List of SObjects as a parameter.
B.The test class must implement the TestInterface interface.
C.The test method must return an Integer value representing success.
D.The test method must be declared as static.
E.The test method must be annotated with @isTest.
AnswersD, E

Apex test methods must be explicitly declared as static to satisfy the runtime execution requirements enforced by the Salesforce execution context. This constraint ensures that the test runner can invoke the method directly from the class definition without needing to instantiate an enclosing object. Declaring the method as static enables the platform to cleanly execute the test logic, log transactional data, and accurately record code coverage metrics against your application codebase during deployments or package validations.

Why this answer

Option D is correct because Apex test methods must be declared with the static modifier; instance methods are not recognized as test methods and will not be executed by the test framework or counted toward code coverage. Option E is correct because the method must be annotated with @isTest (or be inside a class annotated with @isTest) so the Apex runtime identifies it as a test method eligible for execution and coverage tracking. Options A, B, and C are incorrect: test methods take no parameters, there is no TestInterface to implement, and test methods must return void rather than an Integer.

Exam trap

Salesforce PD1 often tests the misconception that test methods require specific parameters or return types, or that they must implement an interface, when in fact only the @isTest annotation and static modifier are required.

57
Multi-Selecteasy

Which THREE of the following are benefits of using the Salesforce CLI for deployment?

Select 3 answers
A.Allows bypassing validation rules in production
B.Supports automated deployment scripts
C.Automatically converts all code to Lightning Web Components
D.Enables version control integration with tools like Git
E.Provides a platform-independent way to deploy code
AnswersB, D, E

The Salesforce CLI provides a scriptable command-line interface that allows developers to integrate deployment commands into continuous integration and continuous deployment (CI/CD) pipelines such as GitHub Actions or Jenkins. This capability directly satisfies the requirement for automated deployment scripts by enabling headless authentication via JWT or auth tokens and non-interactive metadata pushes and validations, eliminating manual intervention during the release process.

Why this answer

CLI offers automation, version control integration, and environment consistency.

58
MCQeasy

What is the primary benefit of using Flow Builder over Apex triggers when implementing simple field validations?

A.Flows can be managed and updated declaratively without code deployment.
B.Flows bypass all system validation rules automatically.
C.Flows do not count against governor limits.
D.Flows execute faster than compiled Apex triggers.
AnswerA

Declarative tools such as Flow Builder process simple field validations by executing within the standard Salesforce save-order-of-execution framework without requiring programmatic compilation. This satisfies the constraint of implementing straightforward validations efficiently, as administrators can configure reactive screen or record-triggered flows using point-and-click logic rather than writing, testing, and deploying Apex classes. Consequently, maintenance overhead is drastically reduced since business logic modifications do not necessitate developer intervention or complex deployment pipelines.

Why this answer

Flow Builder allows administrators and developers to build validations declaratively without writing and maintaining code.

59
Multi-Selecthard

Which TWO tools or APIs can a developer use to deploy metadata between Salesforce organizations? (Choose two.)

Select 2 answers
A.Data Loader
B.Outbound and Inbound Change Sets
C.Salesforce CLI (sf project deploy start)
D.Apex Anonymous Windows
E.Process Builder
AnswersB, C

Change sets utilise the Metadata API framework to natively transfer customisations directly between connected Salesforce organisations, such as from a sandbox to a production environment. This mechanism satisfies the stem's requirement to deploy metadata between two distinct Salesforce instances without needing external development tools or file-based packaging. Administrators configure the payload declaratively within the source organisation's user interface, upload it to the target organisation via a predefined deployment connection, and then validate or deploy the components securely within the platform ecosystem.

Why this answer

Change Sets and the Metadata API (via CLI or IDEs) are primary tools for metadata deployment.

60
MCQeasy

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

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

`<apex:outputField>` satisfies the requirement to output field values dynamically based on sObject field definitions because it automatically renders the correct formatting and type-specific attributes—such as currency symbols, date formats, or picklist values—directly from the underlying field metadata. Unlike standard output components that require explicit formatting definitions, this tag inspects the schema definition of the specified sObject field at runtime, ensuring that the displayed value respects user-level field-level security and profile permissions without additional controller logic.

Why this answer

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

61
Multi-Selecthard

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

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

The `constructor()` hook executes as the very first step in the component lifecycle, running entirely in memory prior to the component being inserted into the DOM. This satisfies the strict initialization constraint regarding DOM insertion order, ensuring that reactive properties and base state variables are properly instantiated before template evaluation and rendering occur in the browser.

Why this answer

Option A is correct because the constructor() lifecycle hook runs first, during component instantiation, before the element is attached to the DOM, making it the right place for initializing state but not for DOM access. Option C is correct because connectedCallback() fires when the component is inserted into the DOM, which is why it is used for DOM manipulation, subscribing to events, or fetching data. Option D is correct because disconnectedCallback() fires when the component is removed from the DOM, making it the appropriate hook for cleanup such as unsubscribing from events or clearing timers.

Option B is incorrect because renderedCallback() runs after every render of the component, not just once, so it can execute multiple times as reactive properties change. Option E is incorrect because renderedCallback() runs after the component is connected and rendered, so it cannot execute before connectedCallback().

Exam trap

Salesforce-PD1 often tests the misconception that renderedCallback() runs only once, but it actually runs after every render, leading candidates to incorrectly select option B.

62
MCQmedium

A developer needs to ensure that a custom logging operation runs asynchronously and can be monitored using job IDs. Which interface is best suited?

A.Schedulable
B.Database.AllowsCallouts
C.Database.Batchable
D.Queueable
AnswerD

`Queueable` is the correct interface because it executes operations asynchronously via the Apex flex queue, satisfying the requirement for asynchronous processing. Crucially, implementing this interface returns an `AsyncApexJob` ID upon submission via `System.enqueueJob()`, which directly satisfies the monitoring constraint specified in the stem. Unlike future methods, `Queueable` also permits complex types like SObjects and custom objects to be passed into the execution context.

Why this answer

Queueable Apex provides job IDs upon enqueueing, allowing for tracking and monitoring.

63
MCQeasy

Which context variable in an Apex trigger contains the old map of records for update operations?

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

`Trigger.oldMap` holds a map of the pre-processed record versions keyed by their IDs, satisfying the requirement to access historical record states specifically during `before update` and `after update` database events. This contextual map permits developers to compare current field values against previous values to validate modifications or automate conditional logic before committing transactions to the database.

Why this answer

Trigger.oldMap provides a map of ID to the old version of records during update and delete triggers.

64
MCQmedium

A developer needs to find all records across multiple objects (Contact, Lead, and Account) that contain the exact phrase 'Acme Corp'. Which feature should be used?

A.Database.query() with dynamic bindings
B.SOQL query with multiple WHERE clauses
C.SOSL FIND clause
D.Global Search API via REST
AnswerC

Salesforce Object Search Language (SOSL) satisfies the requirement to query multiple distinct objects simultaneously using the `FIND` clause to locate the exact phrase 'Acme Corp' across the specified fields of Contact, Lead, and Account records. Unlike SOQL, which is restricted to querying a single sObject at a time (unless utilizing parent-to-child relationships), SOSL is specifically engineered for text-based, multi-object searches executed against an inverted index, making it the correct architectural choice for cross-object retrieval.

Why this answer

SOSL (Salesforce Object Search Language) is designed for text searches across multiple objects simultaneously.

65
MCQeasy

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

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

To correctly reference a custom label within a Lightning Web Component JavaScript file, developers must utilise the scoped module import syntax provided by the Salesforce platform. The specifier string `@salesforce/label/LabelName` tells the Lightning Web Component compiler to resolve the reference against the organisation's metadata, securely importing the specified label as an ES6 module binding. This specific module path pattern satisfies the strict compiler constraint for accessing custom labels on the client side without exposing unauthorised backend resources.

Why this answer

In Lightning Web Components (LWC), custom labels are imported using the standard ES6 import syntax from the special '@salesforce/label' module. The correct syntax is `import labelName from '@salesforce/label/LabelName';`, where `LabelName` is the API name of the custom label. This import makes the label's value available as a JavaScript variable that can be used in the component's template or logic.

This approach is specific to LWC and differs from Aura or Visualforce.

Exam trap

Salesforce PD1 often tests the confusion between syntaxes for different Salesforce frameworks (Aura, Visualforce, LWC), so candidates may incorrectly choose Aura's `$Label.LabelName` or Visualforce's `System.Label.LabelName` instead of the LWC-specific import statement.

How to eliminate wrong answers

Option A is wrong because `Label.get('LabelName')` is not valid LWC syntax; it resembles Aura's `$A.get('$Label.c.LabelName')` but is incomplete and incorrect. Option B is wrong because `System.Label.LabelName` is Visualforce syntax, not JavaScript. Option C is wrong because `$Label.LabelName` is Aura component syntax, not LWC.

Option D is correct because it uses the proper ES6 import from the '@salesforce/label' scoped module.

66
Multi-Selecthard

Which THREE best practices should a developer follow when implementing CRUD and FLS checks in Apex? Choose 3 answers.

Select 3 answers
A.Rely solely on 'with sharing' keywords to handle field-level security checks.
B.Check sObject createability before performing insert DML operations.
C.Disable all triggers when performing security checks.
D.Check object updatability before committing updates to the database.
E.Use Schema describe methods to verify field accessibility before querying.
AnswersB, D, E

Ensuring the application respects CRUD security requires developers to programmatically verify user permissions prior to executing database actions. Specifically, checking `sObject` createability via the `Schema.sObjectType.MyObject__s.isCreateable()` method satisfies the createability validation constraint for CRUD enforcement before performing an `insert` DML operation. This proactive validation prevents runtime exceptions and maintains data governance standards by stopping unauthorised record creation attempts at the application tier.

Why this answer

Developers should check isAccessible, isCreateable, and isUpdateable using describe results before querying or saving data.

67
MCQhard

A developer is writing code that processes untrusted data and wants to automatically strip fields and relationships that the current user cannot access, without throwing an exception. Which feature should be used?

A.Security.stripInaccessible()
B.Database.insert(records, AccessType.ENFORCE_ACCESSIBLE)
C.Approval.lock()
D.Schema.sObjectType.fields.isAccessible()
AnswerA

`Security.stripInaccessible()` satisfies the requirement to automatically remove fields and relationships that the current user lacks read, create, or update permissions for, without throwing an exception. By using the `AccessType` enum (such as `AccessType.READABLE`), the developer can pass lists of sObjects and have the runtime strip inaccessible fields in-place. This approach avoids explicit conditional permission checks and prevents the runtime exceptions that standard database operations or `ApexPages.addMessage()` patterns would otherwise trigger when encountering restricted data.

Why this answer

The Security.stripInaccessible() method strips fields and SObjects that the user lacks permission to read or create/update, avoiding runtime security exceptions.

68
MCQmedium

A developer needs to write an Apex test class for a trigger that fires on Account insert and creates a related Contact. The test must verify that the Contact is created with the correct LastName. Which assertion should be used after inserting the Account and querying for the Contact?

A.System.assert(contact.LastName == 'Test Contact');
B.System.assertEquals('Test Contact', contact.Name, 'Name should match');
C.System.assertNotEquals(null, contact.LastName, 'Last name should not be null');
D.System.assertEquals('Test Contact', contact.LastName, 'Last name should match');
AnswerD

System.assertEquals compares expected and actual values and is the standard assertion for verifying field values in Apex tests. It takes an expected value, an actual value, and an optional message. This assertion correctly checks that the Contact's LastName equals the expected string, and it provides a clear message if the test fails, making it the appropriate choice.

Why this answer

Apex tests should use System.assertEquals to compare expected and actual values, as it provides clear failure messages and directly validates the field in question. The trigger creates a Contact with a specific LastName, so the test must assert that the Contact's LastName matches the expected string. This ensures the trigger logic is working as intended and catches regressions.

Exam trap

The trap here is using System.assert instead of System.assertEquals, which lacks a descriptive message and is less precise for value comparisons.

69
MCQhard

A developer has a trigger that updates parent Account records when Child Contacts are modified. To prevent infinite recursion, the developer uses a static boolean variable in a helper class. What is a key limitation of using static variables for recursion control in Salesforce?

A.Static variables persist across multiple user transactions, causing triggers to never fire again.
B.Static variables cause governor limit exceptions on heap size.
C.Static variables reset at the end of each transaction, and do not protect against separate transactions or certain bulk test setups.
D.Static variables are prohibited in trigger helper classes.
AnswerC

Static variables persist only for the duration of a single transaction, so they reset between separate transactions and cannot prevent recursion across them. In bulk test setups, where multiple transactions or repeated DML occur, the guard fails to hold, allowing the recursion the developer intended to block.

Why this answer

Static variables persist only for the duration of a single transaction; if a secondary transaction or test context restarts, the static variable resets.

70
MCQhard

A developer writes a Queueable Apex job that queries 50,000 records, performs calculations, and updates them. During testing, the job hits a heap size limit. What is the standard asynchronous heap size limit in Apex?

A.12 MB
B.50 MB
C.36 MB
D.6 MB
AnswerA

Asynchronous Apex transactions, including Queueable jobs, operate under a generous heap size limit of 12 MB, which is double the synchronous limit of 6 MB. When a developer processes a maximum query return of 50,000 records alongside complex calculations, the memory footprint expands significantly. The 12 MB asynchronous heap limit directly accommodates this heavier data processing load, allowing the job to successfully handle bulk record updates without throwing a System.LimitException for excessive memory consumption.

Why this answer

The asynchronous transaction heap size limit is 12 MB, compared to 6 MB for synchronous transactions.

71
MCQeasy

Which Apex data type should a developer use to represent a precise geographic location with latitude and longitude coordinates?

A.Coordinate
B.Location
C.Address
D.GeoPoint
AnswerB

The built-in Apex `Location` data type directly satisfies the requirement for representing a precise geographic location with latitude and longitude coordinates. Unlike generic numeric or string variables, `Location` natively stores spatial data using compound fields, allowing developers to perform built-in distance calculations such as `EucDist` or `toMiles`. It ensures type safety and seamless integration with Salesforce geolocation fields and SOQL spatial functions like `DISTANCE()` and `GEOLOCATION()`, fulfilling the exact criteria specified in the stem.

Why this answer

The Location primitive data type in Apex is designed specifically to represent geographic locations with latitude and longitude.

72
MCQeasy

Which collection type stores elements as key-value pairs in Apex?

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

A Map collection in Apex successfully satisfies the requirement from the stem to store elements as key-value pairs by associating unique keys with corresponding values. Unlike lists or sets that store individual items sequentially or uniquely, a Map provides a direct hashing mechanism where each distinct key maps to a single value, allowing developers to efficiently retrieve, update, or remove data using the specified key reference.

Why this answer

A Map stores key-value pairs where each unique key maps to a single value.

73
MCQeasy

When should a developer choose Flow Builder over an Apex Trigger for business automation?

A.When implementing straightforward record-triggered field updates declaratively.
B.When performing complex callouts to external REST APIs.
C.When writing custom web service classes for external clients.
D.When processing millions of records nightly in batches.
AnswerA

Flow Builder provides a declarative record-triggered framework specifically designed for straightforward field updates before a record is saved. This approach satisfies the stem requirement for declarative automation by executing efficiently within the platform's native runtime environment without the overhead of writing, testing, and maintaining custom code. Choosing this visual tool for simple data manipulations reduces technical debt and aligns with best practice principles by leveraging point-and-click functionality before resorting to programmatic solutions.

Why this answer

Flow Builder is declarative and preferred for standard point-and-click record updates and screen interactions when complex custom code is unnecessary.

74
MCQmedium

Why should a developer ensure that test classes have at least 75% coverage for production deployment?

A.It makes the code run faster.
B.It prevents bugs entirely.
C.It automatically generates the test classes.
D.It is a requirement set by the Salesforce platform.
AnswerD

Salesforce enforces a strict platform-level deployment validation rule requiring a minimum of 75% overall code coverage across all Apex classes and triggers before any compiled codebase can be promoted to a production environment. This architectural constraint is hardcoded into the Metadata API and deployment engine to ensure that developers validate critical business logic through automated unit tests prior to execution in live enterprise environments, satisfying the specific deployment threshold stated in the question stem.

Why this answer

Salesforce enforces a minimum of 75% Apex code coverage for all production deployments, except for certain metadata types. This requirement ensures that a substantial portion of the code is tested before it reaches production, reducing the risk of runtime errors.

Exam trap

Salesforce PD1 often tests the misconception that 75% coverage is optional or that it guarantees bug-free code, when it is actually a mandatory platform requirement for deployment.

How to eliminate wrong answers

Option A is wrong because code coverage does not affect execution speed; it is a quality gate, not a performance optimization. Option B is wrong because while tests can catch bugs, they do not prevent all bugs; coverage is a metric, not a guarantee. Option C is wrong because test classes are written manually by developers, not generated automatically by the platform.

75
MCQmedium

A developer wants to ensure that specific test data is available to all test methods in a class without recreating it. Which method should be used?

A.Use @testSetup.
B.Use a static constructor.
C.Use a private method called by all tests.
D.Use Test.loadData().
AnswerA

The `@testSetup` annotation directly satisfies the requirement to make specific test data available across all test methods in a class without recreating it. When a method is annotated with `@testSetup`, Salesforce executes it once before any test methods in that test class run, creating a shared set of records within a single transaction. This mechanism avoids redundant data insertion operations, preventing governor limit issues related to DML statements while ensuring a consistent baseline state for every test method.

Why this answer

@testSetup methods are executed once per class and set up data for all methods.

Page 1 of 5

Page 2

All pages