Courseiva

CCNA Process Automation And Logic Questions

70 of 145 questions · Page 2/2 · Process Automation And Logic · Answers revealed

76
MCQhard

When using a @future method, what data type is allowed as a parameter?

A.SObject
B.String
C.Apex Class instance
D.List of SObjects
AnswerB

Primitive types like String are supported.

Why this answer

Future methods only accept primitive data types or collections of primitive data types.

77
Multi-Selectmedium

A developer is designing a complex data validation and transformation process. Which TWO scenarios are best implemented using an Apex Trigger rather than a Record-Triggered Flow? (Choose TWO.)

Select 2 answers
A.Sending a standard email notification template when a status changes.
B.Updating a simple custom field on the same record before it is saved.
C.Executing complex custom algorithms requiring recursive method calls and dynamic exception handling across multiple wrapper classes.
D.Making asynchronous REST callouts to an external validation service during record creation.
E.Creating a task for a lead owner upon lead assignment.
AnswersC, D

Heavy programmatic logic and custom wrapper classes require Apex.

Why this answer

Apex triggers excel at complex integrations (callouts) and custom exception handling across multiple distinct object hierarchies that exceed declarative flow capabilities.

78
MCQeasy

Which feature allows administrators to invoke an Apex method from a Flow?

A.@RemoteAction
B.@future
C.@InvocableMethod
D.@AuraEnabled
AnswerC

@InvocableMethod allows Apex code to be called directly from flows.

Why this answer

The @InvocableMethod annotation exposes Apex methods to flows and process builder.

79
MCQhard

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

A.Validation rules are evaluated after all before triggers have completed execution.
B.Validation rules execute only after after triggers complete successfully.
C.Validation rules are evaluated concurrently with before triggers.
D.Validation rules are evaluated before any before triggers execute.
AnswerA

Correct. Validation rules run immediately after before triggers finish executing.

Why this answer

Validation rules execute after the 'before' triggers have completed and modified the records, ensuring that the validated state reflects any programmatic field updates.

80
MCQmedium

A developer has written a trigger on the Account object that performs a SOQL query inside a for-loop. The developer notices that when a data load of 200 records occurs, governor limits are exceeded. What is the most efficient way to refactor this trigger?

A.Use a static variable to cache the query results inside the loop.
B.Collect IDs into a Set and execute a single SOQL query outside the loop.
C.Move the query into a helper method that is called recursively for each record.
D.Wrap the query in a try-catch block to handle governor limit exceptions.
AnswerB

Correct. Collecting IDs into a Set and querying once using the IN clause avoids hitting SOQL governor limits.

Why this answer

To avoid SOQL query limits, queries should be moved outside of loops and leverage collections (lists or sets) to retrieve all required data in a single query.

81
MCQmedium

A developer needs to write a test class for a Batch Apex job. Which method must be called to verify that the batch job executes correctly?

A.Database.executeBatch() enclosed by Test.startTest() and Test.stopTest()
B.Test.runBatch()
C.Test.enqueueJob()
D.System.runAs()
AnswerA

Enclosing Database.executeBatch between startTest and stopTest ensures the batch executes synchronously during the test.

Why this answer

Database.executeBatch inside Test.startTest() and Test.stopTest() executes the batch job in test context.

82
Multi-Selectmedium

Which TWO tools or features should a developer consider when choosing between Flow Builder and Apex for business logic automation? (Choose two.)

Select 2 answers
A.Apex is better suited for complex algorithmic logic, advanced error handling, and reusable utility classes.
B.Flow Builder allows rapid, declarative updates that are maintainable by administrators without writing code.
C.Flows cannot trigger subflows or call invocable actions.
D.Apex triggers execute significantly slower than record-triggered flows in all scenarios.
E.Flow Builder is required when processing millions of records nightly in asynchronous batches.
AnswersA, B

Apex provides full object-oriented programming capabilities for complex logic and custom libraries.

Why this answer

Flow Builder is declarative and reduces maintenance, while Apex handles complex algorithms, batching, and high-volume triggers.

83
Multi-Selecthard

Which THREE actions can cause a governor limit exception during a poorly optimized trigger execution? (Choose three.)

Select 3 answers
A.Invoking a future method directly from a scheduled Apex class execute method.
B.Exceeding the maximum synchronous heap size of 6 MB by loading massive attachments into collections.
C.Performing individual DML statements inside a loop for each record in Trigger.new.
D.Accessing Trigger.old in an insert trigger.
E.Executing a SOQL query inside a for loop that iterates over Trigger.new.
AnswersB, C, E

Large data collections exceed the 6 MB synchronous heap limit.

Why this answer

Queries in loops, too many DML statements, and excessive heap size allocation trigger governor limit exceptions.

84
MCQeasy

What is the maximum number of asynchronous batch jobs that can be queued or active concurrently in the Flex Queue?

A.5
B.250
C.50
D.100
AnswerD

The Flex Queue holds up to 100 batch jobs in a Holding status.

Why this answer

Salesforce allows up to 100 batch jobs to be placed in the holding queue (Flex Queue) waiting for execution.

85
MCQmedium

A developer needs to update a related record. If using Apex, what is the best practice to avoid hitting governor limits?

A.Use a future method for each update
B.Use a for loop to update records one by one
C.Collect records in a list and perform a single DML statement
D.Perform DML inside the loop
AnswerC

Bulkification is essential for efficient Apex.

Why this answer

Bulkify the code to perform operations on collections rather than individual records.

86
MCQmedium

A developer wants to schedule an Apex class to run daily. Which interface must the class implement?

A.Batchable
B.Schedulable
C.Callable
D.Queueable
AnswerB

Schedulable allows the execution of code at specific times.

Why this answer

The Schedulable interface is required for classes that need to be scheduled.

87
Multi-Selectmedium

Which THREE trigger context variables are available ONLY in insert and update triggers (not delete triggers)? (Choose THREE.)

Select 3 answers
A.Trigger.newMap
B.Trigger.new
C.Trigger.old
D.Trigger.isInsert and Trigger.isUpdate
E.Trigger.oldMap
AnswersA, B, D

Trigger.newMap is available on insert (after) and update.

Why this answer

Trigger.new, Trigger.newMap, and Trigger.oldMap are available in insert/update contexts (oldMap is update only, new/newMap are insert/update). Let's check exact availability: Trigger.new and Trigger.newMap are available on insert and update (and undelete for new). Trigger.old and Trigger.oldMap are available on update and delete.

Let's frame the question around variables available in Trigger insert/update events vs delete.

88
Multi-Selectmedium

Which TWO statements are true regarding Queueable Apex compared to future methods? (Choose two.)

Select 2 answers
A.Queueable Apex returns an AsyncApexJob ID that can be used to monitor job progress.
B.Future methods support chaining multiple jobs sequentially.
C.Queueable Apex supports passing complex data types such as SObjects or custom objects.
D.Queueable Apex cannot perform HTTP callouts.
E.Queueable Apex methods must be annotated with @future.
AnswersA, C

Correct. System.enqueueJob returns an ID for tracking.

Why this answer

Queueable Apex offers job IDs for tracking and supports complex data types, unlike future methods.

89
MCQhard

What is the maximum number of asynchronous Apex jobs that can be queued in a 24-hour period in a Developer Edition org?

A.250,000
B.1,000,000
C.10,000
D.100
AnswerA

250,000 is the correct limit for Developer Edition.

Why this answer

The limit is 250,000 asynchronous Apex method executions per 24-hour period.

90
Multi-Selectmedium

When should a developer choose to implement Schedulable Apex? (Choose two.)

Select 2 answers
A.To execute long-running batch processing or maintenance tasks periodically.
B.To respond instantly to record inserts or updates.
C.To handle immediate real-time user interface validation.
D.To perform synchronous HTTP callouts directly from a Lightning Component button.
E.To run an Apex job at specified time intervals using CRON expressions.
AnswersA, E

Correct. Schedulable Apex is commonly used to invoke batch jobs periodically.

Why this answer

Schedulable Apex is used to run Apex classes at scheduled times or intervals, such as nightly batch jobs or periodic maintenance tasks.

91
MCQhard

A developer has a requirement to perform a callout to an external ERP system immediately when an Opportunity reaches Closed Won. The developer decides to use a future method from an after update trigger. What is a primary architectural limitation of this approach?

A.Future methods cannot make callouts to external systems.
B.Future methods cannot accept sObject instances as parameters, requiring ID serialization/deserialization and additional SOQL queries.
C.Future methods execute synchronously in the same database transaction.
D.Future methods are limited to 1 callout per transaction.
AnswerB

Because future methods only accept primitives, the future method must requery records using passed IDs.

Why this answer

Future methods cannot accept sObjects as arguments, requiring the trigger to pass primitive IDs, and they cannot guarantee exact execution order when multiple asynchronous requests fire.

92
MCQeasy

Which interface enables an Apex class to be invoked from a Flow using the InvocableAction framework?

A.Database.Batchable
B.Schedulable
C.Queueable
D.None, it uses the @InvocableMethod annotation.
AnswerD

Invocable actions are defined via the @InvocableMethod annotation rather than implementing a specific interface.

Why this answer

Methods annotated with @InvocableMethod allow Apex to be called from declarative flows.

93
MCQmedium

An enterprise application requires real-time integration where outgoing callouts must be triggered from an Apex trigger. What architectural pattern must the developer use?

A.Batch Apex execute method without queueing.
B.Direct synchronous HTTP callout inside the before insert trigger.
C.Validation rule containing an endpoint URL.
D.Future method annotated with @future(callout=true) invoked from an after trigger.
AnswerD

Asynchronous future methods with callout=true allow web service requests from triggers safely.

Why this answer

Triggers cannot make direct synchronous callouts, so they must invoke an asynchronous mechanism like a future method with callout=true.

94
Multi-Selecthard

Which TWO of the following are valid ways to chain asynchronous Apex?

Select 2 answers
A.Calling a Queueable class from a constructor
B.Calling System.enqueueJob from within a Queueable class
C.Calling a @future method from within a @future method
D.Scheduling a new job from the finish method of a Batch Apex class
E.Calling Batch Apex from a formula field
AnswersB, D

This is the standard way to chain jobs.

Why this answer

Queueable Apex and Scheduled Apex allow for chaining or subsequent scheduling.

95
Multi-Selecthard

Which THREE of the following are valid uses for the Database.executeBatch method parameters?

Select 3 answers
A.Passing parameters to the constructor for configuration
B.Specifying the batch size
C.Specifying the instance of the batch class
D.Enabling the debug log
E.Setting the execution priority
AnswersA, B, C

The constructor is used for passing data.

Why this answer

The method allows setting the batch size, which is critical for performance tuning.

96
Multi-Selecthard

Which THREE limitations apply to @future methods?

Select 3 answers
A.Cannot pass SObjects as arguments
B.Cannot be used in a test class
C.Cannot be used in a Batch Apex class
D.Cannot track the execution status via an ID
E.Cannot be called from another @future method
AnswersA, D, E

Only primitives are allowed.

Why this answer

Future methods cannot be tracked, have specific parameter limits, and cannot be chained.

97
MCQhard

A Queueable Apex job implements Database.AllowsCallouts and chains another Queueable job. What is the maximum number of jobs that can be chained in a single transaction chain?

A.Unlimited
B.5
C.1
D.50
AnswerB

In developer and enterprise editions, the maximum chain depth for Queueable jobs is 5.

Why this answer

Queueable jobs can be chained, but only one child job can be spawned per execution, up to a maximum depth limit of 5 in a synchronous transaction chain (or more depending on async chains, but standard chaining depth is limited).

98
MCQhard

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

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

Implementing Database.AllowsCallouts permits HTTP callouts from asynchronous Queueable executions.

Why this answer

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

99
MCQhard

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

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

Correct. A static variable retains its value for the duration of the request, allowing the code to check if it has already executed.

Why this answer

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

100
MCQmedium

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

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

This condition correctly targets after insert events.

Why this answer

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

101
MCQmedium

A developer has a requirement to update child Case records whenever a parent Account's status changes. The logic requires complex looping, exception handling, and handling up to 10,000 related records. Which tool should the developer choose according to Salesforce best practices?

A.Workflow Rule
B.Record-Triggered Flow
C.Apex Trigger
D.Process Builder
AnswerC

Apex triggers provide robust control, bulkification, and error-handling capabilities for complex enterprise logic.

Why this answer

Apex Triggers combined with Batch Apex or bulkified code are ideal for complex business logic involving high-volume child record updates that exceed declarative flow limits.

102
Multi-Selectmedium

Which TWO tools are effective for monitoring asynchronous Apex jobs?

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

This shows all async jobs.

Why this answer

The Apex Jobs page and the AsyncApexJob object are primary monitoring tools.

103
MCQeasy

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

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

Bulkification ensures that triggers handle any number of records passed via data loader or UI seamlessly.

Why this answer

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

104
MCQhard

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

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

Before triggers run prior to validation rules so values can be normalized or prepopulated.

Why this answer

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

105
MCQeasy

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

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

Correct. The @future annotation with callout=true enables asynchronous execution and allows callouts.

Why this answer

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

106
Multi-Selecthard

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

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

Each asynchronous execution runs in a fresh transaction with reset limits.

Why this answer

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

107
MCQhard

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

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

A static boolean flag set to true after first execution prevents subsequent recursive triggers from running.

Why this answer

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

108
Multi-Selecthard

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

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

In-memory map lookups eliminate repetitive SOQL queries inside loops.

Why this answer

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

109
MCQhard

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

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

Salesforce limits the number of scheduled Apex jobs in an org to 100.

Why this answer

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

110
MCQhard

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

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

Salesforce re-enters the order of execution.

Why this answer

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

111
MCQeasy

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

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

Trigger.isUpdate is the correct boolean context variable for update operations.

Why this answer

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

112
Multi-Selecthard

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

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

Dynamic kill-switches allow administrators or developers to disable faulty or recursive triggers instantly.

Why this answer

Trigger recursion can be prevented using static boolean flags in a helper class, utilizing trigger context maps to check if specific fields actually changed, or leveraging custom metadata/settings to disable triggers dynamically.

113
MCQhard

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

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

Adding more than 50 queueable jobs in a single transaction throws this exception.

Why this answer

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

114
MCQeasy

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

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

10,000 ms is the synchronous CPU time limit.

Why this answer

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

115
MCQmedium

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

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

QueryLocator is the standard and most efficient way to fetch records for batch processing.

Why this answer

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

116
MCQhard

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

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

Queueable Apex supports chaining through System.enqueueJob.

Why this answer

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

117
MCQeasy

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

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

Correct. Trigger.oldMap is a map of IDs to the old version of the SObject records.

Why this answer

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

118
MCQeasy

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

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

Immediate record-triggered flows run synchronously right when the record is saved.

Why this answer

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

119
MCQhard

A developer implements a Batch Apex class that updates millions of records. During the execution of the execute method, a transient database error occurs on a single record. What happens to the batch job by default if Database.executeBatch is called without additional parameters?

A.The failed record is placed in a retry queue for asynchronous reprocessing.
B.The entire batch job fails immediately, and no further chunks are processed.
C.Only the failed record is rolled back, and the batch continues processing the remaining records.
D.The entire database transaction is rolled back, but the batch continues to the next execute method.
AnswerB

Correct. Uncaught exceptions in a batch execution cause the transaction to fail and the entire batch job to be marked as Failed.

Why this answer

By default, if an unhandled exception occurs in a batch chunk, the entire batch job fails and the error is logged, unless Database.insert is used with allOrNone set or exception handling is implemented.

120
MCQmedium

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

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

Correct. Before-save flows run significantly faster than Apex triggers and provide declarative maintainability.

Why this answer

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

121
MCQeasy

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

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

Salesforce provides before undelete and after undelete trigger events for restored records.

Why this answer

Undelete triggers handle records restored from the recycle bin.

122
MCQhard

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

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

System.abortJob takes the job ID of a scheduled or flex-queue job to stop it.

Why this answer

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

123
Multi-Selectmedium

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

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

Each chained job runs in a new transaction, requiring proper bulkification and limit management.

Why this answer

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

124
MCQmedium

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

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

Before trigger context allows direct modification of record fields in Trigger.new without DML statements.

Why this answer

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

125
MCQhard

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

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

Parent roll-ups update after child changes, subsequently firing parent rules and triggers.

Why this answer

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

126
Multi-Selecthard

Which TWO actions are valid best practices when writing robust Batch Apex classes to adhere to governor limits and maintain data integrity? Choose 2 options.

Select 2 answers
A.Call external web service callouts synchronously for every single record inside the execute method without batching.
B.Query all related child records in the start method without considering heap size limits.
C.Hardcode record type IDs inside the execute method to save SOQL queries.
D.Implement Database.Stateful only when it is necessary to maintain state across transaction chunks.
E.Use Database.getQueryLocator in the start method when processing millions of records to efficiently manage query limits.
AnswersD, E

Database.Stateful preserves member variable values across transactions, but should only be used when necessary as it impacts performance and memory.

Why this answer

Batch Apex classes should utilize Database.getQueryLocator for large datasets to avoid heap size limits, and stateful tracking should be minimized unless specifically required to track aggregate metrics across batches.

127
MCQhard

A batch Apex class processes 50,000 records. During the execute method, a custom governor limit is approached. Which method can the developer call to check the remaining CPU time dynamically?

A.System.getCPU()
B.AsyncApexJob.getCpuTime()
C.BatchContext.getCpuTime()
D.Limits.getCpuTime()
AnswerD

Limits.getCpuTime() returns the CPU time consumed so far in the current transaction.

Why this answer

Limits.getLimitCpuTime() and Limits.getCpuTime() allow developers to monitor resource usage dynamically.

128
MCQmedium

A developer is building a solution that requires complex branching logic. When should the developer choose Apex over Flow?

A.When complex procedural logic is needed
B.When updating fields
C.When using standard objects
D.When sending emails
AnswerA

Apex provides a more robust environment for complex procedural logic.

Why this answer

Apex should be used when complex logic is required that cannot be represented in the Flow canvas, such as complex loops or high-performance algorithms.

129
Multi-Selectmedium

Which TWO of the following statements about Trigger.new and Trigger.old are accurate?

Select 2 answers
A.Trigger.old is available in insert triggers
B.Trigger.old is available in update triggers
C.Trigger.newMap is available in before insert
D.Trigger.new is available in delete triggers
E.Trigger.new is available in update triggers
AnswersB, E

It holds the old version of records.

Why this answer

Trigger.new is always present on insert/update; Trigger.old is always present on update/delete.

130
MCQeasy

Which trigger context variable returns a map of IDs to the new versions of the sObject records?

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

Trigger.newMap provides a keyed lookup of records by ID for the new state.

Why this answer

Trigger.newMap contains the map of IDs to the new versions of the sObject records, available only in update, undelete, and after insert contexts.

131
MCQmedium

A developer needs to schedule an Apex class to run weekly. Which syntax correctly schedules the job using System.schedule?

A.System.scheduleBatch(new MySchedulableClass(), 'Weekly Job', 200);
B.System.enqueueJob(new MySchedulableClass(), '0 0 0 ? * MON *');
C.System.schedule(new MySchedulableClass(), '0 0 0 ? * MON *');
D.System.schedule('Weekly Job', '0 0 0 ? * MON *', new MySchedulableClass());
AnswerD

Correct. This provides the job name, valid CRON string, and class instance.

Why this answer

System.schedule requires a job name, a valid CRON expression, and an instance of the Schedulable class.

132
MCQeasy

Which tool is best for automating a process that requires UI interaction, such as a wizard screen?

A.Future Method
B.Flow Builder
C.Batch Apex
D.Apex Trigger
AnswerB

Screen flows are specifically for user interaction.

Why this answer

Flows provide the Screen component for user-interactive processes.

133
Multi-Selecthard

During the Salesforce order of execution, which THREE actions occur AFTER the system executes 'after' triggers? (Choose three.)

Select 3 answers
A.Execution of Assignment Rules.
B.Execution of escalation rules and roll-up summary field calculations.
C.Execution of Workflow rule field updates.
D.Execution of before insert triggers.
E.Execution of custom validation rules.
AnswersA, B, C

Correct. Assignment rules execute after after-triggers.

Why this answer

After triggers run towards the end of the transaction. Subsequent steps include assignment rules, workflow rules, and database commit.

134
MCQhard

A developer has a Queueable Apex job that needs to query large volumes of data and perform updates. To optimize performance and avoid heap size limits, what is the best practice when querying records inside a Queueable Apex job?

A.Assign all queried records to a single global List variable in the class.
B.Set the method execution context to read-only using @ReadOnly.
C.Implement the Database.Batchable interface instead of Queueable.
D.Use a SOQL for-loop to iterate over query results chunk by chunk.
AnswerC, D

Correct. While Batchable is better for massive datasets, SOQL for-loops are the correct tool within Queueable to manage heap size.

Why this answer

Querying records using a SOQL Query Locator inside a batch or leveraging iterable queries helps manage memory efficiently, but for Queueable jobs, querying using SOQL for loops or batching ids helps avoid heap limits.

135
MCQeasy

An enterprise application requires nightly execution of an Apex class that processes records across multiple objects. Which interface must the Apex class implement?

A.Database.AllowsCallouts
B.Schedulable
C.Batchable
D.Queueable
AnswerB, D

The Schedulable interface allows classes to be run at scheduled intervals using Cron expressions.

Why this answer

To schedule an Apex job, the class must implement the Schedulable interface, specifically the execute(SchedulableContext sc) method.

136
MCQmedium

A developer needs to write a unit test for a Queueable Apex class. How should the developer verify that the Queueable job executed successfully?

A.Use System.assertAsync() to poll the job status table.
B.Enclose the execution within Test.startTest() and Test.stopTest(), then query for the resulting record changes.
C.Query the AsyncApexJob table without Test.stopTest().
D.Call the queueable execute method directly in a try-catch block.
AnswerB

Test.stopTest() forces asynchronous jobs queued inside startTest() to execute before moving to subsequent lines of test code.

Why this answer

Queueable jobs executed inside Test.startTest() and Test.stopTest() run synchronously upon reaching stopTest(), allowing assertions to be checked immediately after.

137
Multi-Selectmedium

A developer is writing an Apex trigger and needs to ensure proper bulkification. Which TWO practices should the developer follow to avoid governor limits? (Choose two.)

Select 2 answers
A.Use single record DML statements inside a standard for-loop.
B.Hardcode record IDs to query specific test records.
C.Perform SOQL queries and DML operations outside of loops.
D.Annotate the trigger with @future to ensure asynchronous bulk processing.
E.Use Trigger context variables such as Trigger.new to process collections of records.
AnswersC, E

Correct. Queries and DML inside loops quickly exhaust governor limits.

Why this answer

Bulkification requires processing data in collections (lists/sets) and placing all DML and SOQL operations outside of loops.

138
Multi-Selecthard

A developer is troubleshooting a Batch Apex job that fails intermittently. Which THREE methods or properties are part of the Database.BatchableContext interface available in batch execution? (Choose three.)

Select 3 answers
A.getId()
B.getAssociatedId()
C.getChildJobId()
D.getApex龄JobId() / getJobId() / getAsyncApexJobId() - wait, getAsyncApexJobId() is valid.
E.getJobId()
AnswersA, D, E

Correct. getId() returns the ID of the BatchApexWorker or job.

Why this answer

Database.BatchableContext provides methods to get job IDs and batch IDs during execution.

139
Multi-Selectmedium

When comparing Flow Builder decision points and Apex trigger logic, which THREE statements are valid design considerations? (Choose THREE.)

Select 3 answers
A.Apex triggers are executed after all Flow Builder automations have completed.
B.Apex triggers provide superior control for complex exception handling and multi-object transaction orchestration.
C.Flow Builder allows administrators to configure logic visually, reducing maintenance overhead for non-developers.
D.Flow Builder cannot invoke Apex actions.
E.Record-Triggered Flows can execute either before or after the record is saved to the database.
AnswersB, C, E

Apex offers advanced programming constructs for complex logic.

Why this answer

Flows are declarative, easier to maintain, and execute within governor limits, whereas Apex handles complex integrations and high-volume data manipulations.

140
MCQmedium

A developer implemented a Queueable Apex class that performs heavy processing. During testing, the developer wants to verify whether the asynchronous job has finished executing before running dependent unit test assertions. What should the developer use?

A.Test.startTest() and Test.stopTest() block around the enqueueJob call
B.AsyncApexJob query inside a loop with Thread.sleep()
C.A custom countdown latch pattern using platform cache
D.System.assertAsyncExecution() method
AnswerA

Test.stopTest() forces asynchronous code to execute synchronously within the test context.

Why this answer

Developers use Test.startTest() and Test.stopTest() in unit tests to force all asynchronous jobs enqueued within the block to execute synchronously before proceeding.

141
MCQmedium

A developer needs to run a batch job that queries records and updates them. What is the default batch size if no optional batch size parameter is specified in Database.executeBatch()?

A.200
B.50
C.2000
D.500
AnswerA

200 is the default chunk size for batch apex.

Why this answer

The default batch size for Database.executeBatch() is 200 records if not specified.

142
MCQhard

A developer implements a Queueable class that makes callouts and needs to test it using Test.startTest() and Test.stopTest(). When does the asynchronous queueable job execute during a unit test?

A.At the end of the test method automatically without stopTest.
B.Immediately when enqueued.
C.Only when explicitly mocked via HttpCalloutMock.
D.When Test.stopTest() is executed.
AnswerD

Test.stopTest() forces all asynchronous processes enqueued within the test block to run synchronously.

Why this answer

Asynchronous code executed inside Test.startTest() and Test.stopTest() runs synchronously when Test.stopTest() is called.

143
MCQhard

A developer creates a Trigger on the Account object that performs a SOQL query inside a for loop. While testing with bulk data operations, the developer encounters a governor limit exception. Which limit is most likely exceeded?

A.Maximum CPU time on a Salesforce server (10,000 milliseconds)
B.Total number of SOQL queries issued (100)
C.Total heap size allocated (6 MB)
D.Total number of DML statements issued (150)
AnswerB

Doing a query per record in a loop violates the 100 SOQL queries per transaction governor limit.

Why this answer

Executing SOQL queries inside a loop without bulkification easily causes the total number of SOQL queries issued per transaction (100) to be exceeded.

144
MCQhard

A developer has an Apex trigger that fires on Account update. Inside the trigger, it calls a future method to update related Contact records. During testing with 150 Account records modified simultaneously, the developer receives a System.LimitException: Too many future calls. What is the cause of this exception?

A.The total daily asynchronous limit was reached.
B.Future methods cannot be invoked from inside an Apex trigger context.
C.The trigger exceeded the maximum limit of 50 future method calls per Apex transaction.
D.The future method tried to execute a SOQL query exceeding the limit.
AnswerC

Correct. Triggers processing bulk updates can easily exceed the per-transaction limit of 50 future calls.

Why this answer

Future methods cannot be called from within other asynchronous contexts or inside triggers when the trigger processes more records than the future call limit allows per transaction (e.g. max 50 future calls per transaction).

145
Multi-Selecthard

A developer is designing an asynchronous architecture using Batch Apex. Which THREE considerations must be kept in mind regarding Batch Apex behavior? (Choose THREE.)

Select 3 answers
A.The maximum batch size query locator limit is 200 records maximum.
B.Up to 5 batch jobs can be in execution concurrently for a single organization.
C.Batch Apex automatically executes synchronously if triggered from a Visualforce controller.
D.Batch jobs placed in the queue when the active limit is reached enter the Flex Queue in Holding status.
E.Implementing Database.Stateful ensures member variables retain their values across all transaction chunks.
AnswersB, D, E

The concurrent batch execution limit is 5.

Why this answer

Batch apex jobs are queued in the Flex queue, can execute up to 5 concurrent jobs, and can maintain state using Stateful.

← PreviousPage 2 of 2 · 145 questions total

Ready to test yourself?

Try a timed practice session using only Process Automation And Logic questions.