Courseiva

CCNA Process Automation And Logic Questions

75 of 103 questions · Page 1/2 · Process Automation And Logic · Answers revealed

1
MCQhard

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

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

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

Why this answer

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

2
MCQmedium

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

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

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

Why this answer

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

3
MCQmedium

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

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

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

Why this answer

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

4
MCQeasy

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

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

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

Why this answer

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

5
MCQeasy

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

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

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

Why this answer

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

6
MCQmedium

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

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

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

Why this answer

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

7
MCQhard

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

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

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

Why this answer

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

8
MCQmedium

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

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

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

Why this answer

Custom validation rules are evaluated after Before Triggers complete.

9
Multi-Selectmedium

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

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

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

Why this answer

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

10
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

11
MCQmedium

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

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

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

Why this answer

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

12
MCQmedium

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

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

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

Why this answer

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

13
Multi-Selectmedium

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

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

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

Why this answer

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

14
MCQhard

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

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

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

Why this answer

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

15
MCQmedium

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

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

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

Why this answer

Scheduled Apex requires implementing the Schedulable interface.

16
MCQhard

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

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

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

Why this answer

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

17
MCQeasy

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

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

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

Why this answer

The limit for synchronous SOQL queries is 100.

18
Multi-Selectmedium

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

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

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

Why this answer

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

19
MCQeasy

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

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

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

Why this answer

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

20
MCQmedium

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

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

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

Why this answer

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

21
MCQeasy

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

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

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

Why this answer

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

22
MCQmedium

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

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

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

Why this answer

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

Exam trap

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

23
MCQhard

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

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

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

Why this answer

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

24
MCQhard

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

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

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

Why this answer

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

25
MCQeasy

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

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

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

Why this answer

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

26
MCQeasy

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

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

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

Why this answer

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

27
MCQmedium

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

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

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

Why this answer

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

28
MCQmedium

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

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

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

Why this answer

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

29
Multi-Selectmedium

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

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

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

Why this answer

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

30
MCQmedium

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

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

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

Why this answer

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

31
MCQeasy

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

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

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

Why this answer

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

32
MCQhard

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

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

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

Why this answer

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

33
MCQhard

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

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

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

Why this answer

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

34
MCQmedium

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

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

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

Why this answer

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

35
MCQeasy

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

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

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

Why this answer

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

36
MCQeasy

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

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

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

Why this answer

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

37
MCQeasy

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

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

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

Why this answer

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

38
Multi-Selecteasy

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

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

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

Why this answer

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

39
MCQeasy

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

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

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

Why this answer

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

40
MCQmedium

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

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

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

Why this answer

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

41
MCQmedium

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

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

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

Why this answer

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

42
Multi-Selecthard

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

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

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

Why this answer

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

43
Multi-Selecthard

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

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

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

Why this answer

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

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

44
MCQhard

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

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

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

Why this answer

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

45
MCQmedium

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

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

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

Why this answer

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

46
MCQeasy

Which method is used in an Apex trigger to display a custom error message on a specific record during a before insert event?

A.throw new TriggerException()
B.ApexPages.addMessage()
C.addError()
D.rejectRecord()
AnswerC

addError() on a record in a before insert trigger blocks the DML operation and surfaces a custom error message on that specific record's page, satisfying the requirement to display a custom error during before insert.

Why this answer

The addError() method on an sObject instance prevents the DML operation and displays an error message.

47
MCQeasy

A developer needs to execute logic before a record is inserted into the Database to validate field values and prevent invalid records from saving. Which trigger event should the developer use?

A.after update
B.after insert
C.before update
D.before insert
AnswerD

Before insert triggers fire prior to the record being committed, letting the developer validate field values and call addError() to block the save. This directly satisfies the stem's requirement to prevent invalid records from entering the database, unlike after insert, which runs once the record already exists.

Why this answer

Before insert triggers are used to perform validation, update field values, and prevent records from saving by using the addError() method on the records.

48
Multi-Selectmedium

A developer needs to schedule an Apex class to run weekly. Which THREE elements are required to implement Schedulable Apex? (Choose THREE.)

Select 3 answers
A.The class must extend the Controller class.
B.The class must implement Database.Batchable<SObject>.
C.The public class must implement the Schedulable interface.
D.The job must be invoked using System.schedule() with a valid Cron expression.
E.The class must define the global or public void execute(SchedulableContext sc) method.
AnswersC, D, E

Implementing the `Schedulable` interface is a fundamental requirement that directly satisfies the constraint of defining an executable Apex class for scheduled execution. By declaring the class with `implements Schedulable`, the developer informs the Salesforce platform that the class contains the mandatory `execute(SchedulableContext SC)` method. This structural contract enables the system to invoke the class asynchronously via the `System.schedule` method, fulfilling the architectural prerequisite for recurring weekly jobs.

Why this answer

Option C is correct because Schedulable Apex requires the class to implement the Schedulable interface, which is the contract that makes the class eligible for scheduling. Option D is correct because the scheduled job must be registered with System.schedule(), passing a job name and a valid Cron expression that defines the weekly recurrence. Option E is correct because the Schedulable interface mandates an execute method with the signature global or public void execute(SchedulableContext sc), which is the entry point invoked when the scheduled job fires.

Option A is incorrect because extending the Controller class is unrelated to scheduling and is used for Visualforce controllers, not Schedulable Apex. Option B is incorrect because implementing Database.Batchable<SObject> is required for Batch Apex, not for Schedulable Apex, although a class can implement both interfaces if needed.

49
Multi-Selectmedium

Which TWO actions can be performed inside a before insert Apex trigger without causing a runtime exception? (Choose two.)

Select 2 answers
A.Modifying field values on records in Trigger.new directly without a DML statement.
B.Accessing Trigger.oldMap to compare previous values.
C.Performing an immediate synchronous HTTP callout to an external REST service.
D.Executing an explicit update DML statement on records in Trigger.new.
E.Calling the addError() method on a record in Trigger.new to prevent saving.
AnswersA, E

Before insert triggers run prior to commit, so assigning values directly to Trigger.new records stages the changes in memory and Salesforce persists them automatically. No explicit DML statement is needed, and issuing one would cause a runtime exception.

Why this answer

Option A is correct because in a before insert trigger the records in Trigger.new are not yet committed, so you can assign new field values directly on those sObject instances (e.g., rec.MyField__c = 'X') and Salesforce persists them without any DML statement. Option E is correct because calling addError() on a record in Trigger.new during a before insert trigger marks that record as failed, blocks the save, and surfaces the error message to the user, which is a supported pattern in before triggers. Option B is not valid here because Trigger.oldMap is only populated for update and delete events, so in a before insert trigger it is null and accessing it throws a runtime exception.

Option C is not allowed because Apex triggers cannot make synchronous HTTP callouts directly; callouts must be asynchronous (e.g., via @future or Queueable) or handled after the transaction. Option D is not allowed because performing an explicit update DML on records already in Trigger.new causes a runtime exception (a record in Trigger.new cannot be updated with DML in a before trigger).

50
MCQeasy

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

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

The `@InvocableMethod` annotation specifically satisfies the constraint to invoke custom Apex logic directly from a Salesforce Flow. By applying this annotation to a public static method, administrators expose the Apex code as a native action available within Flow Builder. This mechanism accepts parameters and returns results in a format compatible with Flow variables, bridging the gap between declarative automation and imperative Apex code execution.

Why this answer

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

51
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

During the Salesforce order of execution, database validation rules fire strictly after all before triggers on the same object have completed execution. This sequence ensures that any data modifications, field normalisations, or default values assigned programmatically within before triggers are fully established before the platform evaluates data integrity constraints and field-level validation criteria. Consequently, validation rules assess the final state of the record as shaped by all prior automated context updates.

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.

52
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

Moving the SOQL query outside the loop and querying once with a Set of collected IDs replaces 200 individual queries with a single query, staying within the 100 SOQL query governor limit and avoiding the limit exception during the bulk data load.

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.

53
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 the `Database.executeBatch()` method within `Test.startTest()` and `Test.stopTest()` satisfies the execution constraint required for asynchronous processing in Salesforce unit tests. The asynchronous execution queue is paused when `Test.startTest()` is invoked and then flushed entirely when `Test.stopTest()` is reached. This mechanism forces the Batch Apex job to execute synchronously within the test context, ensuring that all asynchronous code finishes running and database changes are fully committed before subsequent assertion statements evaluate the results.

Why this answer

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

54
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 programmatic control that directly satisfies the requirement for complex algorithmic logic, advanced error handling, and reusable utility classes when Flow Builder hits its declarative limits. By writing custom code using object-oriented principles, developers can implement intricate data manipulations, comprehensive try-catch blocks for exception management, and maintainable helper libraries that cannot be efficiently achieved through visual canvas elements alone.

Why this answer

Option A is correct because Apex is the programmatic choice for complex algorithmic logic, advanced error handling (try/catch, custom exceptions, savepoints), and reusable utility classes that can be invoked across triggers, classes, and even Flows via @InvocableMethod. Option B is correct because Flow Builder is declarative, so administrators can build and modify record-triggered, screen, and scheduled flows quickly without code, improving maintainability and reducing dependency on developers. Option C is wrong because Flows can absolutely call subflows and invocable Apex actions.

Option D is wrong because Apex triggers are not universally slower than record-triggered flows; performance depends on implementation, and Apex is often faster for bulk and complex operations. Option E is wrong because large nightly asynchronous batch processing is a classic Apex use case (Batch Apex, Queueable, Schedulable), not a Flow Builder requirement.

55
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

Loading attachments into collections consumes heap, and synchronous transactions cap heap at 6 MB. Once that ceiling is breached, Salesforce throws a governor limit exception, so this action genuinely triggers one. The constraint satisfied is the synchronous heap size limit, distinguishing it from CPU time or SOQL query limits.

Why this answer

Option B is correct because Apex enforces a 6 MB synchronous heap limit, and loading large attachments or bulky data into collections can exceed that heap size and throw a LimitException. Option C is correct because performing DML inside a loop issues one DML statement per record, quickly breaching the 150 DML statement synchronous governor limit. Option E is correct because a SOQL query inside a loop over Trigger.new executes one query per record, exceeding the 100 synchronous SOQL query limit.

Option A is not a governor-limit violation: calling a future method from a scheduled Apex execute method is allowed (scheduled Apex can call future methods), and it does not itself cause a limit exception. Option D is not a limit issue: Trigger.old is simply null/unavailable in an insert trigger, which is a runtime behavior rather than a governor limit exception.

56
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

Salesforce enforces a strict platform limit that allows a maximum of 100 asynchronous batch jobs to be queued or active concurrently in the Flex Queue. Any batch jobs submitted beyond this threshold remain in a "Holding" status until running jobs complete or are aborted, ensuring system stability and fair resource allocation across multi-tenant architecture. Option D directly satisfies this specific architectural constraint regarding simultaneous batch execution capacity.

Why this answer

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

57
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

Performing DML operations inside loops consumes individual database transactions that quickly exhaust Salesforce governor limits for total DML statements allowed per execution context. Collecting modified records in a collection and executing a single DML statement on that list satisfies the bulkification best practice stated in the stem, ensuring that all database interactions are consolidated into one transaction. This approach respects platform resource boundaries by keeping the DML count to one, regardless of the number of related records processed.

Why this answer

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

58
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

Implementing the `Schedulable` interface directly satisfies the requirement to run an Apex class daily by exposing the `execute(SchedulableContext sc)` method, which is the exact entry point required by the Salesforce platform scheduler. By encapsulating the logic within a class that adopts this interface, developers can leverage `System.schedule` or the user interface to register the job with a CRON expression, thereby automating recurring execution without manual intervention.

Why this answer

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

59
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

Queueable Apex provides an `System.enqueueJob` method that returns an `ID` corresponding to the `AsyncApexJob` record. This identifier allows developers to query system tables programmatically or track execution status via the Salesforce user interface, fulfilling the requirement for progress monitoring. In contrast, future methods return `void`, offering no direct handle or programmatic way to check whether the asynchronous execution has completed, failed, or is currently pending.

Why this answer

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

60
MCQeasy

A developer needs to ensure that a validation rule on the Opportunity object fires only when the Stage is 'Closed Won' and the Amount is less than 1000. Which formula should be used in the validation rule's error condition?

A.AND(ISPICKVAL(StageName, "Closed Won"), Amount < 1000)
B.AND(StageName = "Closed Won", Amount < 1000)
C.OR(ISPICKVAL(StageName, "Closed Won"), Amount < 1000)
D.IF(ISPICKVAL(StageName, "Closed Won"), Amount < 1000, false)
AnswerA

This formula correctly combines two conditions with AND: the StageName picklist equals 'Closed Won' and the Amount is less than 1000. Validation rules trigger an error when the formula evaluates to true. Using ISPICKVAL for the picklist and a numeric comparison for Amount is the standard approach for this requirement, making this the correct condition.

Why this answer

Validation rules fire when their formula evaluates to true. The requirement specifies two conditions that must both be met: the stage must be 'Closed Won' and the amount must be less than 1000. The AND function with ISPICKVAL for the picklist and a numeric comparison for the amount accurately expresses this logic, ensuring the rule only triggers in the intended scenario.

Exam trap

The trap here is using OR instead of AND, which would make the rule fire too broadly, or comparing a picklist directly to text instead of using ISPICKVAL.

61
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

Schedulable Apex is specifically designed to satisfy the requirement for periodic execution, allowing developers to schedule classes to run at specific intervals using cron expressions. This mechanism enables automated batch processing and routine system maintenance without manual intervention. While Batchable Apex handles the heavy data processing, the Schedulable interface provides the necessary trigger mechanism to kick off these long-running operations on a recurring schedule, directly fulfilling the periodic execution constraint specified in the stem.

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.

62
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

Future methods accept only primitives or collections of primitives, so passing an Opportunity requires sending its ID and re-querying inside the method. That extra SOQL consumes governor limits and risks stale data, directly constraining the after-update trigger design where the sObject is already in scope.

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.

63
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

Apex classes do not implement a specific interface to integrate with the InvocableAction framework; instead, they rely on the `@InvocableMethod` annotation applied to a static method. This directly satisfies the stem's requirement by exposing the Apex logic as a callable action within Salesforce Flows, allowing the platform to dynamically generate input and output variables without requiring structural inheritance or interface implementation contracts.

Why this answer

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

64
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

Annotating the method with @future(callout=true) permits asynchronous HTTP callouts, which synchronous Apex triggers cannot perform directly. Invoking it from an after trigger satisfies the real-time requirement by dispatching the callout immediately upon record commit, bypassing the "uncommitted work pending" restriction that blocks callouts in the same transaction.

Why this answer

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

65
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

Queueable Apex runs in a transaction where callouts are blocked by default, so Database.AllowsCallouts must be added to the class signature to permit the HTTP callout. This satisfies the requirement to make a callout and then perform DML within the same queued job.

Why this answer

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

66
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

A static boolean flag in a helper class is set true on first entry and checked before the trigger body runs, so subsequent Contact DML no longer re-enters the Account trigger logic. This halts the recursive cascade within the same transaction, preventing the Maximum trigger depth exception.

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.

67
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

Trigger.isAfter and Trigger.isInsert are context variables evaluated at runtime. Combining them with AND restricts execution to the after insert event only, preventing the trigger body from running during before insert, after update or other contexts.

Why this answer

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

68
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

The Apex Jobs page in the Salesforce Setup menu provides a centralised queue interface that directly satisfies the requirement to monitor asynchronous Apex jobs. Administrators and developers can use this native tool to view the real-time status, execution time, method names, and error details of scheduled jobs, batch apex, future methods, and queueable apex. It tracks job lifecycles through states like Queued, Processing, Completed, and Failed, enabling rapid troubleshooting and operational oversight without requiring custom code or external logging infrastructure.

Why this answer

Setup > Apex Jobs (option C) is correct because this Salesforce setup page lists asynchronous Apex jobs—such as Batch Apex, Queueable, future methods, and scheduled jobs—along with their status, submitted time, and completion details, making it a primary monitoring tool. Querying the AsyncApexJob object (option D) is correct because it exposes the same job records via SOQL/SOQL-based tooling, allowing developers to filter by Status, JobType, CreatedDate, and other fields for programmatic or custom monitoring. Option A (Setup > Security) is incorrect because it covers security policies like password and session settings, not job monitoring.

Option B (Setup > Debug Logs) is incorrect because debug logs capture execution details for troubleshooting, not the overall status of asynchronous jobs. Option E (Setup > Flows) is incorrect because it manages Flow automation, not Apex asynchronous job execution.

Exam trap

The trap here is confusing Debug Logs (transient, per-user execution traces) with Apex Jobs (persistent job status records)—candidates often pick Debug Logs thinking it 'monitors' async work, but it does not aggregate job outcomes.

69
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

Triggers fire once per DML operation with up to 200 records, so iterating and querying per record exhausts governor limits. Processing Trigger.new collections and issuing bulk SOQL satisfies the bulkification constraint by keeping query and DML counts constant regardless of record volume.

Why this answer

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

70
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

Custom object saves initiate the execution of before triggers immediately prior to the evaluation of custom validation rules. This precise sequencing ensures that Apex code can programmatically populate or modify field values before data integrity checks are enforced by the platform. Because before triggers execute first, any field updates made within the trigger logic are included in the subsequent validation rule evaluation, satisfying the exact chronological requirement defined in the Salesforce save order of execution.

Why this answer

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

71
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

Standard user interface controllers execute synchronously within the request-response lifecycle, which strictly prohibits synchronous web service callouts to external REST APIs. Adding the `@future(callout=true)` annotation defers the Apex method execution to a separate asynchronous background thread managed by Salesforce. This specific parameter explicitly overrides the default restriction that blocks callouts from asynchronous contexts, thereby satisfying the platform constraint for integrating external endpoints from standard UI interactions without freezing the user interface.

Why this answer

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

72
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

Asynchronous Apex processes transactions independently from the triggering request, directly satisfying the governor limit isolation constraint mentioned in the stem. By decoupling execution into a separate thread, Salesforce allocates a fresh set of system resources and governance boundaries—such as separate SOQL query limits, DML statements, and CPU time—ensuring that long-running or resource-heavy background processes do not exhaust the synchronous transaction limits of the originating user request.

Why this answer

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

73
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 in a utility class persists for the transaction, letting the trigger skip re-entry when child updates fire it again. This satisfies the requirement to prevent recursive trigger execution during ripple updates.

Why this answer

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

74
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

Querying inside a loop easily breaches the synchronous governor limit of 100 SOQL queries per transaction. Storing query results in maps and collections allows developers to fetch all required data in a single aggregate query upfront, satisfying the core constraint of reducing query execution frequency. Subsequent lookups are then performed entirely in-memory against the collection rather than hitting the database repeatedly, drastically lowering resource consumption and preventing limits from being exceeded.

Why this answer

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

75
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 enforces a strict platform governor limit of 100 simultaneously active scheduled Apex jobs per organisation, which directly satisfies the scheduling constraint mentioned in the stem. When a developer programs a Schedulable class for daily execution using `System.schedule`, the resulting job enters the Apex queue and consumes one of these allocated slots. Attempting to schedule an excess job beyond this threshold throws a runtime exception, meaning administrators and developers must monitor active schedules to ensure daily automated routines remain within this capacity.

Why this answer

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

Page 1 of 2 · 103 questions totalNext →

Ready to test yourself?

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