Courseiva

CCNA Testing Debugging And Deployment Questions

75 questions · Testing Debugging And Deployment · All types, answers revealed

1
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

2
MCQmedium

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

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

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

Why this answer

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

3
MCQmedium

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

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

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

Why this answer

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

4
MCQeasy

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

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

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

Why this answer

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

5
MCQmedium

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

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

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

Why this answer

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

6
MCQmedium

What is the primary function of a scratch org?

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

7
MCQhard

When is an Apex test run automatically executed?

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

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

Why this answer

Tests are run automatically during deployment and package installation.

8
MCQmedium

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

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

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

Why this answer

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

9
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

10
Multi-Selectmedium

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

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

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

Why this answer

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

Exam trap

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

11
Multi-Selecteasy

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

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

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

Why this answer

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

12
Multi-Selecthard

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

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

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

Why this answer

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

13
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

14
MCQmedium

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

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

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

Why this answer

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

15
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.

16
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.

17
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.

18
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.

19
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.

20
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.

21
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.

22
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.

23
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.

24
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.

25
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.

26
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.

27
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().

28
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.

29
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.

30
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.

31
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.

32
MCQeasy

What is the primary function of the 'Developer Console'?

A.It is a browser-based IDE for developing in Salesforce.
B.It is used for deploying to production.
C.It is a tool for end-user reporting.
D.It is used for managing user permissions.
AnswerA

The Developer Console directly satisfies the core requirement of the stem by functioning as an integrated development environment accessible directly within a web browser. Developers can leverage its built-in toolset to write, debug, and test code, execute SOQL queries, and inspect logs without needing to install local software. This browser-based accessibility precisely matches the defining operational constraint specified in the question regarding the platform's primary interface mechanism.

Why this answer

It is an integrated development environment for writing, debugging, and testing Apex.

33
MCQmedium

A developer is receiving 'Too many SOQL queries' errors in a trigger. What is the most likely cause?

A.Using too many debug statements.
B.Not enough test coverage.
C.Using the wrong trigger event.
D.Executing SOQL inside a for loop.
AnswerD

Executing SOQL queries inside a `for` loop directly violates Salesforce governor limits by issuing a database query for every single iteration of the loop, rather than performing a single bulkified query outside the loop context. In this scenario, processing trigger context variables (`Trigger.new`) iteratively causes the cumulative query count to exceed the strict synchronous limit of 100 SOQL queries per transaction. Refactoring the code to retrieve all necessary records in a single query prior to the loop resolves the 'Too many SOQL queries' error.

Why this answer

Performing SOQL inside a loop is the primary cause of this error.

34
MCQeasy

Which tool is best suited for migrating metadata between two related Salesforce Orgs using a UI-based approach?

A.Force.com IDE.
B.Change Sets.
C.Salesforce CLI.
D.Metadata API.
AnswerB

Change Sets directly satisfy the requirement for a UI-based approach by providing a native, point-and-click deployment tool accessible directly within the Salesforce setup menu. Because the two Salesforce orgs are related through a direct connection established via Deployment Settings, administrators can securely select, package, and upload metadata components directly from the source environment to the target environment without needing external command-line interfaces, IDEs, or complex authorisation flows.

Why this answer

Change Sets are designed for moving metadata between linked Salesforce Orgs.

35
MCQeasy

What is the result of a compilation error in an Apex class during deployment?

A.The deployment fails entirely.
B.The class is deployed without the code.
C.The class is deployed with warnings.
D.The class is skipped.
AnswerA

Apex requires synchronous compile-time validation across all components within a deployment package before any metadata is committed to the target environment. When a compilation error occurs in a single Apex class, the Metadata API transaction enforces an all-or-nothing atomic rule. Consequently, the entire deployment fails entirely, preventing the promotion of broken code or unresolvable dependencies into production or sandbox orgs, and maintaining strict type-safety and structural integrity across the platform.

Why this answer

When Apex code contains a compilation error (syntax error, invalid reference, missing dependency), the deployment of that component fails. In a Change Set or Metadata API deployment, a compilation failure causes the entire deployment to fail—Salesforce does not partially deploy a class with errors or skip it silently. The deployment must be corrected and retried.

Exam trap

The trap is thinking deployments are partial or forgiving—candidates may assume a bad class is skipped or deployed with warnings, but Apex compilation errors abort the entire deployment.

How to eliminate wrong answers

Option B is wrong because Salesforce never deploys a class without its code; a class with no body would be invalid and is not a valid deployment outcome. Option C is wrong because Apex compilation is binary—either it compiles or it does not; there is no 'deployed with warnings' state for compilation errors. Option D is wrong because the class is not skipped; the failure aborts the deployment transaction, so nothing in that deployment is committed.

36
MCQmedium

If a developer uses 'SeeAllData=true' in a test class, what are the primary risks?

A.It makes tests dependent on the state of the organization's existing data.
B.It prevents the use of Test.startTest().
C.It causes the Apex compiler to error.
D.It increases the test execution time significantly.
AnswerA

Using `SeeAllData=true` bypasses standard unit test data isolation, allowing test methods to query and manipulate preexisting records in the Salesforce database. This directly satisfies the constraint outlined in the stem regarding risks, because tests become fundamentally dependent on the mutable state of the organisation's existing data. Consequently, if underlying records are modified, deleted, or missing in a target environment, the test execution will fail unpredictably, undermining the reliability and portability of the deployment pipeline.

Why this answer

It relies on existing organization data, making tests brittle and dependent on external state.

37
MCQmedium

How can a developer identify the most time-consuming SOQL query in a transaction?

A.By inspecting the trigger size.
B.By reviewing the debug log for query execution times.
C.By checking the number of records returned.
D.By counting the number of lines in the code.
AnswerB

Developer debug logs record precise execution durations and database query rows processed for every database interaction within a transaction. By enabling profiling levels such as `FINEST` for database logs, a developer can inspect the precise timestamps and execution times associated with each SOQL statement. This directly satisfies the requirement to identify the most time-consuming SOQL query by providing granular performance metrics at the individual statement level.

Why this answer

By checking the 'Executed Units' or 'SOQL' section of the debug log for duration.

38
MCQmedium

What is the purpose of the 'Debug Log' Filter in the Developer Console?

A.To export logs.
B.To run tests.
C.To limit the types of events displayed.
D.To delete old logs.
AnswerC

Filtering debug logs in the Developer Console directly satisfies the requirement to limit the types of events displayed by applying specific logging levels to individual categories, such as Database, Workflow, and Callout. By adjusting these filters, developers can isolate extraneous trace flags and reduce noise within the log panel. This mechanism constrains the verbosity of system events captured during execution, ensuring that only relevant diagnostic data for targeted components is evaluated during troubleshooting.

Why this answer

The Debug Log Filter in the Developer Console allows developers to limit the types of events (such as Apex, Workflow, Validation, etc.) that are displayed in the debug log. This helps in focusing on specific log categories and reducing noise when troubleshooting. It does not export, run tests, or delete logs.

Exam trap

SALESFORCE-PD1 often tests the purpose of Developer Console features, and candidates may confuse the Debug Log Filter with log export or test execution functionalities.

How to eliminate wrong answers

Option A is wrong because exporting logs is done via the 'Export' button or by downloading the log, not through the filter. Option B is wrong because running tests is done via the Test menu or the Developer Console's Test tab, not the Debug Log Filter. Option D is wrong because deleting old logs is done by clearing the logs list or using the 'Clear' button, not by filtering.

39
Multi-Selecteasy

Which TWO actions occur automatically when Test.stopTest() is called in an Apex unit test? (Choose two.)

Select 2 answers
A.All asynchronous queued processes (future, batch, queueable) are run synchronously.
B.The user session is automatically logged out.
C.All custom objects in the organization are deleted and recreated.
D.Email messages and other pending asynchronous communications are dispatched.
E.The database is permanently committed to production.
AnswersA, D

Asynchronous Apex execution in a production environment is deferred to separate server threads, but unit tests execute within a single transaction context. Calling `Test.stopTest()` forces the runtime to process all pending asynchronous queued mechanisms—such as `@future` methods, batch jobs, and Queueable implementations—synchronously before test execution continues. This satisfies the requirement to execute and assert outcomes against deferred processes within the synchronous boundaries of a unit test, validating that asynchronous logic executes correctly under test constraints.

Why this answer

Option A is correct because Test.stopTest() forces all asynchronous Apex that was queued during the test—future methods, batch jobs, and queueable jobs—to execute synchronously before the method returns, allowing the test to assert on their results. Option D is correct because Test.stopTest() also flushes pending asynchronous communications, including email sent via Messaging.sendEmail, so that the messages are dispatched and can be verified with Limits.getEmailInvocations() or by querying EmailMessage records. Option B is wrong because Test.stopTest() does not log out the running user; the test continues executing in the same session context.

Option C is wrong because no custom objects are deleted or recreated; test data isolation is handled by the test's own transaction rollback, not by schema changes. Option E is wrong because Test.stopTest() does not commit data to production—all test data changes are rolled back after the test completes.

Exam trap

The trap is assuming Test.stopTest() commits data or ends the test — it does neither; it only flushes async work, and all test DML is still rolled back at the end of the method.

40
MCQhard

You are using the Salesforce CLI to deploy code. Which command is used to deploy source code from a local project to an org?

A.sf project deploy start
B.sf org create
C.sf project retrieve start
D.sf org login
AnswerA

The command `sf project deploy start` uses the modern Salesforce CLI (v2) framework to synchronously or asynchronously transmit metadata components from a local project directory to a target scratch org, sandbox, or production environment. This directly satisfies the requirement in the question stem to deploy source code from a local workspace to an active Salesforce org using the current Salesforce CLI standard, superseding the deprecated `sfdx force:source:deploy` syntax.

Why this answer

The 'sf project deploy start' command is the current standard for deploying source to an org.

41
Multi-Selectmedium

Which THREE items are included in a debug log?

Select 3 answers
A.System.debug statements.
B.Browser cookies.
C.User password history.
D.SOQL queries.
E.DML operations.
AnswersA, D, E

Debug logs capture every System.debug call, recording the statement's log level, category and message text. This is the primary mechanism developers use to trace variable values and execution flow during Apex, flow or process debugging sessions.

Why this answer

In Salesforce, a debug log captures the execution details of transactions, and it explicitly includes System.debug statements (Option A), which are the developer-defined diagnostic messages written to the log for troubleshooting. It also records SOQL queries (Option D), showing the exact query strings executed along with row counts and timing, which is essential for diagnosing query performance and governor limit issues. Additionally, DML operations (Option E) are logged, including the type of operation (insert, update, delete, etc.), the affected object, and the number of rows processed.

Options B and C are incorrect because browser cookies and user password history are not part of the Apex/transaction execution context that debug logs capture; cookies relate to client-side session state, and password history is a security/user record attribute, neither of which appears in debug log output.

42
MCQmedium

Why does a test fail if it tries to perform a callout without Test.setMock()?

A.Governor limits are exceeded.
B.The platform disallows live callouts in test context.
C.The mock server is not found.
D.The callout method is not public.
AnswerB

Salesforce strictly enforces a platform security constraint that blocks all synchronous and asynchronous HTTP callouts to external web services during a test context. Because unit tests must execute deterministically without relying on external network availability or unpredictable latency, any unmocked outbound request triggers a runtime exception. The `Test.setMock()` method satisfies this architectural limitation by injecting a virtual response provider, allowing developers to safely simulate web service interactions and successfully validate integration logic without making live network calls.

Why this answer

Salesforce blocks live HTTP callouts during test execution to keep tests deterministic, fast, and isolated from external systems. Any callout attempted in a test method without a mock throws a System.CalloutException stating that callouts are not allowed from test methods. Test.setMock() registers a mock implementation (typically implementing HttpCalloutMock or WebServiceMock) so the callout is intercepted and returns canned responses instead of hitting the network.

Exam trap

The trap is assuming the failure is about limits or permissions — candidates who have seen 'callout limit exceeded' errors in production may pick governor limits, but in test context the platform categorically forbids live callouts regardless of limits.

How to eliminate wrong answers

Option A is wrong because governor limits are not the reason — the callout is rejected before it even counts against callout limits, since the platform disallows the operation in test context. Option C is wrong because there is no 'mock server' to find; Test.setMock() registers an in-memory Apex mock class, not a network endpoint, so 'server not found' is not the failure mode. Option D is wrong because method visibility (public/private) has no bearing on whether a callout is permitted in a test — the restriction is environmental, not access-modifier based.

43
Multi-Selectmedium

Which THREE of the following items can be viewed in a debug log?

Select 3 answers
A.Database DML operations
B.Apex method execution
C.User login credentials
D.Browser cache contents
E.Workflow rule evaluation
AnswersA, B, E

Database DML operations are fully captured within Salesforce debug logs, satisfying the requirement to view transaction activities specified in the stem. When executed within Apex code, statements such as `insert`, `update`, and `delete` generate specific log lines—categorized under `DML_BEGIN` and `DML_END` events—along with associated governor limit consumption and row counts. Developers rely on this precise tracing mechanism to diagnose database interaction errors and monitor transactional performance during testing.

Why this answer

Option A (Database DML operations) is correct because debug logs capture DML statements such as INSERT, UPDATE, DELETE, and UPSERT executed during a transaction, including the affected object and record IDs. Option B (Apex method execution) is correct because debug logs record Apex execution events, including method entry/exit, SOQL/DML statements, and system debug output from Apex classes and triggers. Option E (Workflow rule evaluation) is correct because debug logs include workflow and process automation events, showing when workflow rules are evaluated and whether their criteria are met.

Option C (User login credentials) is not included because debug logs never record passwords or authentication secrets, and login activity is tracked through Login History rather than debug logs. Option D (Browser cache contents) is not included because debug logs capture server-side Salesforce execution events, not client-side browser data such as cached files or cookies.

Exam trap

Salesforce-PD1 often tests the scope of debug logs — the trap is assuming client-side artifacts (browser cache) or security-sensitive data (credentials) appear in server-side logs, when only server-side execution categories are captured.

44
MCQmedium

A developer is analyzing a debug log and notices that it is truncated because it exceeded the maximum file size limit. Which action should the developer take to capture only the relevant Apex code execution details without exceeding the limit?

A.Increase the maximum log file size in company profile settings.
B.Adjust the Trace Flag log levels to reduce verbosity for unnecessary categories like Database and Workflow.
C.Disable all validation rules in the org temporarily.
D.Switch the debug log perspective to 'Development Harvester'.
AnswerB

Trace flag log levels control which categories are captured, so lowering verbosity on categories such as Database and Workflow reduces log volume, keeping the Apex execution details within the maximum debug log size and preventing truncation.

Why this answer

Refining log categories and levels ensures only necessary debug statements are recorded, preventing truncation.

45
MCQmedium

What is the primary purpose of the Salesforce CLI in a CI/CD pipeline?

A.To automate metadata deployment and package management.
B.To provide a visual interface for Change Sets.
C.To run unit tests manually.
D.To debug Apex in a GUI.
AnswerA

The Salesforce Command Line Interface (CLI) provides headless authentication and headless commands that seamlessly integrate with continuous integration servers such as GitHub Actions or GitLab CI. By executing headless operations like `sf project deploy start` and managing scratch org lifecycles, it directly satisfies the core CI/CD requirement to automate metadata deployment and package management without human intervention. This programmatic execution removes manual deployment bottlenecks, ensuring reproducible builds and consistent package promotion across the entire development lifecycle.

Why this answer

The Salesforce CLI is the fundamental tool for programmatically interacting with Salesforce Orgs in automation.

46
Multi-Selecthard

Which THREE actions are best practices when deploying Apex classes to production?

Select 3 answers
A.Run all tests in the destination organization.
B.Avoid using change sets.
C.Use version control to manage source code.
D.Directly edit classes in production.
E.Validate the deployment first without installing.
AnswersA, C, E

Running all tests in the destination organisation directly satisfies the deployment requirement to execute all tests in the target environment when deploying Apex to production. This technical mechanism ensures that existing production code integrity remains uncompromised and that all triggers, workflows, and custom logic successfully pass validation against the cumulative test suite before changes are committed. Executing the test suite post-deployment catches unexpected regressions caused by data dependencies or cumulative governor limits that may not have surfaced in the sandbox environment.

Why this answer

Running tests, validating, and using version control are key deployment practices.

47
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

48
Multi-Selecteasy

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

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

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

Why this answer

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

49
MCQeasy

What is a 'Change Set' used for?

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

50
Multi-Selectmedium

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

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

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

Why this answer

The page shows class name, status, and duration.

51
Multi-Selecthard

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

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

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

Why this answer

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

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

52
MCQeasy

Which log level displays the most information?

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

53
Multi-Selecthard

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

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

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

Why this answer

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

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

54
MCQeasy

Which of these is NOT a valid testing best practice?

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

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

Why this answer

Hard-coding data is a bad practice.

55
MCQhard

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

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

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

Why this answer

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

56
MCQmedium

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

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

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

Why this answer

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

57
MCQhard

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

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

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

Why this answer

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

58
MCQeasy

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

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

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

Why this answer

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

59
MCQmedium

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

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

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

Why this answer

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

60
MCQhard

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

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

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

Why this answer

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

61
MCQhard

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

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

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

Why this answer

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

62
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

63
Multi-Selectmedium

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

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

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

Why this answer

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

64
MCQeasy

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

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

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

Why this answer

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

65
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

66
Multi-Selectmedium

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

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

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

Why this answer

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

67
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

68
MCQhard

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

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

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

Why this answer

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

Exam trap

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

How to eliminate wrong answers

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

69
MCQmedium

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

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

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

Why this answer

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

70
MCQhard

When testing a trigger, why should you avoid hard-coding IDs?

A.It violates Apex syntax rules.
B.It limits the test to only one record.
C.It triggers governor limits.
D.IDs change between orgs, causing test failures.
AnswerD

Salesforce record IDs are dynamically generated and unique to each environment upon record creation, meaning a hard-coded ID in a test method will not exist when you deploy or **practise** deployment to another sandbox or production org. This variability directly violates the requirement to avoid hard-coded IDs, as queries referencing static identifiers will return null results and trigger failures during test execution.

Why this answer

Record IDs are org-specific—the same logical record has different 15/18-character IDs in each Salesforce org (sandbox, production, scratch org). Hard-coding an ID in a test method means the test will fail when deployed to another org because that ID does not exist there. Tests must query for or create records dynamically to obtain valid IDs at runtime.

Exam trap

The trap is focusing on syntax or limits—candidates may think hard-coded IDs cause compilation or governor issues, but the real problem is org-specific ID portability across environments.

How to eliminate wrong answers

Option A is wrong because hard-coding an ID does not violate Apex syntax—it compiles fine; the problem is runtime portability, not syntax. Option B is wrong because hard-coding an ID does not inherently limit the test to one record; you could hard-code multiple IDs, though the portability issue remains. Option C is wrong because hard-coding an ID does not trigger governor limits—limits are about query/DML counts, not literal values.

71
MCQmedium

What is the primary purpose of the 'System.debug()' statement?

A.To display an error to the end user
B.To stop the execution of the code
C.To log an audit trail of configuration changes
D.To write information to the debug log
AnswerD

Executing a `System.debug()` statement directly serialises messages into the execution context, which subsequently generates a log entry within the Salesforce debug log. This mechanism satisfies the stem's requirement to record runtime information, enabling developers to monitor variable states and control flow during Apex execution without altering the transactional database.

Why this answer

System.debug() writes information to the Salesforce debug log, which developers use to trace execution, inspect variable values, and diagnose issues during development and troubleshooting. The output appears in the Developer Console, the debug log viewer, or via the Streaming API, and is governed by the log level set in the trace flag. It does not surface anything to end users or alter execution flow.

Exam trap

Salesforce-PD1 often tests the purpose of System.debug() — the trap is confusing it with user-facing error display (ApexPages.addMessage) or execution control (throw/breakpoint), when it is purely a server-side logging statement.

How to eliminate wrong answers

Option A is wrong because System.debug() writes to the debug log, not to the user interface — to show an error to a user you would use ApexPages.addMessage(), a toast, or a custom exception surfaced in the UI. Option B is wrong because System.debug() does not stop execution; to halt code you would throw an exception or use a breakpoint in the Apex debugger. Option C is wrong because audit trails of configuration changes are captured by Setup Audit Trail and Field History Tracking, not by System.debug(), which is a developer-time logging statement.

72
Multi-Selectmedium

Which THREE of the following are true about Apex test data setup?

Select 3 answers
A.@TestSetup methods run once per test class
B.Test data is automatically committed to the database
C.Tests can use existing data from the org if 'SeeAllData=true' is set
D.Test data must be inserted into the database to be queryable
E.Test classes can only use data created within the same method
AnswersA, C, D

Annotating a method with `@TestSetup` ensures that the enclosed data setup logic executes precisely once for the entire test class context, satisfying the requirement to efficiently create common records shared across multiple test methods. This mechanism significantly reduces execution time and prevents governor limit consumption by avoiding repetitive data insertion routines within individual test methods, rolling back any DML changes automatically after each test method completes to maintain data isolation.

Why this answer

Data setup should use @TestSetup where possible, avoid using actual production data, and be isolated from the database.

73
MCQhard

When using the Salesforce CLI to deploy, what is the 'check-only' flag used for?

A.To validate the metadata without saving it to the org.
B.To force the deployment despite test failures.
C.To skip the compilation check.
D.To run only the tests.
AnswerA

Validating metadata via the `--check-only` flag triggers a server-side deployment process that executes all Apex tests and component integrity checks without committing changes to the target org. This mechanism satisfies the requirement to verify deployment readiness in a sandbox or production environment while ensuring no persistent modifications occur. By performing this dry run, developers can identify potential integration failures or configuration conflicts before finalising the release, thereby maintaining the stability of the environment during the continuous integration lifecycle.

Why this answer

It validates the deployment without committing changes to the target org.

74
Multi-Selecthard

Which THREE factors influence deployment success?

Select 3 answers
A.The number of users.
B.Profile/Permission Set permissions.
C.Dependent components.
D.Test coverage.
E.The color of the UI.
AnswersB, C, D

Profile and Permission Set settings must be explicitly included in the deployment package to ensure that users retain necessary access rights within the target environment. When migrating metadata, the absence of these security definitions causes a mismatch between the component availability and user visibility, directly satisfying the requirement to maintain functional parity across environments. Unlike identity management systems such as Microsoft Entra ID, Salesforce metadata deployments require manual inclusion of these permission objects to prevent post-deployment access failures for end users.

Why this answer

Tests, dependencies, and profile permissions are critical.

75
Multi-Selectmedium

Which TWO of the following are valid deployment tools?

Select 2 answers
A.Salesforce CLI.
B.Change Sets.
C.System Log.
D.Developer Console Debugger.
E.Apex Test Runner.
AnswersA, B

Salesforce CLI functions as a command-line interface that facilitates the movement of metadata between local development environments and Salesforce organisations. By utilising the Salesforce Extensions for VS Code, developers can package and deploy components directly to sandboxes or production environments. This tool satisfies the requirement for a valid deployment mechanism by providing a robust, scriptable interface for metadata API operations, ensuring that code and configuration changes are synchronised efficiently across the development lifecycle without relying on manual browser-based uploads.

Why this answer

Salesforce CLI (A) is a valid deployment tool because it provides command-line commands such as 'sf project deploy start' (formerly 'sfdx force:source:deploy') that push metadata and source from a local project to an org, supporting both source and metadata formats. Change Sets (B) are a valid deployment tool because they let you bundle metadata components in a source org and deploy them to a target org through the Setup UI, typically between related orgs such as sandbox to production. The other options are not deployment tools: System Log (C) is a monitoring/diagnostic feature for viewing execution logs, Developer Console Debugger (D) is used to inspect and troubleshoot Apex and other code at runtime, and Apex Test Runner (E) is for executing Apex tests to validate code, not for moving metadata between orgs.

Exam trap

SALESFORCE-PD1 often tests tool categorization, and candidates confuse monitoring/debugging tools like System Log or Developer Console with deployment tools.

Ready to test yourself?

Try a timed practice session using only Testing Debugging And Deployment questions.