Courseiva

Salesforce Certified Platform Developer I (SALESFORCE-PD1) (SALESFORCE-PD1) — Questions 76–150

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

Page 1

Page 2 of 5

Page 3
76
MCQhard

An Apex trigger executes during a bulk insert of 300 records. To adhere to best practices regarding governor limits and bulkification, how should SOQL queries be written?

A.Query inside a for-loop iterating over Trigger.new
B.Query each record individually using Limits.getQueries() checks
C.Use an asynchronous future method for every individual record
D.Query once outside the loop using a collection of IDs from Trigger.new
AnswerD

Collecting IDs from Trigger.new and issuing one SOQL query before the loop keeps the query inside governor limits regardless of the 300-record batch size. This satisfies the bulkification requirement by avoiding a query per record.

Why this answer

Queries must be written using bulkified collections, querying once outside of loops using bind variables for all records in Trigger.new.

77
MCQeasy

An asynchronous method needs to be invoked from a standard trigger to perform callouts to an external web service. Which annotation is required for this asynchronous method?

A.@TestSetup
B.@future(callout=true)
C.@InvocableMethod
D.@ReadOnly
AnswerB

Standard Salesforce triggers execute synchronously within a database transaction, which inherently prohibits direct outbound web service callouts to prevent blocking execution threads. Applying the `@future(callout=true)` annotation delegates the method execution to a separate thread that runs asynchronously once resources become available. This specific parameter explicitly lifts the platform restriction against making HTTP requests from asynchronous contexts, thereby satisfying the requirement to invoke callouts safely from a trigger.

Why this answer

Future methods annotated with @future(callout=true) are used to perform asynchronous callouts from triggers.

78
MCQhard

A developer has written a Lightning Web Component and Apex controller, and wants to deploy only these specific metadata components to a production org using Salesforce CLI without relying on change sets. Which command is appropriate?

A.sf apex run
B.sf project deploy start
C.sf org open
D.sf project convert mdapi
AnswerB

The `sf project deploy start` command directly satisfies the requirement to deploy specific metadata components to a production organisation without change sets by leveraging Salesforce CLI's source-tracked project architecture. It allows developers to target production environments precisely by specifying individual source files or manifest files, bypassing the manual packaging limitations of change sets while maintaining direct command-line control over the release process.

Why this answer

sf project deploy start deploys source files from a local project directory to a target org.

79
MCQmedium

When should a developer choose Flow Builder over Apex for implementing business automation logic?

A.When implementing custom encryption algorithms.
B.When standard screen interactions, record modifications, and maintenance by administrators are prioritized.
C.When complex web service callouts with complex XML namespaces need to be parsed.
D.When processing millions of records asynchronously in background batches.
AnswerB

Flow Builder provides declarative screen components and out-of-the-box DML execution mechanics that streamline record modifications without writing programmatic triggers. This directly satisfies the stem's requirement for standard screen interactions and simplified maintenance by administrators. Unlike Apex, which requires developer deployment cycles for code updates, flows expose a graphical interface that empowers non-technical staff to adjust business logic safely, fulfilling the prioritisation of low-code upkeep while maintaining robust transaction handling.

Why this answer

Flow Builder is recommended for standard record transformations, screen prompts, and declarative logic because it is faster to build and maintain.

80
MCQmedium

A developer has a requirement to pass a complex SObject list containing parent and child records into an asynchronous method for further processing. Which asynchronous feature supports passing non-primitive data types such as Lists of SObjects?

A.Email Services
B.Schedulable Apex
C.Queueable Apex
D.Future Methods
AnswerC

Queueable Apex accepts non-primitive types, including List<SObject> and custom Apex types, because its constructor takes arbitrary parameters. This satisfies the requirement to pass complex parent-child SObject collections, which Future methods cannot accept since they allow only primitive arguments.

Why this answer

Queueable Apex supports the execution of jobs asynchronously and allows passing non-primitive data types such as lists of SObjects through class member variables.

81
Multi-Selectmedium

Which TWO triggers are executed during a record merge operation in Salesforce? (Choose two.)

Select 2 answers
A.Before Insert and After Insert triggers on the losing record.
B.Undelete triggers on both records.
C.Lead conversion triggers instead of merge triggers.
D.Before Delete and After Delete triggers on the losing record.
E.Before Update and After Update triggers on the winning record.
AnswersD, E

When a record merge operation occurs in Salesforce, the platform deletes the duplicate losing records while reparenting related items to the winning record. To satisfy the requirement for triggers executed during this process, the system invokes both Before Delete and After Delete trigger contexts on the losing records. This ensures that custom business logic, data validation, and related clean-up tasks can execute before and after the losing records are permanently removed from the database.

Why this answer

Merging records deletes the loser record (firing delete triggers) and updates the winner record (firing update triggers).

82
MCQhard

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

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

Lightning Web Components communicate up the hierarchy by having the child component dispatch a standard JavaScript `CustomEvent`. This satisfies the requirement to pass data from a child to a parent up the component containment tree. The parent component then listens for this dispatched custom event directly within its declarative HTML template using an event listener directive, such as `onmyevent`, allowing it to capture the payload via the event's `detail` property and handle the data flow securely.

Why this answer

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

83
MCQmedium

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

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

Using `loadStyle` from `lightning/platformResourceLoader` resolves the static resource URL and injects the stylesheet into the component's DOM at runtime, satisfying the requirement to load third-party CSS stored as a static resource. It is the platform-provided API designed precisely for this, handling resource resolution without manual URL construction.

Why this answer

The platformResourceLoader module provides the loadStyle function, which loads a CSS file from a static resource into a Lightning Web Component. This is the standard way to include third-party stylesheets stored as static resources.

Exam trap

Salesforce PD1 often tests the correct module for loading static resources; candidates may confuse loadStyle with loadScript or incorrectly think they can use a <link> tag in LWC templates.

How to eliminate wrong answers

Option B is wrong because there is no <stylesheets> metadata configuration for LWC; styles are typically loaded via loadStyle or imported in the component's CSS file. Option C is wrong because importing a stylesheet from @salesforce/resourceUrl is not valid for CSS; that is used for referencing static resources like images or JavaScript. Option D is wrong because using a <link> tag directly in the HTML template is not supported in LWC; the framework sanitizes and restricts such tags.

84
MCQeasy

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

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

BEM provides the naming convention that satisfies the SLDS requirement for modular, scalable styling architecture. By structuring classes into blocks, elements, and modifiers, this methodology prevents CSS specificity conflicts and ensures that components remain encapsulated within the Salesforce ecosystem. This hierarchical approach allows developers to maintain a consistent visual language across complex applications, as it enforces a strict relationship between the structural components and their individual states, effectively decoupling the styling logic from the underlying DOM structure.

Why this answer

Salesforce Lightning Design System (SLDS) is built on the BEM (Block Element Modifier) CSS naming methodology, which structures class names as block__element--modifier to create predictable, reusable, and scoped styles. SLDS class names such as slds-button, slds-button__icon, and slds-button_brand directly reflect BEM conventions. This methodology underpins SLDS's modularity and maintainability across components.

Exam trap

SALESFORCE-PD1 often tests whether candidates recognize SLDS's BEM foundation versus other popular CSS methodologies like Bootstrap, OOCSS, or Tailwind, so familiarity with SLDS class naming is essential.

How to eliminate wrong answers

Option A is wrong because Bootstrap's grid standards are a separate framework's layout system; SLDS has its own grid (slds-grid) and is not built on Bootstrap. Option C is wrong because OOCSS alone (without modifiers) is insufficient — SLDS explicitly uses modifiers (the 'M' in BEM) to express variants like brand, inverse, or destructive. Option D is wrong because Tailwind's utility-first prefixes are a different methodology entirely; SLDS uses semantic component classes, not atomic utility classes.

85
MCQmedium

A developer is writing a SOQL query to find accounts where the billing country starts with 'United'. Which operator should be used?

A.LIKE 'United%'
B.MATCHES
C.STARTS_WITH
D.INCLUDES
AnswerA

The `LIKE` operator combined with the wildcard character `%` satisfies the stem's requirement to locate accounts where the billing country field begins with a specific string. In Salesforce Object Query Language, the wildcard `%` represents zero or more characters, allowing the query engine to match any billing country value starting with the exact sequence 'United' followed by subsequent characters, such as 'United Kingdom' or 'United States'.

Why this answer

The LIKE operator is used in SOQL for wildcard matching, using '%' as the wildcard character.

86
MCQhard

When using the Metadata API to deploy components, which XML file must be present to define the components included in the package?

A.manifest.xml
B.deploy.xml
C.package.xml
D.components.xml
AnswerC

The `package.xml` file functions as the manifest that satisfies the Metadata API requirement to explicitly define the components included in a deployment. By listing specific metadata types and their members, this XML file provides the necessary instructions for the API to identify which assets to retrieve or deploy within the Salesforce environment. Without this manifest, the system lacks the structural definition required to process the package, making it the essential mechanism for managing component-based deployments across different orgs.

Why this answer

The package.xml file is the manifest that the Metadata API uses to declare which components are included in a deploy or retrieve operation. It lists metadata types and their members, and it must be present in the deployment package. Without it, the Metadata API has no declaration of what to deploy.

Exam trap

Salesforce PD1 often tests the confusion between package.xml and other XML artifacts like destructiveChanges.xml or the generic term 'manifest,' leading candidates to select a plausible-sounding but nonexistent filename.

How to eliminate wrong answers

Option A is wrong because manifest.xml is not a recognized Metadata API file — the manifest is specifically named package.xml, and 'manifest' is only a generic description of its role. Option B is wrong because deploy.xml is not a standard Metadata API file; deployment is invoked via the deploy() call with a zip containing package.xml and the component files. Option D is wrong because components.xml is not a Metadata API artifact — component definitions live in individual metadata files (e.g., MyClass.cls, MyObject.object) referenced by package.xml.

87
MCQmedium

An Apex trigger needs to prevent deletion of Account records that have related active Contacts. When should this check occur?

A.After Insert
B.After Update
C.Before Insert
D.Before Delete
AnswerD

Before Delete triggers fire prior to the record's removal, allowing the Apex code to query related active Contacts and call addError to block the deletion. A before trigger can prevent DML, whereas after triggers cannot stop the operation once it has committed.

Why this answer

Before delete triggers are used to validate and prevent the deletion of records based on related criteria.

88
MCQmedium

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

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

`CustomEvent` is the correct constructor to use when building a Lightning Web Component because it satisfies the requirement to dispatch a custom event with associated data. Unlike the standard `Event` constructor, which only allows a name and basic bubbling configuration, `CustomEvent` includes a `detail` property within its options object. This enables the developer to pass custom payloads up the component hierarchy to parent elements, fulfilling the exact data-transfer constraint specified in the stem.

Why this answer

In Lightning Web Components, custom events are created using the CustomEvent constructor. The syntax is `new CustomEvent('eventName', { detail: {...} })`. This is the standard DOM API for creating custom events, and LWC uses it to dispatch events from child to parent components.

Exam trap

The trap is confusing the CustomEvent constructor with other event-related APIs, especially for developers with Aura background who might look for an Aura-specific event constructor.

How to eliminate wrong answers

Option A is wrong because Event is the base constructor for all events, but it does not allow passing a detail payload; CustomEvent is the correct one for custom events with data. Option B is wrong because AuraEvent is not a valid constructor; Aura components use $A.get('e.c:MyEvent') or similar, but LWC uses CustomEvent. Option D is wrong because LightningEvent is not a valid constructor; it is a misnomer.

89
MCQeasy

Which SOQL aggregate function should a developer use to count the exact number of rows returned by a query without retrieving the records into memory?

A.COUNT()
B.TOTAL()
C.SUM()
D.SIZE()
AnswerA

The `COUNT()` aggregate function evaluates the exact number of records matching the query criteria directly within the database layer, satisfying the constraint of not retrieving the records into memory. Unlike standard queries that instantiate record objects within the heap, this function returns a single integer value representing the total row count. This mechanism significantly reduces heap size consumption and prevents governor limit exceptions when developers need to verify record volumes efficiently.

Why this answer

The COUNT() function returns the number of rows matching the query criteria efficiently as an integer.

90
MCQeasy

A developer needs to execute lightweight asynchronous logic that is chainable and allows passing complex objects to the background job. Which asynchronous feature should the developer implement?

A.Schedulable Apex
B.Queueable Apex
C.Future methods
D.Batch Apex
AnswerB

Queueable Apex is the correct choice because it directly satisfies the requirement for chainable asynchronous logic that can accept complex state. Unlike standard future methods, which only permit primitive data types or collections of primitives, a Queueable class implements the `Queueable` interface and allows member variables to store complex types such as custom sObject records. Furthermore, implementing the `Database.AllowsCallouts` interface and using `System.enqueueJob` within the `execute` method enables seamless chaining of subsequent background jobs in a sequential order.

Why this answer

Queueable Apex supports complex member variables including sObjects and custom Apex types, and it can be chained. Future methods only support primitive types and collections of primitive types.

91
MCQeasy

Where should a developer look in the Salesforce user interface to inspect detailed system debug logs generated during a specific transaction?

A.Setup > Custom Code > Debug Logs
B.Setup > Monitor > Logs
C.Setup > Environments > Logs
D.Setup > Process Automation > Debug Logs
AnswerA

Setup > Custom Code > Debug Logs provides the Debug Logs page, where a developer filters by user and time window to open the captured log for a specific transaction. This satisfies the stem's requirement to inspect detailed system debug logs generated during a specific transaction through the Salesforce user interface.

Why this answer

Debug logs are accessed via Setup by navigating to Custom Code > Debug Logs or via the Developer Console.

92
Multi-Selecteasy

Which TWO methods are available on the Database class for performing DML operations with partial success capability? Choose 2 options.

Select 2 answers
A.Database.save()
B.Database.commit()
C.Database.persist()
D.Database.update()
E.Database.insert()
AnswersD, E

`Database.update()` directly satisfies the requirement for partial success capability by accepting an optional `allOrNone` boolean parameter, which defaults to true. When explicitly set to false, this method processes records independently, allowing valid updates to commit to the database even if other records fail validation or trigger runtime exceptions. This contrasts with standard DML statements like `update`, which enforce an all-or-nothing execution model that rolls back the entire transaction upon encountering a single error.

Why this answer

Database.insert() and Database.update() accept an allOrNone boolean parameter allowing partial success.

93
MCQmedium

A developer needs to dynamically instantiate an sObject type based on a string variable representing the object name (e.g., 'Account'). Which method should be used?

A.Schema.getGlobalDescribe().get('Account').newSObject()
B.Type.forName('Account').newInstance()
C.Database.load('Account')
D.SObject.createInstance('Account')
AnswerA

getGlobalDescribe() returns a map of all sObject types keyed by API name, and newSObject() on the resulting token instantiates the concrete type from the string. This satisfies the stem's requirement for dynamic instantiation without hard-coded class references.

Why this answer

Schema.getGlobalDescribe().get('Account').newSObject() allows dynamic sObject creation from a string object name.

94
MCQhard

What is the maximum number of batch Apex jobs that can be queued or active concurrently in the Apex flex queue?

A.50
B.100
C.5
D.500
AnswerB

The Salesforce asynchronous processing architecture strictly enforces a maximum limit of 100 batch Apex jobs that can reside within the Apex flex queue simultaneously in a queued or active state. When this threshold is reached, any subsequent batch job submissions are rejected until the active execution capacity frees up. This specific operational ceiling directly satisfies the constraint outlined in the question stem regarding concurrent queue capacity.

Why this answer

The Apex flex queue holds up to 100 batch jobs waiting to be processed.

95
MCQmedium

A developer needs to ensure that an Apex class respects organization-wide defaults, role hierarchies, and sharing rules when querying custom objects. Which keyword should be added to the class definition?

A.enforce sharing
B.with sharing
C.without sharing
D.inherited sharing
AnswerB

Adding `with sharing` to the Apex class definition enforces record-level security by ensuring that Salesforce applies organization-wide defaults, role hierarchies, and sharing rules during SOQL queries on custom objects. By default, Apex runs in system mode and ignores user-based sharing settings, which would bypass these constraints. Declaring the class `with sharing` forces the execution context to respect the requesting user's specific record permissions, directly satisfying the requirement to restrict data visibility according to the defined sharing model.

Why this answer

The with sharing keyword enforces sharing rules of the current user, while without sharing runs in system mode.

96
MCQhard

When calling Test.startTest() and Test.stopTest(), what happens to the governor limits?

A.Governor limits are reset to zero for the code between the two calls.
B.Governor limits are increased by a factor of 10.
C.Test.stopTest() forces an immediate deployment.
D.Governor limits are ignored entirely.
AnswerA

The Apex testing framework isolates asynchronous and synchronous execution contexts by resetting governor limits when `Test.stopTest()` executes subsequent to `Test.startTest()`. This mechanism directly satisfies the requirement to test heavy transaction volumes by refreshing the resource boundaries for the enclosed code block. Consequently, statements, query rows, and CPU time limits are cleared, allowing developers to accurately benchmark complex transactional logic without interference from setup operations performed prior to `Test.startTest()`.

Why this answer

Test.startTest() and Test.stopTest() create a fresh governor limit boundary for the code executed between them. Any limits consumed before startTest() are not counted against the code inside the block, and the block gets its own set of limits (e.g., 100 SOQL queries, 150 DML statements). This allows developers to test code that would otherwise exceed limits when combined with test setup data creation.

Exam trap

Salesforce PD1 often tests the misconception that Test.startTest() 'increases' or 'doubles' governor limits, when in fact it resets the counters to a fresh allocation for the enclosed block.

How to eliminate wrong answers

Option B is wrong because governor limits are not multiplied by any factor during tests — they are reset to a fresh allocation, not increased. Option C is wrong because Test.stopTest() does not deploy anything; it simply marks the end of the test limit boundary and triggers asynchronous Apex execution to complete synchronously. Option D is wrong because governor limits absolutely still apply during tests — they are enforced, just reset at the startTest() boundary.

97
Multi-Selectmedium

Which TWO features are characteristics of SOSL (Salesforce Object Search Language) queries? Choose 2 answers.

Select 2 answers
A.SOSL returns a single flat List of SObjects.
B.SOSL queries can update existing records directly.
C.SOSL queries are limited to a maximum of 10 records per search.
D.SOSL can search across multiple sObjects and fields in a single query.
E.SOSL tokenizes search terms to perform optimized text matching.
AnswersD, E

Salesforce Object Search Language (SOSL) is specifically designed to perform text-based searches across multiple standard and custom objects simultaneously through a single programmatic request. This capability directly satisfies the stem constraint requiring a query mechanism that can search across multiple sObjects and fields concurrently. Unlike SOQL, which retrieves records from a single object at a time using relational filters, a single SOSL `FIND` query tokenises search terms and indexes text fields across diverse, unrelated objects like Accounts, Contacts, and Leads within one execution.

Why this answer

SOSL searches text across multiple objects and fields simultaneously and can tokenize words for matching.

98
MCQmedium

Which approach is recommended to ensure test data is cleaned up?

A.Use the Test.stopTest() method.
B.The platform automatically rolls back data created in tests.
C.Delete the records manually in the finally block.
D.Use a @testSetup method for cleanup.
AnswerB

Apex test methods execute within a transactional context that automatically rolls back any database modifications—including inserts, updates, and deletes—once the execution completes. This built-in governor mechanism directly satisfies the requirement to ensure test data is cleaned up without needing explicit teardown logic, such as `delete` statements or custom data-deletion routines. Consequently, test data isolation is maintained across test runs, preventing side effects from persisting in the organisation's database and ensuring reliable, repeatable unit testing.

Why this answer

Salesforce automatically rolls back all data created during a test method (and during @testSetup) when the test completes, so no manual cleanup is required. This transactional isolation ensures tests do not pollute the org's data and do not need finally blocks or delete statements.

Exam trap

SALESFORCE-PD1 often tests test-data lifecycle, and candidates over-engineer cleanup with finally blocks or delete statements, missing that the platform rolls back test data automatically.

How to eliminate wrong answers

Option A is wrong because Test.stopTest() only forces asynchronous work to complete and does not perform data cleanup. Option C is wrong because manually deleting records in a finally block is unnecessary and can even cause issues if the transaction is already rolling back. Option D is wrong because @testSetup is for creating shared test data, not for cleanup; its data is also rolled back automatically.

99
MCQmedium

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

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

The `lightning/navigation` module provides the `NavigationMixin` class, which is the standard mechanism for triggering programmatic navigation within Lightning Web Components. By extending a component with this mixin, a developer gains access to the `[NavigationMixin.Navigate]` method, enabling the redirection to a specific record detail page using a `standard__recordPage` page reference type. This approach satisfies the requirement to transition between views within the Salesforce environment, ensuring the application remains compliant with the platform's internal routing architecture rather than relying on external authentication services like Microsoft Entra ID.

Why this answer

The lightning/navigation service provides the NavigationMixin, which allows Lightning Web Components to navigate to record detail pages, list views, and other pages using standard navigation. It is the recommended way to navigate within Salesforce.

Exam trap

Salesforce PD1 often tests the confusion between navigation and other services like uiRecordApi; candidates may incorrectly choose window.location.href for simplicity, but that breaks the SPA model.

How to eliminate wrong answers

Option A is wrong because lightning/pageReference is not a service; it is a type used with navigation to generate a page reference. Option B is wrong because using window.location.href bypasses the Lightning navigation framework and can cause full page reloads, losing the SPA experience. Option C is wrong because lightning/uiRecordApi is used for record operations like create, update, and delete, not for navigation.

100
MCQeasy

Which Apex data type is best suited for storing monetary amounts with high precision?

A.Decimal
B.Double
C.String
D.Integer
AnswerA

Monetary amounts and calculations requiring strict precision must use the Decimal primitive data type to prevent the rounding errors inherent in binary floating-point representations. Unlike Double, which uses base-two approximation and introduces inaccuracies during arithmetic operations, Decimal operates using arbitrary-precision base-ten arithmetic. This exact decimal representation satisfies the high precision constraint specified in the stem, ensuring financial transactions and currency values calculate accurately without accumulating cumulative rounding discrepancies.

Why this answer

The Decimal data type is used for currency and precise numerical calculations in Apex.

101
MCQmedium

You need to inspect the heap size during the execution of a long-running batch job. Which debug log category should you monitor?

A.Apex Code
B.Validation
C.Profiling
D.Workflow
AnswerC

Monitoring the heap size during a long-running batch job requires tracking resource consumption limits and execution metrics, which falls directly under the Profiling log category. By setting the Profiling category to finer levels such as DEBUG or INFO, developers can capture precise data regarding governor limits, including cumulative heap usage, CPU time, and database queries over time. This targeted logging level satisfies the requirement to inspect memory usage across extensive batch transactions without overwhelming the log with extraneous database or workflow events.

Why this answer

The Profiling log category in Salesforce captures Apex execution details including heap size, CPU time, and SOQL/DML limits, making it the correct category to monitor heap consumption during a long-running batch job. Apex Code logs capture execution flow and debug statements but do not surface heap metrics directly. Validation and Workflow categories are unrelated to Apex runtime resource usage.

Exam trap

Salesforce PD1 often tests the confusion between Apex Code and Apex Profiling log categories, leading candidates to select Apex Code when the question specifically asks about heap size or governor limit metrics.

How to eliminate wrong answers

Option A is wrong because the Apex Code category logs debug statements, method entry/exit, and variable values — it does not report heap size or governor limit consumption. Option B is wrong because the Validation category logs validation rule execution, which has nothing to do with Apex heap usage. Option D is wrong because the Workflow category logs workflow rule and approval process execution, not Apex runtime profiling data.

102
MCQeasy

What is the correct file extension for an Apex class created in Salesforce DX?

A..apex
B..controller
C..cls
D..trigger
AnswerC

Apex classes in Salesforce DX require the `.cls` extension because the Salesforce CLI and underlying metadata API strictly enforce this suffix to identify and parse server-side controller logic during source synchronisation and deployment. This specific file extension directly satisfies the format constraint specified in the stem for source-tracked enterprise development artifacts.

Why this answer

Apex class files use the .cls extension, accompanied by a .cls-meta.xml metadata file.

103
MCQmedium

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

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

`lwc:if` is the correct directive to conditionally render an HTML element in a Lightning Web Component template based on the boolean property `isVisible`. This directive directly satisfies the requirement for conditional rendering in modern Salesforce development, evaluating the truthiness of the specified JavaScript property to determine whether the host element and its children are inserted into or removed from the DOM.

Why this answer

lwc:if is the modern conditional directive in LWC.

104
MCQhard

A developer is writing a test for a method that performs a callout. How must the callout be handled?

A.Use the @future annotation.
B.Use Test.startTest().
C.The test will automatically fail.
D.Implement the HttpCalloutMock interface.
AnswerD

Salesforce unit tests are strictly prohibited from making actual outbound HTTP requests to external web services. To satisfy this platform runtime constraint during callouts, developers must implement the `HttpCalloutMock` interface. This allows the test class to provide a mock response by defining the `respond` method, which intercepts the `Http.send()` execution and returns a pre-configured `HttpResponse` object. Consequently, the test method executes successfully in a controlled, isolated environment without relying on external network connectivity.

Why this answer

Apex tests cannot make real HTTP callouts, so the developer must implement the HttpCalloutMock interface and register it with Test.setMock() before the callout is invoked. This allows the test to return a fabricated HttpResponse, making the callout deterministic and avoiding the 'callout not allowed' runtime error.

Exam trap

The trap is thinking @future or Test.startTest() somehow enables callouts in tests — they do not; only HttpCalloutMock (or WebServiceMock for SOAP) allows callouts to be simulated.

How to eliminate wrong answers

Option A is wrong because @future only makes a method asynchronous — it does not enable callouts in tests and actually complicates testing since future methods run at Test.stopTest(). Option B is wrong because Test.startTest() only resets governor limits; it has no effect on callout permissions in tests. Option C is wrong because tests do not automatically fail on callouts — they fail only if the callout is attempted without a mock, and the developer can prevent that failure with HttpCalloutMock.

105
MCQeasy

A developer wants to retrieve up to 5 recently viewed records of any object type using SOSL. Which SOSL clause specifies the maximum number of records to return?

A.TOP 5
B.MAX 5
C.LIMIT 5
D.ROWS 5
AnswerC

The `LIMIT` clause directly satisfies the stem constraint requiring the retrieval of up to 5 records by capping the total number of search result rows returned by the SOSL query. While SOQL handles record limits natively, appending `LIMIT 5` to a SOSL query ensures that the Salesforce search engine restricts the output size across the specified objects, optimising data transfer and processing when developers only require a subset of recently viewed items.

Why this answer

SOSL search results can be limited using the LIMIT clause at the end of the query statement.

106
MCQhard

During the execution of a trigger, an unhandled exception occurs in an after update trigger. What happens to the database transaction?

A.Only the records that caused the exception are rolled back; successful records are committed.
B.The transaction pauses until the exception is manually resolved by an admin.
C.The records are saved, and an email is sent to the system administrator without rolling back.
D.The entire transaction is rolled back, and no changes are saved to the database.
AnswerD

Database transactions in the Salesforce multitenant architecture are strictly all-or-nothing, which satisfies the unhandled exception constraint specified in the stem during an after update trigger execution. When an unhandled exception halts execution, the Force.com platform intercepts the failure and immediately invalidates the entire database transaction. Consequently, any DML operations executed prior to the trigger failure—whether from prior triggers, workflows, or the initial update event—are completely rolled back, ensuring data integrity across the organisation and leaving the database uncommitted.

Why this answer

An unhandled exception in any trigger causes the entire database transaction to roll back entirely.

107
MCQmedium

A developer writes a SOQL query to aggregate total opportunity amounts grouped by stage name. Which SOQL clause is required?

A.HAVING BY
B.GROUP BY
C.AGGREGATE BY
D.ORDER BY
AnswerB

Aggregating data across specific categories requires the `GROUP BY` clause to collapse multiple records into distinct groupings based on the specified field. In this scenario, the requirement to group opportunity amounts by their stage name directly satisfies the condition for using `GROUP BY`, as aggregate functions like `SUM()` cannot evaluate categorical fields without a designated grouping mechanism to define the summary boundaries.

Why this answer

Aggregate queries in SOQL require the GROUP BY clause when using functions like SUM(), COUNT(), or AVG().

108
Multi-Selectmedium

Which TWO data types can be used as keys in an Apex Map? Choose 2 answers.

Select 2 answers
A.Blob
B.Id
C.List<String>
D.SObject
E.String
AnswersB, E

Salesforce Record IDs satisfy the requirement that map keys must have a distinct hash code and support deterministic equality comparisons. Because the `Id` data type primitive is immutable, uniquely generated per record, and implements the necessary hashing algorithms natively within the Apex runtime, it functions reliably as a collection key. This ensures that lookups and insertions operate in constant time complexity without risking hash collisions or state mutations that would otherwise invalidate the map's internal index structure.

Why this answer

Primitive data types like String, ID, and Integer can be used as map keys in Apex.

109
MCQeasy

When deploying metadata from a sandbox to production using Change Sets, what is the first requirement?

A.Install Salesforce CLI
B.Configure a Deployment Connection
C.Enable Metadata API in production
D.Create an Unmanaged Package
AnswerB

Establishing a deployment connection between the source sandbox and the production environment is the mandatory prerequisite for using Change Sets. This configuration creates the necessary trust relationship, allowing the platform to authorise the transfer of metadata components across the specific org boundary. Without this defined link, the system cannot validate the target, rendering the deployment tool inaccessible. This requirement satisfies the constraint of enabling secure, authenticated communication between distinct Salesforce instances, which is essential before any metadata can be migrated.

Why this answer

Before any Change Set can be deployed from a sandbox to production (or between sandboxes), a Deployment Connection must be established between the source and target orgs. This connection authorizes the sandbox to deploy metadata to the target and is configured in Setup under Deploy > Deployment Settings. Without it, the Change Set cannot be uploaded to the target org.

Exam trap

The trap is assuming Change Sets work out of the box—candidates forget that a Deployment Connection must be explicitly configured on the target org before any Change Set can be uploaded.

How to eliminate wrong answers

Option A is wrong because Salesforce CLI is an alternative deployment tool (using Metadata API or source format) and is not required for Change Set deployments, which are entirely UI-driven. Option C is wrong because Metadata API is enabled by default in all orgs; there is no separate toggle to 'enable' it for Change Sets. Option D is wrong because Unmanaged Packages are a different distribution mechanism for sharing metadata across orgs, not a prerequisite for Change Set deployment.

110
Multi-Selectmedium

A developer is writing an Apex trigger and needs to optimize performance and prevent governor limit violations. Which TWO practices should the developer follow? (Choose two.)

Select 2 answers
A.Place DML statements inside 'for' loops to ensure immediate database commits.
B.Use the 'webservice' keyword on helper methods called by triggers.
C.Execute a separate SOQL query for every single record in Trigger.new.
D.Use trigger context variables like Trigger.new to process records in bulk.
E.Perform SOQL queries and DML operations outside of loops.
AnswersD, E

Using trigger context variables such as `Trigger.new` enables bulkified processing, which directly satisfies the requirement to prevent governor limit violations and optimise performance. Apex triggers execute once per batch of up to 200 records rather than per individual record. Accessing collections of records via these context variables ensures that SOQL queries and DML operations can be performed on entire lists simultaneously. This avoids hitting strict per-transaction limits, such as the maximum of 100 SOQL queries, regardless of whether a user updates a single record or thousands via a data load.

Why this answer

Option D is correct because Apex triggers must be bulkified: using trigger context variables such as Trigger.new lets the trigger process all records in a single invocation rather than one at a time, which conserves governor limits (e.g., the 100 SOQL queries and 150 DML statements per transaction). Option E is correct because moving SOQL queries and DML operations outside of loops ensures they execute once for the entire collection of records, avoiding the limit on queries/statements that would be exhausted by per-record execution inside a loop. Option A is wrong because placing DML inside a for loop causes one DML statement per iteration, quickly hitting the 150 DML statement governor limit and degrading performance.

Option B is wrong because the webservice keyword merely exposes a method for external web service callouts and does nothing to optimize trigger performance or prevent governor limit violations. Option C is wrong because issuing a separate SOQL query for each record in Trigger.new is the classic anti-pattern that exhausts the 100 synchronous SOQL query limit instead of bulkifying the query.

111
MCQmedium

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

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

Including `lightning__RecordPage` within the `targets` section of the component's metadata file explicitly enables the component to appear in the Lightning App Builder for record-specific pages. This configuration satisfies the requirement to make the component available for use on Lightning Record Pages by registering it within the Salesforce platform's target framework. Without this specific entry, the component remains hidden from the Lightning App Builder interface, preventing developers from dragging and dropping it onto the page layout.

Why this answer

To expose a Lightning Web Component on Lightning Record Pages, the .js-meta.xml file must include the <target> lightning__RecordPage. This target tells the Lightning framework that the component is eligible to be dragged onto record page layouts in Lightning App Builder. Other targets correspond to different surfaces such as app pages, home pages, or utility bars.

Exam trap

Salesforce PD1 often tests the confusion among lightning__ targets, leading candidates to select lightning__AppPage or lightning__UtilityBar when the question specifically asks about Lightning Record Pages.

How to eliminate wrong answers

Option A is wrong because lightning__AppPage exposes the component for Lightning App Pages, not record pages. Option B is wrong because lightning__GlobalAction exposes the component as a global quick action, not a record page component. Option D is wrong because lightning__UtilityBar exposes the component in the utility bar at the bottom of the Lightning app, not on record pages.

112
MCQhard

A developer is writing a unit test that executes under a specific user context to verify sharing rules. Which method should the developer use to specify the user for the subsequent test operations?

A.UserInfo.setUserId()
B.Database.setSavepoint()
C.Test.setCurrentUser()
D.System.runAs()
AnswerD

`System.runAs()` is the correct method because it forces test execution within a specified user context, allowing developers to enforce and verify user-specific sharing rules and record visibility. Standard unit tests run in the context of the user executing the test, ignoring record-level sharing by default unless this specific testing mechanism is employed.

Why this answer

System.runAs() enables developers to run test methods under a specific user context to verify record-level security and sharing rules.

113
MCQeasy

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

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

Visualforce pages utilise the `<apex:stylesheet>` component specifically to reference external Cascading Style Sheet files stored as Static Resources within the Salesforce organisation. This tag satisfies the exact requirement stated in the stem by rendering the appropriate HTML `<link>` tag pointing to the static resource URL via `$Resource`, allowing developers to cleanly separate presentation styling from application logic.

Why this answer

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

114
MCQeasy

A developer wants to define a constant value in an Apex class that can be accessed globally without instantiating the class. Which combination of keywords should be used?

A.protected static
B.public static final
C.private volatile
D.global transient
AnswerB

`public static final` satisfies both constraints: `static` binds the field to the class rather than an instance, so no object is needed, while `final` locks the value after assignment. `public` exposes it globally across the codebase. This combination is the standard Apex idiom for class-level constants.

Why this answer

Constants in Apex are defined using the 'static' and 'final' keywords to ensure they belong to the class and cannot be modified.

115
MCQmedium

A developer has written a Before Insert trigger on the Contact object that needs to validate user input and potentially prevent the record from saving. Which method on the Trigger context or record instance should the developer use to flag an error?

A.ApexPages.addMessage()
B.Record.addError()
C.Trigger.addError()
D.System.assert()
AnswerB

Record.addError() attaches a validation error to the record instance in a Before Insert trigger, preventing the save and surfacing the message to the user. This satisfies the requirement to flag user input errors and block the record from being committed.

Why this answer

To prevent a record from saving in a before trigger, the developer must use the addError() method on the sObject record instance.

116
MCQmedium

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

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

`lightning-formatted-number` satisfies the requirement to format a currency value according to the user's locale by accepting a `style="currency"` attribute alongside a `currency-code` attribute. When rendered in a Lightning Web Component HTML template, this base component automatically detects the current user's locale settings from the Salesforce environment and applies the correct currency symbol, decimal separators, and digit grouping without requiring manual string manipulation in JavaScript.

Why this answer

lightning-formatted-number is the correct base component because it formats numeric values, including currency, according to the user's locale. It supports a 'format-style' attribute set to 'currency' and automatically applies the correct currency symbol, decimal separator, and grouping based on the user's locale settings. This is the standard LWC component for locale-aware number formatting.

Exam trap

SALESFORCE-PD1 often tests the distinction between Aura and LWC base components, and candidates may mistakenly choose ui:outputCurrency because it sounds like a currency formatter, but it is not available in LWC.

How to eliminate wrong answers

Option A is wrong because lightning-input is used for user input fields, not for displaying formatted output. Option B is wrong because apex:outputText is an Aura component, not an LWC base component, and does not provide locale-aware currency formatting. Option C is wrong because ui:outputCurrency is a legacy Aura component from the ui namespace, not available in LWC.

117
MCQmedium

What happens if a developer creates a test method that does not contain any assertions?

A.The test is skipped by the compiler.
B.The compiler issues a warning.
C.The test passes if the code executes without errors.
D.The test fails immediately.
AnswerC

Apex unit tests do not strictly require assertion statements to execute successfully and contribute to code coverage metrics. When a test method contains no assertions, the Apex runtime engine evaluates the test's success solely on whether the underlying code executes from start to finish without triggering unhandled exceptions or runtime errors. Consequently, the test method passes simply because the execution stream completes uninterrupted, satisfying the specific scenario described in the stem where a test method lacks assertions entirely.

Why this answer

The test will pass as long as the code runs without error, but it is not a valid test.

118
MCQeasy

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

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

To surface a Lightning Web Component within the App Launcher navigation framework, developers must configure a Lightning Component Tab. This specific tab type directly satisfies the stem requirement by exposing bundle components that implement the `lightning__Tab` target interface directly to the Salesforce navigation architecture, rendering them accessible as standalone applications or navigational items without requiring wrapper Aura components.

Why this answer

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

119
MCQhard

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

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

Lightning Web Components use standard DOM encapsulation, meaning parent components cannot directly access child internals by default. To satisfy the requirement of invoking a child component's public method from a parent, the child must explicitly expose the method using the `@api` decorator. The parent then obtains a direct reference to the child DOM element using `this.template.querySelector()` and invokes the exposed method directly on that element reference, successfully bridging the shadow DOM boundary while maintaining proper encapsulation principles.

Why this answer

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

120
MCQeasy

What is the primary benefit of using a Flow over an Apex trigger for simple field updates?

A.Higher governor limits
B.Declarative configuration
C.Access to private methods
D.Better performance
AnswerB

Flows provide a completely declarative, point-and-click configuration interface that directly satisfies the "simple field updates" constraint specified in the stem. By utilizing visual elements rather than programmatic code, administrators can execute record-triggered updates without writing, testing, or maintaining Apex syntax. This approach drastically reduces technical debt, accelerates initial deployment times, and lowers the barrier to entry for ongoing maintenance compared to writing traditional programmatic triggers.

Why this answer

Flows are declarative, easier to maintain, and require no code, making them faster to deploy.

121
Multi-Selectmedium

Which TWO statements are true regarding the behavior of Apex triggers and context variables? Choose 2 answers.

Select 2 answers
A.Trigger.old is available in update and delete triggers.
B.Trigger.new is available in insert, update, and undelete triggers.
C.Trigger.old is available in insert and update triggers.
D.Trigger.new records are always read-only in before triggers.
E.Trigger.newMap is available in before insert triggers.
AnswersA, B

`Trigger.old` provides a read-only list of the previous versions of sObject records, which is essential for comparing field values before a database modification occurs. This context variable is accessible exclusively during update and delete operations because these events involve existing records that possess prior state data. Consequently, this satisfies the requirement to identify valid trigger context variables, as `Trigger.old` is unavailable during insert operations where no previous record state exists to reference.

Why this answer

Option A is correct because Trigger.old holds the previous versions of the records and is populated in update triggers (the old values before the change) and in delete triggers (the records being deleted), so it is available in both update and delete contexts. Option B is correct because Trigger.new holds the new versions of the records and is populated in insert triggers (records being created), update triggers (records with their new values), and undelete triggers (records being restored), making it available in all three contexts. Option C is wrong because Trigger.old is not available in insert triggers, since there are no prior versions of records that do not yet exist.

Option D is wrong because Trigger.new records are read-only only in after triggers; in before triggers they are writable and can be modified to change what is saved. Option E is wrong because Trigger.newMap is not available in before insert triggers, since the records have no IDs yet and the map is keyed by record ID.

122
Multi-Selecteasy

Which THREE collections are available in Apex? (Choose three.)

Select 3 answers
A.Queue
B.Set
C.Table
D.List
E.Map
AnswersB, D, E

A Set is a fundamental collection type in Apex that satisfies the requirement for storing unordered, unique elements. Unlike Lists, which permit duplicate entries and maintain a specific index-based order, a Set enforces data integrity by ensuring that no two elements share the same value. This mechanism makes it the optimal choice for scenarios where you must eliminate redundancies within a dataset, providing efficient methods to verify the existence of specific items while maintaining high performance during data processing tasks.

Why this answer

Apex provides three built-in collection types: List, Set, and Map.

123
MCQeasy

What is a key advantage of using Queueable Apex over future methods?

A.Queueable Apex allows passing sObjects and custom Apex types as member variables.
B.Queueable Apex executes synchronously on the user thread.
C.Queueable Apex has no governor limits.
D.Queueable Apex cannot make callouts.
AnswerA

Queueable Apex overcomes the primitive data type limitation inherent in future methods by enabling the serialisation of complex objects. By implementing the Queueable interface, developers can pass sObjects and custom Apex classes as member variables within the class instance. This mechanism facilitates the passing of rich, structured data directly into the asynchronous execution context, whereas future methods are strictly restricted to primitive types, arrays of primitives, or collections of IDs. This architectural flexibility makes Queueable Apex the superior choice for handling complex stateful data.

Why this answer

Queueable Apex supports non-primitive data types and job chaining.

124
MCQeasy

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

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

Utilising Salesforce Lightning Design System (SLDS) standard spacing utility classes directly satisfies the requirement to adhere to standard styling guidelines for spacing by providing predefined CSS token-based margins and paddings. These utility classes—such as `slds-m-around_medium`—ensure consistent layout dimensions that automatically scale correctly across different viewports and maintain strict compliance with Salesforce design tokens, preventing hardcoded pixel values from violating responsive UI standards.

Why this answer

SLDS provides a documented set of spacing utility classes (e.g., slds-m-around_medium, slds-p-horizontal_small) that enforce the design system's standardized spacing scale. Using these utilities guarantees visual consistency across components and future-proofs the UI against SLDS token changes. This is the officially recommended approach for adhering to SLDS styling guidelines.

Exam trap

The trap here is confusing 'styling freedom' with 'styling correctness' — candidates who are used to writing raw CSS may pick inline styles or hardcoded pixels, not realizing SLDS explicitly mandates utility classes for spacing consistency.

How to eliminate wrong answers

Option B is wrong because inline styles bypass the SLDS design tokens, are hard to maintain, and cannot be overridden by theming or SLDS updates. Option C is wrong because blockquote is a semantic HTML element for quotations, not a spacing mechanism, and custom margins on it violate SLDS conventions. Option D is wrong because hardcoded pixel values ignore the SLDS spacing scale, break responsive design, and won't adapt when SLDS design tokens change.

125
MCQeasy

A developer needs to execute long-running computations that require complex chaining and the ability to pass non-primitive data types to the job. Which asynchronous feature should the developer implement?

A.Queueable Apex
B.Schedulable Apex
C.Future methods
D.Batch Apex
AnswerA

Queueable Apex satisfies the requirement for complex chaining and non-primitive state because it implements the `Queueable` interface, which unlike Future methods, permits passing complex data types such as sObjects or custom Apex objects through member variables. Furthermore, it supports job chaining by allowing developers to invoke `System.enqueueJob` from within the `execute` method, enabling sequential execution of dependent asynchronous processes with a job ID returned for tracking.

Why this answer

Queueable Apex supports the Database.AllowsCallouts interface, allows chaining of jobs, and accepts member variables of non-primitive types such as custom objects.

126
Multi-Selecteasy

Which TWO features are characteristic of Flow Builder compared to Apex triggers? (Choose two.)

Select 2 answers
A.Flows execute entirely on client-side browsers.
B.Flows provide a visual canvas for building automation logic without writing code.
C.Flows require compilation into bytecode and deployment via metadata APIs or developer toolchains.
D.Flows allow administrators to debug executions using built-in visual debugging tools.
E.Flows cannot interact with custom objects or custom fields.
AnswersB, D

Flow Builder directly addresses the requirement for declarative functionality by providing a graphical user interface where administrators can configure business logic, screen components, and record manipulations through drag-and-drop elements instead of writing imperative code. This capability satisfies the constraint of offering a visual canvas for building automation logic without code, contrasting with Apex triggers which exclusively require programmatic development using the Apex language.

Why this answer

Flow Builder is declarative, provides visual debugging, and allows point-and-click creation.

127
MCQmedium

A developer is writing a test method that performs a callout to an external REST service. Which interface must the developer implement to provide mock responses during the unit test execution?

A.InstallHandler
B.Schedulable
C.Database.Batchable
D.HttpCalloutMock
AnswerD

Implementing HttpCalloutMock lets the test supply a fake HTTP response via Test.setMock, so the callout never reaches the external REST service. This satisfies the requirement that mock responses be returned during unit test execution, since real callouts are blocked in tests.

Why this answer

HttpCalloutMock is the interface implemented to supply a mock HTTP response during test context when callouts are made.

128
MCQeasy

Which tool provides a declarative alternative to Apex triggers for creating records when another record is created?

A.Validation Rules
B.Record-Triggered Flow
C.Assignment Rules
D.Approval Processes
AnswerB

Record-Triggered Flows provide a fully declarative automation mechanism using Flow Builder that executes upon record creation, directly satisfying the requirement to avoid writing Apex code. By configuring a flow with a fast field update or an after-save trigger, administrators can instantiate new related records synchronously or asynchronously without writing a single line of programmatic logic. This aligns perfectly with Salesforce's 'declarative-first' strategy, offering robust debugging tools and better maintainability compared to traditional developer-written triggers.

Why this answer

Record-triggered flows in Flow Builder allow declarative creation of related records.

129
MCQmedium

A developer needs to see how much memory a specific Apex method is consuming. Which log category should be adjusted?

A.Apex Code.
B.Database.
C.Profiling.
D.Workflow.
AnswerC

Adjusting the Profiling log category enables the collection of detailed resource consumption metrics, including heap size and CPU time, directly fulfilling the requirement to monitor memory usage for a specific Apex method. By setting this category to DEBUG or finer levels, the debug log captures granular system-level performance data during execution, allowing developers to isolate and analyse memory footprints without altering business logic.

Why this answer

The Profiling log category in Salesforce debug logs captures granular performance data, including memory consumption, CPU time, and method-level execution details. Adjusting the Profiling category to the appropriate level (e.g., FINEST) provides the heap and memory usage information needed to analyze a specific Apex method's resource consumption.

Exam trap

Salesforce PD1 often tests confusion between Apex Code and Apex Profiling categories, tricking candidates into choosing Apex Code when the question specifically asks about memory or resource profiling.

How to eliminate wrong answers

Option A is wrong because the Apex Code category logs Apex execution flow, method entry/exit, and SOQL/DML statements, but does not provide detailed memory consumption metrics. Option B is wrong because the Database category logs SOQL and DML operations, not memory usage. Option D is wrong because the Workflow category logs workflow rule and process builder execution, which is unrelated to Apex memory profiling.

130
MCQeasy

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

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

`renderedCallback()` executes every time the component finishes rendering its HTML template, directly satisfying the requirement to run after every render cycle. As a unique lifecycle hook in the Lightning Web Component framework, it fires after both initial insertion into the DOM and any subsequent re-renders triggered by reactive property updates. This makes it the appropriate mechanism for performing post-render logic, manipulating DOM elements, or integrating with third-party libraries that rely on the latest DOM state.

Why this answer

renderedCallback() is the LWC lifecycle hook invoked after every render of the component, including the initial render and any subsequent re-renders triggered by reactive property changes. It is the correct place to perform DOM manipulation or logic that depends on the rendered output, though developers must guard against infinite loops by checking whether work has already been done.

Exam trap

The trap is confusing connectedCallback() with renderedCallback() — candidates who remember 'callback runs when component loads' pick connectedCallback, but only renderedCallback() runs after every render, which is what the question specifies.

How to eliminate wrong answers

Option A is wrong because constructor() runs once when the component instance is created, before any rendering, and cannot access the DOM or the component's rendered elements. Option B is wrong because connectedCallback() fires once when the component is inserted into the DOM, not after every render — it is for initialization logic like fetching data, not post-render work. Option D is wrong because render() is not a standard LWC lifecycle hook; LWC uses a declarative template and does not expose a render() method like React or Aura's render().

131
MCQmedium

A developer wants to log information specifically when a condition is met. Which method is most appropriate?

A.System.log().
B.Apex.debug().
C.System.debug().
D.Log.info().
AnswerC

`System.debug()` allows developers to conditionally write runtime data directly to the debug log. This satisfies the requirement to log information specifically when a condition is met by wrapping the debug statement inside standard programmatic conditional logic, such as an `if` statement. Consequently, developers can control log verbosity and inspect variable states precisely at the moment a designated business rule or threshold evaluates to true, avoiding unnecessary log clutter during execution.

Why this answer

System.debug() is the Apex method used to write messages to the debug log, and it can be wrapped in an if-condition to log only when a specific condition is met. It supports log levels (ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST) that map to the DebugLevel configuration.

Exam trap

SALESFORCE-PD1 often tests Apex API names, and candidates pick plausible-sounding but nonexistent methods like System.log() or Log.info() instead of the real System.debug().

How to eliminate wrong answers

Option A is wrong because System.log() is not a valid Apex method. Option B is wrong because Apex.debug() is not a valid Apex method. Option D is wrong because Log.info() is not a valid Apex method; logging in Apex is done through System.debug().

132
MCQmedium

An architect is designing an automation solution and wants to decide between a Record-Triggered Flow and an Apex Trigger. Which scenario heavily favors choosing an Apex Trigger?

A.Creating a task for the record owner upon lead conversion
B.Updating a field on a related parent record when a child record is created
C.Sending a standard email alert when a picklist value changes
D.Performing sequential HTTP callouts and complex JSON parsing in response to record inserts
AnswerD

Apex triggers provide the necessary control for handling asynchronous callouts via the Queueable interface, which is required when performing sequential HTTP requests. Unlike Record-Triggered Flows, which lack native support for chaining multiple callouts in a single transaction, Apex allows developers to manage complex JSON parsing and state maintenance across asynchronous processes. This architectural flexibility is essential for integrating external systems, such as those authenticated via Microsoft Entra ID, where strict sequence management and robust error handling are mandatory during record insertion.

Why this answer

Complex integrations, callouts, and heavy algorithmic processing across multiple disparate objects often necessitate Apex triggers over declarative flows.

133
MCQmedium

A developer is building a Lightning Web Component that displays a toast notification when a user successfully saves a record. Which module should the developer import to use the ShowToastEvent?

A.lightning/notifications
B.lightning/toast
C.lightning/messageService
D.lightning/platformShowToastEvent
AnswerD

The lightning/platformShowToastEvent module provides the ShowToastEvent class, which is used to display toast notifications in Lightning Experience and the Salesforce mobile app. Importing this module allows the developer to dispatch a toast event with configurable title, message, variant, and mode, ensuring proper user feedback.

Why this answer

To display a toast notification in a Lightning Web Component, the developer must import ShowToastEvent from lightning/platformShowToastEvent. This event is then dispatched with the appropriate parameters. Other modules serve different purposes and do not provide toast functionality.

Therefore, the correct import is from lightning/platformShowToastEvent.

Exam trap

The trap here is guessing a module name that sounds plausible, such as lightning/toast, instead of using the actual module lightning/platformShowToastEvent.

134
MCQhard

An Apex trigger needs to prevent duplicate records from being inserted based on a custom external ID field. Which approach should the developer take to optimize query performance and respect governor limits?

A.Use Database.upsert with strict mode enabled inside the trigger loop.
B.Query the database inside a for loop for every record in Trigger.new.
C.Collect the external ID values into a Set, query once outside the loop, and use a Map for validation.
D.Use an asynchronous @future method to validate duplicates after insert.
AnswerC

Collecting external ID values into a Set allows for a single SOQL query executed outside the trigger loop, which directly satisfies the requirement to respect governor limits by avoiding the "too many SOQL queries" error. By mapping these retrieved records, the developer can perform constant-time lookups to validate duplicates efficiently. This approach ensures optimal performance when processing bulk data, as it minimises database round-trips and prevents the performance degradation associated with nested queries during high-volume record ingestion.

Why this answer

Collecting field values into a Set, querying existing records matching that Set in a single query outside of loops, and comparing in memory is the bulkified approach.

135
Multi-Selecthard

Which THREE factors can cause an Apex CPU time limit exception in a synchronous transaction? Choose 3 answers.

Select 3 answers
A.Executing nested loops over large collections of sObjects.
B.Running complex string manipulations or regular expression matching on large text bodies.
C.Invoking too many SOQL queries within the 100 query limit.
D.Exceeding the total number of allowed DML statements.
E.Executing heavy calculations inside triggers processing large bulk record batches.
AnswersA, B, E

Executing nested loops over large collections of sObjects directly contributes to the synchronous Apex CPU time limit exception by exponentially increasing the number of programmatic iterations within a single transaction. As the outer loop iterates over each record, the inner loop processes the entire collection again, resulting in an algorithmic time complexity of $O(n^2)$. This heavy computational burden exhausts the strict 10-second CPU time allocation enforced by the Salesforce multi-tenant platform for synchronous executions.

Why this answer

Heavy loops, complex triggers, inefficient nested queries or collections processing, and excessive regex or string manipulations contribute to CPU time exhaustion.

136
MCQmedium

A developer needs to process 2 million records asynchronously, performing complex calculations and updating parent records in batches of 2,000. Which feature should the developer implement?

A.Queueable Apex
B.Batch Apex
C.Future methods
D.Scheduled Apex
AnswerB

Batch Apex handles millions of records asynchronously by splitting them into chunks of up to 2,000, each processed in a separate transaction with its own governor limits. This satisfies the 2 million record volume and the 2,000-record batch size constraint.

Why this answer

Batch Apex is designed for processing large datasets in chunks asynchronously.

137
Multi-Selecthard

A developer needs to write a Batch Apex class that processes records and ensures atomicity per batch chunk. Which TWO statements are true regarding Database.Batchable execution and error handling? (Choose TWO.)

Select 2 answers
A.Batch Apex chunks automatically roll back entirely if a single record fails, regardless of DML settings.
B.Using Database.DMLOptions or Database.insert(list, false) enables partial processing of records within a chunk without failing the entire batch.
C.Implementing the Database.Stateful interface allows instance variables to retain their values between batch chunks.
D.Batch Apex jobs cannot be monitored programmatically via Apex code.
E.The finish method executes before all execute chunks have completed.
AnswersB, C

Database.insert(list, false) uses the allOrNone parameter set to false, allowing records that fail validation to be skipped while the remainder commit. This delivers partial processing within each chunk, satisfying the per-chunk atomicity constraint without aborting the whole batch.

Why this answer

Using Database.insert(records, false) allows partial success within a batch chunk, and state can be maintained across chunks if Database.Stateful is used.

138
Multi-Selecthard

A developer is analyzing the Salesforce order of execution for a record update. Which TWO events occur AFTER custom validation rules are evaluated? (Choose TWO.)

Select 2 answers
A.Execution of Before Triggers.
B.Execution of custom validation rules
C.Execution of Assignment Rules and Escalation Rules.
D.Execution of initial system validation (such as required field checks).
E.Execution of Record-Triggered After Flows and Apex After Triggers.
AnswersC, E

Assignment Rules and Escalation Rules execute after validation rules pass, during the system save logic. They sit later in the order of execution, so they satisfy the stem's requirement for events occurring after custom validation rules are evaluated.

Why this answer

Options C and E are correct because in the Salesforce order of execution, custom validation rules run after before triggers and system validation, and then the process continues to assignment rules and escalation rules (C) for cases/leads, followed later by after-save logic such as record-triggered after flows and Apex after triggers (E). Option A is incorrect because before triggers execute before custom validation rules, not after. Option B is incorrect because it is the reference point itself—custom validation rules are evaluated, so they do not occur after themselves.

Option D is incorrect because initial system validation, including required field checks, occurs before custom validation rules are evaluated.

139
MCQmedium

A developer needs to assign a default value to a custom picklist field via Apex when creating a Lead record. What data type should be assigned to the picklist field in Apex?

A.String
B.Boolean
C.PicklistEntry
D.Integer
AnswerA

Assigning a `String` value to a custom picklist field in Apex satisfies the requirement because the Salesforce Schema treats picklist values as text literals during DML operations. When instantiating a new Lead record, the developer must pass the API name of the desired picklist value as a `String` to the field variable. This mechanism ensures the platform validates the input against the defined picklist metadata, successfully setting the default value without requiring complex object mapping or external authentication protocols like Microsoft Entra ID.

Why this answer

Picklist fields in Salesforce are represented as Strings in Apex when assigned or retrieved via sObjects.

140
Multi-Selecthard

Which THREE tools or contexts can be used to execute Anonymous Apex code? Choose 3 options.

Select 3 answers
A.Salesforce CLI (sf apex run)
B.Standard Page Layout Editor
C.Developer Console
D.Salesforce Extensions for Visual Studio Code
E.Lightning App Builder
AnswersA, C, D

The Salesforce CLI command sf apex run executes Anonymous Apex directly against an org from the terminal, supporting scripted and CI-friendly execution. This satisfies the requirement for a command-line context capable of running Anonymous Apex.

Why this answer

Salesforce CLI (option A) can execute Anonymous Apex via the `sf apex run` command (or the older `sfdx force:apex:execute`), which sends the Apex source to the Tooling API's executeAnonymous endpoint and returns the debug log and compile/run results. The Developer Console (option C) includes an Execute Anonymous window (Debug > Open Execute Anonymous Window) that compiles and runs arbitrary Apex in the current org and shows the resulting log. Salesforce Extensions for Visual Studio Code (option D) provide an "SFDX: Execute Anonymous Apex with Editor Contents" command that runs the active Apex file against an authorized org through the same executeAnonymous mechanism.

The Standard Page Layout Editor (option B) only arranges fields, buttons, and related lists on record pages and cannot run code, and Lightning App Builder (option E) is a declarative drag-and-drop tool for composing Lightning pages and components, not for executing Apex.

141
MCQeasy

A developer is writing an Apex test class and needs to reset governor limits before executing a block of asynchronous code testing. Which method should the developer use?

A.Test.resetLimits()
B.Test.runAs()
C.Test.startTest()
D.Limits.reset()
AnswerC

`Test.startTest()` resets the governor limits specifically to satisfy the constraint of executing asynchronous code testing within a clean limit context. When a developer invokes this method immediately before testing asynchronous operations like future methods, batch Apex, or queueables, the platform pauses synchronous limit tracking and grants a fresh set of governor limits for the subsequent block of code. This mechanism ensures that any setup DML executed beforehand does not exhaust the limits required by the asynchronous execution, allowing the test to accurately validate bulk processing and async functionality.

Why this answer

Test.startTest() and Test.stopTest() bracket the test section, resetting governor limits for the execution block within them and forcing any asynchronous calls to run synchronously.

142
MCQhard

A developer needs to access the old values of a record in an Apex trigger. Which collection provides this?

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

`Trigger.old` provides a list of sObjects representing the pre-update or pre-deletion state of records, which directly satisfies the requirement to access old values during update and delete operations in an Apex trigger. This context-specific collection is exclusively populated in contexts where prior record states exist, allowing developers to compare existing database values against incoming field modifications or to execute validation logic prior to deletion.

Why this answer

Trigger.old contains the list of records before the update or deletion.

143
MCQeasy

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

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

Using standard SLDS utility classes directly within the HTML template satisfies the recommended approach for styling Lightning Web Components without importing external stylesheets or custom static resources. The Salesforce Lightning Design System is natively available in the platform's component architecture, meaning developers can apply predefined design tokens and layout classes straight to the markup. This native integration ensures optimal performance, consistent branding aligned with Salesforce guidelines, and automatic adaptation to theme updates without requiring manual CSS maintenance.

Why this answer

Lightning Web Components are designed to work natively with SLDS, and the recommended approach is to apply SLDS utility classes (like slds-button, slds-grid, slds-m-around_medium) directly in the component's HTML template. Salesforce automatically makes SLDS available to LWC without any import, and using utility classes ensures visual consistency with the Lightning Experience and future SLDS updates.

Exam trap

Salesforce PD1 often tests the misconception that SLDS must be manually imported as a static resource in LWC, when it is actually available by default and should be used via utility classes.

How to eliminate wrong answers

Option B is wrong because importing the full SLDS stylesheet as a static resource is unnecessary and discouraged — SLDS is already globally available in LWC, and manually importing it can cause version drift and conflicts. Option C is wrong because Bootstrap is a third-party CSS framework not aligned with Salesforce's design system; mixing it with SLDS breaks visual consistency and can cause style conflicts. Option D is wrong because inline styles bypass SLDS entirely, are hard to maintain, cannot leverage SLDS design tokens, and violate the component-based styling model LWC promotes.

144
MCQmedium

A developer writes an Apex trigger that performs a SOQL query inside a standard for-loop processing Trigger.new. Which governor limit is most likely to be exceeded?

A.Total number of SQL queries issued (100)
B.Total heap size (6 MB)
C.Total number of records retrieved by SOQL queries (50,000)
D.Total CPU time (10,000 milliseconds)
AnswerA

A SOQL query inside a for-loop over Trigger.new executes once per record, so a bulk update of 200 records issues 200 queries, breaching the 100 synchronous SOQL query governor limit. The fix is querying once outside the loop into a map.

Why this answer

Querying inside loops easily exhausts the total SOQL queries issued per transaction limit of 100.

145
MCQhard

An asynchronous @future method is called from within an Apex test method. When are the statements inside the @future method actually executed during the test run?

A.Immediately when the line invoking the @future method is reached
B.At the end of the test method automatically without needing Test.stopTest()
C.After the Test.stopTest() method is executed
D.In a separate transaction concurrently while the test method continues running
AnswerC

Apex test execution normally runs synchronous code immediately, but asynchronous methods such as `@future` are quarantined until the test context reaches `Test.stopTest()`. When `Test.stopTest()` is invoked, it forces the asynchronous queue to flush and processes all pending `@future`, batch, and queueable jobs synchronously within the test context. This mechanism satisfies the timing requirement specified in the stem, ensuring the statements within the `@future` method execute strictly after `Test.stopTest()` is called, allowing developers to assert against the resulting database state.

Why this answer

Asynchronous methods called in tests are queued and executed synchronously after the Test.stopTest() statement.

146
Multi-Selecthard

A developer is troubleshooting a complex set of triggers and wants to restrict the amount of debug log data captured for a specific integration user. Which THREE actions can the developer take to manage debug logs effectively? (Choose three.)

Select 3 answers
A.Use a Debug Level configuration to define the verbosity for individual log categories.
B.Adjust log levels for specific categories such as Database, Workflow, and Apex Code.
C.Configure a Trace Flag specifying the targeted user and a designated start/end time.
D.Modify the organization-wide default debug level in Company Information.
E.Set up Apex Logging levels directly inside custom metadata types.
AnswersA, B, C

Configuring a Debug Level directly satisfies the requirement to restrict the amount of captured log data by allowing developers to precisely control the verbosity for individual log categories, such as Database, Workflow, and Callout. By dialling down unnecessary verbosity to finer granularities like 'None' or 'Error' specifically for the integration user's trace flag, the system avoids generating excessive debug noise while still capturing essential diagnostic information for the complex triggers.

Why this answer

Option A is correct because Debug Levels in Salesforce are reusable configurations that let you set the granularity (NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST) for each log category, so a developer can reduce captured data for the integration user. Option B is correct because within a Debug Level you can individually tune categories such as Database, Workflow, Apex Code, Callout, and Validation to lower verbosity and thereby shrink log size. Option C is correct because a Trace Flag scopes logging to a specific user (the integration user) and enforces a start and end time, ensuring logs are only generated during the desired window and expire automatically.

Option D is not correct because Company Information does not expose an organization-wide default debug level; logging is controlled through Trace Flags and Debug Levels in Setup. Option E is not correct because Apex logging levels are not defined in custom metadata types; they are configured via Debug Levels and Trace Flags.

Exam trap

SALESFORCE-PD1 often tests debug log configuration, and candidates invent non-existent settings like an org-wide default debug level in Company Information or logging levels in custom metadata.

147
MCQeasy

A developer needs to store a collection of Account IDs where duplicates are automatically prevented and lookups are extremely fast. Which collection type should the developer use?

A.Map<Id, Id>
B.Queue<Id>
C.List<Id>
D.Set<Id>
AnswerD

A `Set<Id>` collection inherently enforces uniqueness by design, ensuring that duplicate Account IDs cannot be stored, which satisfies the requirement to prevent duplicates automatically. Furthermore, Sets in Apex utilise a hash-based implementation, providing constant-time complexity for lookups. This mechanism allows the developer to verify the existence of an ID with exceptional efficiency, far outperforming the linear search required by a List. This makes the Set the optimal structure for managing unique identifiers when rapid retrieval is prioritised.

Why this answer

Sets in Apex store unique elements and provide very fast lookups by value using methods like contains().

148
Multi-Selecthard

Which THREE operations can cause an automatic roll back of an entire Apex transaction? Choose 3 options.

Select 3 answers
A.Catching a DmlException inside a try-catch block.
B.Executing Database.insert(records, false) with partial failure.
C.Exceeding a governor limit such as SOQL query count.
D.A DML failure when allOrNone defaults to true (or standard DML syntax).
E.An unhandled exception occurring anywhere in the execution stack.
AnswersC, D, E

Exceeding a governor limit, such as the maximum number of SOQL queries allowed, triggers an unhandled exception that forces the Salesforce platform to abort the execution context. Because Apex transactions are atomic, the platform automatically rolls back all database changes performed during the request to maintain data integrity. This mechanism ensures that partial updates do not persist when a runtime governor limit is breached, satisfying the requirement for an automatic rollback within the transaction lifecycle.

Why this answer

Option C is correct because exceeding a governor limit (such as the SOQL query count) throws a runtime exception that cannot be caught, and the platform rolls back the entire Apex transaction. Option D is correct because standard DML statements (and Database methods with allOrNone set to true) throw a DmlException on failure, and if that exception is unhandled it aborts and rolls back the whole transaction. Option E is correct because any unhandled exception propagating up the execution stack terminates the transaction and triggers an automatic rollback of all DML performed in it.

Option A is not correct because catching a DmlException in a try-catch block lets execution continue, so the transaction is not automatically rolled back. Option B is not correct because Database.insert(records, false) uses allOrNone=false, allowing partial success without rolling back the entire transaction.

149
MCQmedium

A developer needs to verify that a trigger correctly handles bulk data, specifically 250 records. What is the most effective approach?

A.Create a single record in the test class.
B.Use a loop to create 250 test records and insert them.
C.Use @isTest(isParallel=true) to increase speed.
D.Execute the trigger from the Developer Console.
AnswerB

Creating 250 test records within a loop and inserting them in a single DML statement directly satisfies the requirement to test bulk data handling, ensuring the trigger successfully processes the specific 250-record volume mentioned in the stem. Salesforce triggers operate in bulk by default, processing collections of up to 200 records per execution context. Executing a bulk insert of 250 records forces the platform to invoke the trigger across multiple batches, allowing the developer to verify that the code logic avoids governor limit violations and correctly handles collections without relying on single-record processing.

Why this answer

Testing with a collection of records validates bulkification and prevents governor limit exceptions.

150
MCQmedium

A developer needs to convert a JSON string representing a list of Account objects into an actual Apex List of Accounts. Which method should be used?

A.JSON.deserialize(jsonString, List<Account>.class)
B.String.valueOf(jsonString)
C.JSON.serialize()
D.JSON.parse()
AnswerA

`JSON.deserialize` accepts a target type as its second argument, allowing the developer to map a JSON string directly into a strongly-typed Apex collection. By passing `List<Account>.class`, the method instructs the serialisation engine to instantiate the appropriate list structure and populate it with Account objects. This mechanism satisfies the requirement to convert a raw string into a functional Apex List, ensuring type safety and immediate access to object fields without manual parsing or complex type casting.

Why this answer

JSON.deserialize() or JSON.deserializeUntyped() are used to parse JSON, and JSON.deserialize(jsonString, TargetType.class) deserializes into strongly typed objects.

Page 1

Page 2 of 5

Page 3

All pages