A developer wrote Apex code that calls out to an external system using REST API.
How should a developer write the test to prove the code is working as intended?
Answer : A
To test Apex code that makes HTTP callouts, Salesforce provides theHTTPCalloutMockinterface. Developers create a test class that implementsHTTPCalloutMockto define the fake response that will be returned when the callout is executed during the test.
This ensures that tests do not depend on the availability or behavior of the external system.
Why not other options?
BandC: These are not relevant for testing HTTP callouts.
D: There is no concept of extendingHTTPCalloutMock. It is implemented, not extended.
:
Apex Testing for HTTP Callouts
A company has a custom object, order __c, that has a required, unique external ID field called order Number__c.
Which statement should be used to perform the DML necessary to insert new records and update existing records in a list of Order __c records
using the external ID field?
Answer : D
Whyupsert?
Theupsertstatement inserts records that don't exist and updates existing records based on the external ID (Order Number__cin this case).
Salesforce automatically recognizes and uses the external ID field for matching.
Why Not Other Options?
A and B:mergeis for merging records, not for upserting.
C: Adding the field name afterupsertis unnecessary, as Salesforce detects the external ID automatically.
Universal Containers has a support process that allows users to request support from its engineering team using a custom object,
Engineering Support c.
Users should be able to associate multiple Engineering Support __c records to a single Opportunity record. Additionally, aggregate information
about the Engineering Support _c records should be shown on the Opportunity record.
Which relationship field should be implemented to support these requirements?
Answer : B
A master-detail relationship fromEngineering_Support__ctoOpportunityallows multiple childEngineering_Support__crecords to be associated with a single parentOpportunity. It also enables roll-up summary fields to aggregate data from the child records onto the parentOpportunity.
Incorrect Options:
A & D:Lookup relationships do not support roll-up summary fields.
C:Master-detail cannot go in the opposite direction (Opportunity to Engineering_Support__c) for this use case.
Universal Containers (UC) wants to lower its shipping cost while making the shipping process more efficient. The Distribution Officer advises UC to implement global addresses to allow multiple Accounts to share a default pickup address. The developer is tasked to create the supporting object and relationship for this business requirement and uses the Setup Menu to create a custom object called "Global Address".
Which field should the developer add to create the most efficient model that supports the business need?
Answer : C
Why Lookup on Account to Global Address?
An Account can reference a single default Global Address via a lookup field, allowing multiple Accounts to share the same address.
This is more efficient than the reverse (lookup on Global Address to Account), as Global Address is the parent in this relationship.
Avoiding Master-Detail:
Lookup relationships provide flexibility in this use case since Accounts and Global Addresses have independent lifecycles.
Example:Create a custom lookup field on Account referencing the Global Address object.
Which three data types can a SOQL query return?
Choose 3 answers
Answer : A, C, E
sObject:SOQL queries can return single or multiple records assObjectinstances.
List:SOQL queries often return results as aListofsObject.
Double:SOQL aggregate queries can return numeric data types likeDouble(e.g., COUNT, SUM).
Incorrect Options:
B (Long):SOQL does not directly returnLongvalues.
D (Integer):Aggregate results useDouble, notInteger
What are two benefits of using declarative customizations over code?
Choose 2 answer
Answer : A, D
Declarative customizations, such as workflows, process builder, validation rules, and flows, offer a no-code approach to customizing Salesforce. Below are the key benefits:
Declarative customizations automatically update with each Salesforce release (A):Salesforce ensures that declarative tools are automatically updated during new releases, eliminating the need for manual intervention or code refactoring.
Declarative customizations generally require less maintenance (D):Because declarative tools use configurations rather than custom code, they are simpler tomanage, troubleshoot, and update. This significantly reduces the maintenance overhead compared to custom code.
Incorrect Options:
B:Declarative tools do not automatically generate test classes. This is specific to Apex code.
C:Declarative customizations can still result in runtime errors, such as invalid field updates or logic conflicts.
What is the value of the Trigger.old context variable in a before insert trigger?
Answer : C
Trigger.old in a before insert trigger:
TheTrigger.oldcontext variable contains the old version of the records being processed in the trigger.
In abefore inserttrigger, the records being processed are new and have no prior state in the database, soTrigger.oldisnull.
This behavior is specific to insert triggers because there is no 'old' record to reference before the record is created.
Why is it null?
The Trigger.old variable is only populated for triggers that handle updates or deletions (e.g., before update, after update, before delete, after delete). For insert operations, no previous state of the record exists.
Why not the other options?
A . An empty list of sObjects:
This is incorrect because Trigger.old is not initialized as an empty list for insert triggers---it is simply null.
B . Undefined:
Trigger.old is defined in the trigger context, but it is null for insert operations. Undefined is not a valid Apex state.
D . A list of newly created sObjects without IDs:
This describes Trigger.new in abefore inserttrigger, not Trigger.old. Trigger.new contains the new records being inserted.
Apex Triggers Documentation
Trigger Context Variables