Courseiva

CCNA Testing Debugging And Deployment Questions

75 of 107 questions · Page 1/2 · Testing Debugging And Deployment · 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

This is the mandatory requirement for production deployments.

Why this answer

The code must have at least 75% coverage and all tests must pass.

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 code between startTest and stopTest resets governor limits and forces async processing to complete.

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

This allows test methods to access the private or protected members of a class.

Why this answer

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

4
MCQmedium

A developer is deploying metadata from a sandbox to a production org using Salesforce CLI. Which command should the developer use to validate the deployment without actually saving components to the target organization?

A.sf project retrieve start --validate
B.sf project deploy validate
C.sf org check deploy
D.sf project deploy start --dry-run
AnswerD

The --dry-run flag validates the deployment against the target org without making permanent changes.

Why this answer

The sf project deploy start command includes a dry-run or check-only validation flag. In modern Salesforce CLI (sf), it is --dry-run.

5
MCQhard

When deploying via Metadata API, what happens if a test class fails during the deployment?

A.Only the failing test class is ignored.
B.The deployment succeeds but flags a warning.
C.The deployment fails and rolls back all changes.
D.The deployment continues but prevents Apex compilation.
AnswerC

Transactional deployment ensures no partial changes if tests fail.

Why this answer

The entire deployment fails by default unless specified otherwise.

6
MCQeasy

A developer has written a test method that requires a large volume of test data to be set up. To avoid writing duplicate data setup code across multiple test methods in the same class, which annotation should the developer use?

A.@isTest(SeeAllData=true)
B.@TestVisible
C.@TestSetup
D.@Future
AnswerC

TestSetup is used to create test records once and roll back changes between test methods automatically.

Why this answer

The @TestVisible annotation is incorrect for data setup. The @TestSetup annotation executes once per test class and creates data for all test methods in that class.

7
MCQhard

Why must you use Test.startTest() when testing asynchronous Apex code?

A.To increase the execution time allowed for tests.
B.To save the test data to the database immediately.
C.To ensure asynchronous processes complete within the test execution context.
D.To bypass user permission checks.
AnswerC

Test.stopTest triggers all queued asynchronous jobs.

Why this answer

Asynchronous code like @future or Queueable is queued; Test.startTest ensures it executes when Test.stopTest is called.

8
MCQhard

A developer is writing a unit test and needs to assert that a specific custom exception was thrown during invalid input processing. Which pattern should the developer use?

A.Wrap the target code in a try block, add Assert.fail('Expected exception') after the target code, and catch the exception.
B.Use Test.expectException() before calling the method.
C.Check Limits.getScriptStatements() after the method call.
D.Use System.assert(false, e.getMessage()) inside the catch block.
AnswerA

Placing Assert.fail after the code ensures that if the exception is not thrown, the test fails immediately.

Why this answer

Using try-catch blocks with System.assert or Assert.fail inside the try block ensures that if the exception is not thrown, the test fails.

9
MCQmedium

A developer is writing a test class that requires several custom objects to be populated with data. What is the most efficient way to handle this across multiple test methods?

A.Use the @TestSetup annotation
B.Create a static method and call it at the start of every test method
C.Insert the data inside the constructor of the test class
D.Use the Test.loadData() method for all objects
AnswerA

This annotation ensures data is inserted once for all test methods in the class.

Why this answer

The @TestSetup annotation allows creating data once for all test methods within a class, reducing execution time.

10
Multi-Selectmedium

Which TWO circumstances will cause an Apex unit test method to fail? (Choose two.)

Select 2 answers
A.The test method executes in read-only mode.
B.The test class code coverage is exactly 75%.
C.The test method finishes executing with zero assertions.
D.A System.assert() or Assert.areEqual() statement evaluates to false.
E.An uncaught exception such as a NullPointerException is thrown during test execution.
AnswersD, E

Failed assertions throw an exception that fails the test method.

Why this answer

Uncaught exceptions and failed system assertions cause test method failures.

11
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

The @isTest annotation is the standard way to define test classes.

Why this answer

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

12
MCQmedium

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

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

Appropriate balance.

Why this answer

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

13
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

They are designed for CI/CD and source-based workflows.

Why this answer

A scratch org is an ephemeral, configurable Salesforce environment for development and testing.

14
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

Mandatory check.

Why this answer

Tests are run automatically during deployment and package installation.

15
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

Shows method nesting.

Why this answer

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

16
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

This ensures Apex statements are captured in the log.

Why this answer

Setting the Apex Code level to DEBUG is necessary to see standard logs.

17
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

Test methods must be static.

Why this answer

Test methods must be static, have a void return type, and be marked with @isTest.

18
MCQhard

Why might a deployment fail due to 'Apex classes do not have sufficient coverage'?

A.Test classes are not marked @isTest.
B.Individual class coverage is below 75%.
C.Aggregate coverage is below 75%.
D.The test classes are too large.
AnswerC

Total coverage is the requirement.

Why this answer

The combined coverage across all classes must be at least 75%.

19
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

CLI commands can be scripted for CI/CD.

Why this answer

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

20
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 are native point-and-click tools for moving metadata between connected orgs.

Why this answer

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

21
MCQmedium

A developer needs to test a feature that relies on the current time. Which method should be used to simulate time?

A.DateTime.now().
B.Design code to use a custom provider that can be injected.
C.Test.setSystemTime().
D.System.now().
AnswerB

Dependency injection is the only way to mock time.

Why this answer

There is no built-in way to 'freeze' time; developers should design for dependency injection of time, but the question asks for standard tools.

22
MCQhard

A developer wants to view real-time debug log streaming in their local environment using the Salesforce CLI. Which command should the developer execute?

A.sf apex run test
B.sf project deploy start
C.sf org display
D.sf apex log tail
AnswerD

sf apex log tail streams logs in real-time to the command line.

Why this answer

The sf apex tail log command streams debug logs to the terminal in real time.

23
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

Mandatory deployment requirement.

Why this answer

The platform requires at least 75% code coverage for all Apex classes before they can be deployed to production.

24
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

@testSetup creates data once for all test methods in the class.

Why this answer

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

25
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

sf project deploy start deploys metadata to a target org from the local project.

Why this answer

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

26
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

This is the required manifest file for Metadata API operations.

Why this answer

The 'package.xml' file is the manifest that lists the components to be retrieved or deployed via the Metadata API.

27
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 lists all captured debug logs for users and traces.

Why this answer

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

28
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

This allows for testing code that might hit limits individually.

Why this answer

Test.startTest and Test.stopTest reset governor limits within the block.

29
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

This ensures no data side effects.

Why this answer

Salesforce automatically rolls back all data created in a test method after completion.

30
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

Profiling is specifically designed for monitoring resource consumption.

Why this answer

The Profiling category logs governor limit usage, including heap size and CPU time.

31
Multi-Selecthard

Which TWO of the following are true about the 'Debug Log' settings in the Setup menu?

Select 2 answers
A.Debug logs can only be generated for the System Administrator profile
B.Setting a trace flag on a user consumes API calls
C.Trace flags have an expiration date and time
D.You can set log levels for specific users
E.Logs can be set to last for an infinite duration
AnswersC, D

Trace flags must be defined with an expiration window.

Why this answer

Logs can be set for users, and the duration of those log traces is limited.

32
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

Standard practice for testing callouts.

Why this answer

Callouts must be mocked using HttpCalloutMock to avoid external network dependencies.

33
Multi-Selecthard

Which TWO of the following are limitations when deploying using the Metadata API?

Select 2 answers
A.Components must be defined in a package.xml manifest
B.It allows bypassing governor limits during deployment
C.Apex tests are automatically run during deployment to production
D.It can only be used for Apex Classes
E.It requires a manual review by Salesforce Support
AnswersA, C

A manifest is required for Metadata API.

Why this answer

Metadata API deployments require a manifest file and are subject to the same validation rules as the org.

34
MCQeasy

A developer needs to write a unit test to verify that a trigger correctly inserts related Task records when a custom object record is created. Which annotation should the developer place on the test class method to ensure it runs correctly and can access existing org data if needed?

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

The @isTest annotation is required on test classes and test methods to define them for execution.

Why this answer

The @isTest annotation identifies a method or class as containing unit tests. Using @isTest(SeeAllData=true) is sometimes required when legacy data must be accessed, though best practice is to create test data locally.

35
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

Deployment connections are mandatory for moving Change Sets between environments.

Why this answer

A Deployment Connection must be established between the two organizations before a Change Set can be sent.

36
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 allows block-level execution under a specified User instance to test sharing behavior.

Why this answer

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

37
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

Tests require assertions to be meaningful.

Why this answer

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

38
MCQeasy

Which of the following is a limitation of Change Sets?

A.They cannot deploy Custom Objects
B.They are limited to 100 components
C.They require the CLI to be installed
D.They can only be used between related orgs
AnswerD

Change Sets require a deployment connection between the source and target orgs.

Why this answer

Change Sets are strictly one-way and cannot be used to deploy changes from production back to a sandbox.

39
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

HttpCalloutMock must be implemented to return fake responses since actual callouts are not permitted in test methods.

Why this answer

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

40
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

Profiling provides memory and resource usage data.

Why this answer

The Profiling category provides detailed information on resource consumption.

41
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

Correct method for adding logs.

Why this answer

System.debug() is used to add custom messages to the debug log.

42
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() marks the point when test execution begins and resets governor limits.

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.

43
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

Test.stopTest collects all asynchronous processes and runs them synchronously before resuming test execution.

Why this answer

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

44
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

Debug levels define the granularity of logs recorded per category.

Why this answer

Trace flags control log levels and duration for users, classes, or triggers. Log categories allow filtering verbosity.

45
MCQmedium

What is the maximum number of debug logs that can be stored per user?

A.1,000.
B.There is no limit on count, only total size.
C.50.
D.100.
AnswerB

Based on aggregate size.

Why this answer

There is a limit (typically 50MB per user, but logs are replaced).

46
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

Inserting a collection of records is the standard way to test bulk DML operations.

Why this answer

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

47
MCQeasy

Where can a developer view the generated debug logs for an Apex execution in the Salesforce UI?

A.Setup > Monitor > Debug Logs
B.Setup > Deployment > Logs
C.Setup > Security > Audit Trail
D.Setup > Custom Code > Apex Settings
AnswerA

This is the correct navigation path for viewing logs.

Why this answer

Debug logs are accessible via the Setup menu under 'Debug Logs' or within the Developer Console.

48
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

Primary purpose.

Why this answer

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

49
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

This hits the query limit quickly.

Why this answer

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

50
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 provide a UI for moving metadata between linked Orgs.

Why this answer

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

51
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

Deployment is transactional.

Why this answer

Compilation errors prevent deployment.

52
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

This leads to 'brittle' tests that fail if data changes.

Why this answer

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

53
Multi-Selectmedium

Which THREE statements are true regarding Salesforce debug logs? (Choose three.)

Select 3 answers
A.Debug logs can capture database operations, Apex code execution, and workflow rule evaluations.
B.Developers cannot view debug logs inside the Salesforce Developer Console.
C.Trace flags are required to specify log levels and duration for users, classes, or triggers.
D.A single debug log file has a maximum size limit, beyond which older log lines are dropped or truncated.
E.Debug logs are stored indefinitely in production without automatic purging.
AnswersA, C, D

Debug logs track multiple categories including Database, ApexCode, and Workflow.

Why this answer

Debug logs capture system events, have size limits, and require trace flags.

54
MCQhard

A developer needs to reset the governor limits within a test method to verify functionality that processes large amounts of records. Which method should be used?

A.System.resetLimits()
B.Test.loadData()
C.Test.startTest()
D.Test.stopTest()
AnswerC

Test.startTest() resets limits, and the code following Test.stopTest() is executed with fresh limits.

Why this answer

Test.startTest() and Test.stopTest() reset the governor limits for the code executed between them.

55
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

Logs capture duration.

Why this answer

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

56
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

Primary purpose.

Why this answer

It allows developers to focus on specific categories or levels of logs.

57
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

StopTest forces all asynchronous processes to execute before proceeding.

Why this answer

Test.stopTest() executes asynchronous jobs and processes pending communications.

58
Multi-Selectmedium

When deploying code using Unmanaged Change Sets between connected Salesforce organizations, which TWO limitations or behaviors apply? (Choose two.)

Select 2 answers
A.Apex classes deployed via change sets are automatically executed in production for code coverage validation upon upload.
B.Change sets support full rollback of the entire deployment if any single component fails.
C.Change sets automatically delete components from the target organization if they are removed from the source.
D.Some standard fields and standard objects cannot be included in change sets.
E.Change sets can deploy changes only between organizations that have a deployment connection defined.
AnswersD, E

Standard objects and standard fields have restrictions regarding inclusion in change sets.

Why this answer

Change sets require inbound connection approval, and certain components require manual post-deployment steps or cannot be included.

59
MCQhard

When testing a class that depends on Custom Settings, what is the best practice?

A.Ignore the custom settings in the test.
B.Hardcode the values into the test.
C.Mock the custom settings using a wrapper class.
D.Use the production custom settings.
AnswerC

Best practice for test independence.

Why this answer

Create the custom settings in the test method setup to ensure independence from production data.

60
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

This command deploys the source code to the target org.

Why this answer

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

61
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

Custom debug messages are included.

Why this answer

Debug logs contain execution details for DML, SOQL, and custom user debug messages.

62
Multi-Selecteasy

Which TWO of the following are valid ways to execute Apex unit tests in Salesforce?

Select 2 answers
A.Developer Console
B.Salesforce CLI
C.Object Manager settings
D.User Management settings
E.Change Sets menu
AnswersA, B

The Developer Console is a primary tool for test execution.

Why this answer

Tests can be run via the Developer Console or the Apex Test Execution page in Setup.

63
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

Prevents external dependencies.

Why this answer

Salesforce blocks all real callouts in tests to prevent side effects.

64
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

DML activity is recorded.

Why this answer

Debug logs track database actions, Apex code, and workflow execution.

65
MCQeasy

A developer is preparing to deploy metadata changes from a sandbox to a production org using Outbound Change Sets. Where must the administrator or developer establish the connection between the two organizations?

A.Connected Apps in the production org
B.Named Credentials in both orgs
C.Remote Site Settings in the source org
D.Deployment Settings in the target org
AnswerD

Inbound change sets require deployment connections to be authorized and deployed from trusted source orgs via Deployment Settings.

Why this answer

Deployment connections for change sets must be authorized and configured in Deployment Settings in the target production org.

66
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

Reducing verbosity for unneeded categories keeps log sizes small enough to capture the critical execution path.

Why this answer

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

67
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

CLI facilitates source-driven development and automation.

Why this answer

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

68
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

Ensures no regressions.

Why this answer

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

69
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

Displays status for async jobs.

Why this answer

The Apex Jobs page lists all batch, future, and queueable jobs.

70
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 test data locally ensures test independence and reliability.

Why this answer

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

71
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

Primary use case.

Why this answer

Change Sets move metadata between connected Salesforce Orgs.

72
Multi-Selecthard

Which THREE features are supported in Salesforce scratch orgs? (Choose three.)

Select 3 answers
A.Installing unlocked and managed packages for testing.
B.Permanent production status with unlimited user licenses.
C.Source tracking between the local project and the scratch org.
D.Directly modifying standard Salesforce platform source code.
E.Configuring edition, features, and settings via a project-scratch-def.json file.
AnswersA, C, E

Packages can be installed into scratch orgs for testing dependencies.

Why this answer

Scratch orgs support source tracking, custom configurations, and feature activation.

73
Multi-Selectmedium

Which TWO of the following are valid ways to specify which tests to run in the Salesforce CLI?

Select 2 answers
A.sfdx force:apex:test:run -c
B.sfdx force:apex:test:run -s
C.sfdx force:apex:test:run -f
D.sfdx force:apex:test:run -n MyTestClass
E.sfdx force:apex:test:run -u
AnswersA, D

Using -c runs all tests in the package.

Why this answer

The CLI allows running specific classes or classes within a namespace.

74
MCQmedium

A developer needs to measure the performance of a SOQL query. Which log category and level should be used?

A.Database: INFO.
B.System: DEBUG.
C.Apex Code: INFO.
D.Profiling: FINEST.
AnswerA

Captures query performance.

Why this answer

The Database category at the INFO level or higher captures SOQL execution metrics.

75
Multi-Selecthard

Which TWO of the following are required to successfully use the 'Test.startTest()' and 'Test.stopTest()' pattern for testing batch Apex?

Select 2 answers
A.The batch class must be implemented in a separate file
B.The test must be annotated with @isTest(SeeAllData=true)
C.The batch class must have a global access modifier
D.Assertions must be placed after the Test.stopTest() call
E.Database.executeBatch must be called between the start and stop methods
AnswersD, E

Assertions must wait until the asynchronous work is processed by stopTest.

Why this answer

This pattern is required to force the batch to execute within the test context and ensure it completes before assertions.

Page 1 of 2 · 107 questions totalNext →

Ready to test yourself?

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