Exam Information
Free practice questions with explanations
Salesforce DEX-450 Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 13
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Apex Class Essentials
A team is building a reusable utility class that formats phone numbers. The class is called from a Visualforce page, from Apex triggers, and from a Lightning Web Component through an @AuraEnabled method. The class must not expose its helper methods outside the package namespace, and the team wants the class to remain callable from other Apex in the same org without declaring it global. Which access modifier should the utility class and its public helper methods use?
Correct Answer: DExplanationPublic Apex classes and methods are visible to all Apex within the same namespace, which satisfies the requirement that other Apex in the org can call the utility without exposing it outside the package. Global would expose it to other namespaces and packages, violating the constraint. Private classes are not valid at the top level in this context and protected is only meaningful for inner classes, so that option cannot be used for a top-level utility. Making only the class public while hiding the helpers would prevent the Lightning Web Component and triggers from reaching the formatting methods they need.
-
2 Question 2 Single choice Apex Coding
A developer writes a loop that processes a List of Account records retrieved from SOQL. Inside the loop, the developer calls a method that performs a SOQL query for each Account to fetch related Contact counts. The org processes nightly batches of 40,000 Accounts through a Batchable class with a scope of 200. Testing shows the batch frequently fails with a Too many SOQL queries error. Which change best resolves the problem while keeping the logic intact?
Correct Answer: DExplanationIssuing a SOQL query per record inside a loop consumes one query per iteration, so bulkifying by collecting AccountIds and running one aggregate query against Contact (grouped by AccountId) keeps the query count constant per chunk. Reducing batch scope lowers the records per execution but still queries per record, so it only delays the failure. Changing to a while loop over a Map does not change the per-iteration query behaviour. Calling a future method per Account is worse, since future methods have their own per-transaction limits and would quickly exceed the 50 future call cap.
-
3 Question 3 Single choice Apex Testing
A Salesforce developer must deploy a trigger to production. The org has a strict requirement that deployment succeeds with at least 75% Apex code coverage, and the team wants tests that do not depend on existing org data because sandbox refreshes wipe records. A test class currently uses SeeAllData=true to read Account records created by an administrator. Which change should the developer make first to meet the requirements?
Correct Answer: CExplanationTests should create their own records so they do not depend on org data that may be absent after a sandbox refresh, and removing SeeAllData while inserting records in the test method accomplishes that directly. Setting SeeAllData to false still leaves the test without the records it expects, since the default is to see no org data. Adding Test.isRunningTest checks into the trigger is poor practice because it alters production code paths and does not validate real behaviour. System.runAs changes the running user context but still reads org data, so it does not address the dependency.
-
4 Question 4 Single choice Apex Trigger Design Strategies
An order management org has a before-save requirement: when an Opportunity is closed won, the Amount must be copied to a custom currency field on the related Account, and the org already has a Flow that sets a default Discount__c value on Opportunity creation. The architect wants to minimise custom Apex while keeping the logic maintainable by administrators. Which approach best meets the requirement while improving the existing pro-code solution?
Correct Answer: BExplanationRecord-Triggered Flows can perform declarative field updates and related record updates without custom code, which fits the administrator-maintainable requirement, while retaining Apex only where it adds value. Writing an Apex trigger for every update event adds unnecessary code and risk, and replacing the existing Flow with Apex removes a no-code solution that already works. A scheduled hourly job does not meet the close-time copy requirement and introduces latency and reconciliation problems.
-
5 Question 5 Single choice Apex Trigger Essentials
A developer writes an after insert trigger on Contact that needs to update a related Account field. The trigger uses Trigger.new to access the inserted records. A colleague claims the trigger can also change the field values of the Contact records directly in the after context and that the change will be saved without a DML statement. Which statement correctly describes trigger context behaviour in this situation?
Correct Answer: CExplanationIn after triggers, the records in Trigger.new are read-only, so assigning values to their fields throws an error, and any change to a Contact requires an explicit DML operation such as update. The colleague's claim that changes are saved automatically is incorrect, because only before triggers can modify Trigger.new fields without DML. Trigger.old is not populated for insert operations, so pointing to it is wrong. Declaring a before trigger would change the timing, but the question concerns the after context as written.
-
6 Question 6 Multiple choice Apex Trigger Essentials
A developer is designing a trigger on the Case object that must run logic only when the Priority field changes on update. Which two statements about trigger context variables and their use are correct? (Choose two.)
Correct Answer: C, DExplanationTrigger.oldMap and Trigger.newMap are both available in update contexts, which enables field-change detection by comparing old and new values for each record ID, and Trigger.size reports the count of records in the current invocation, useful for bulk checks. Trigger.isUpdate is true in both before and after update contexts, not only before. Trigger.newMap is available in insert contexts in after insert and before insert. Trigger.oldMap is null for insert because no old record exists, so the claim about defaults is wrong.
-
7 Question 7 Order list Apex Transactions
A developer needs to log a custom error from an Apex trigger without losing the log when the surrounding transaction rolls back due to a validation failure. The team decides to publish a platform event from the trigger. Place the following steps in the correct order to implement error logging with platform events so the logging survives a rollback. Drag the steps into the correct order.
Drag the steps into the correct order, or use the arrows.
- Catch the DML exception in the originating code and build the event payload
- Define a platform event with fields for the error message and record identifier
- Subscribe an Apex trigger to the platform event object and insert a custom log record from it
- Publish the platform event from the originating trigger using EventBus.publish
- Commit the original transaction and allow the event subscriber to run asynchronously
Correct Answer:- Define a platform event with fields for the error message and record identifier
- Catch the DML exception in the originating code and build the event payload
- Publish the platform event from the originating trigger using EventBus.publish
- Commit the original transaction and allow the event subscriber to run asynchronously
- Subscribe an Apex trigger to the platform event object and insert a custom log record from it
ExplanationThe platform event must be defined first so there is a schema to populate, then the exception is caught and the payload built, then the event is published with EventBus.publish, and the original transaction commits or rolls back independently. The subscriber trigger then runs asynchronously after commit to insert the log record. Publishing before the payload is built or before the definition exists is impossible. Placing the subscriber step before the commit ignores that subscribers run after publishing commits, which is why logs survive rollbacks.
-
8 Question 8 Single choice Org Data Manipulation Using DML
A developer is choosing DML methods for different scenarios in an integration. Match each requirement to the most appropriate DML approach.
1. Insert a batch of Lead records, continue saving valid rows, and return per-row errors without throwing an exception
2. Update Account records in a single statement where any single failure should roll back the whole operation
3. Insert Contact records and make the operation respect the sharing rules of the running userCorrect Answer: BExplanationDatabase.insert with allOrNone set to false saves valid rows and returns SaveResult objects with errors for failed rows, which fits the partial-success requirement. A standard update statement or Database.update with allOrNone true rolls back the whole operation on any failure, so the single-statement requirement is best matched by Database.update(accounts, true). Running insert under the default context respects the running user's sharing unless the class is declared without sharing, so that option aligns with requirement three. Plain insert or update statements throw exceptions on failure rather than returning row-level results, and System.runAs is a testing utility, not a sharing control.
-
9 Question 9 Single choice Org Data Retrieval Using SOQL & SOSL
A reporting Apex class must return the Account Name and the Names of all Contacts for each Account in a single query. The developer writes a parent-to-child relationship query that works in the Developer Console. However, when the class is run for a user with read access to Account but no read access to Contact, the developer wants the query to fail gracefully and still return Accounts. Which statement is accurate about the behaviour of parent-to-child SOQL queries in this scenario?
Correct Answer: AExplanationRelationship subqueries respect field-level and object-level security as well as sharing for the running user, and inaccessible child records simply do not appear in the subquery results while parent records still return. The entire query failing would require an explicit permission check on the parent object, which is not the default behaviour. Child-to-parent relationship names are used in dot notation, not in subqueries, so that claim is wrong. Apex code runs in system mode only when declared without sharing, not because of the query alone, and object permissions are still enforced for user-mode queries.
-
10 Question 10 Dropdown Org Data Retrieval Using SOQL & SOSL
Choose the correct value for each blank.
Choose the correct value for each blank.
A developer must build a dynamic query at run time where the object name and a filter field are supplied by a user through a Lightning Web Component. The developer writes a query string using string concatenation and runs it with Database.query. To reduce injection risk and enforce field-level security, the developer should use the bind variable syntax with a colon prefix inside the string and call on the sObject describe result for each field, while the query result should be captured in a variable of type .Correct Answer:A developer must build a dynamic query at run time where the object name and a filter field are supplied by a user through a Lightning Web Component. The developer writes a query string using string concatenation and runs it with Database.query. To reduce injection risk and enforce field-level security, the developer should use the bind variable syntax with a colon prefix inside the string and call isAccessible() on the sObject describe result for each field, while the query result should be captured in a variable of type List.
ExplanationField accessibility is checked with isAccessible on the field describe result, which is the correct check for read permission in dynamic queries, and Database.query returns a List of sObject that must be cast or handled as a generic list. isCreateable is a write check and does not govern query visibility, and Map assumes a specific sObject type that is not known at run time. getReferenceTo returns the related object for a lookup field, not an access check, and returning List would not match the sObject records a query produces.
-
11 Question 11 Single choice User Interface Development
A developer builds a Lightning Web Component that displays Account records on a Lightning record page. The component uses an @wire adapter to retrieve a list of Contacts for the record ID. The team now needs a child component to notify its parent that a Contact has been selected, so the parent can refresh a details panel. The parent and child are in the same DOM hierarchy and the child is a direct child in the template. Which mechanism is the correct choice for passing this notification upward?
Correct Answer: AExplanationLightning Web Components communicate upward through custom events dispatched with this.dispatchEvent, and the parent handles them in its template, with bubbles and composed options needed when the event must cross shadow boundaries. Directly assigning a parent property from a child breaks the unidirectional data flow expected by the framework. A window-level listener couples components to global state and is not recommended for parent-child communication. Querying the document from the child reaches across shadow DOM and fails because LWC encapsulates its template.
-
12 Question 12 Single choice Deployment
A company uses change sets to move customizations from a sandbox to production. The release includes an Apex class that is referenced by a Lightning Web Component. During validation, the deployment fails because the Apex class has insufficient test coverage. The release is due in two hours, and the administrator wants to avoid redeploying the entire package. Which action should the team take to move forward without weakening the coverage requirement?
Correct Answer: BExplanationChange sets require the Apex classes and their tests to meet production deployment rules, and adding a test class that achieves the coverage threshold is the legitimate way to satisfy validation within the same change set. The 75% requirement cannot be lowered in org settings, and artificial coverage tricks using Test.isRunningTest are not real coverage. Removing the Apex class leaves the Lightning Web Component depending on a missing class, which breaks the release and violates the dependency.
-
13 Question 13 Single choice Order of Execution, Apex Transactions, & Platform Events
A Salesforce org has a before-save Flow on Account, a before trigger on Account, a validation rule, and an after trigger that updates related Contacts. An administrator notices that an automation that sets a field on Account runs twice and a validation rule fires unexpectedly after a field change from the trigger. The team must determine the correct sequence to troubleshoot. Which statement correctly describes the order of execution during a record save?
Correct Answer: BExplanationDuring a save, before-triggers and before-save Flows execute before system validation, and then custom validation rules run, which explains why a field set in the before phase can trigger validation later. After-triggers execute after the record is saved to the database within the transaction, not before. Workflow field updates can re-fire before-triggers and validation, so claiming they never re-trigger validation is incorrect. Placing custom validation before before-triggers reverses the actual sequence.
These are 13 of the 201 questions in the full DEX-450 pack.
Get All 201 QuestionsGet all 201 questions & answers
Full access options for Salesforce DEX-450
Self-study
PDF Version
- 201 actual exam questions
- Compatible with all devices
- Printable PDF format
- No download limits
- 90 days free updates
- 24/7 customer support
Best value
Bundle Pack
- Discounted PDF + online access
- 201 actual exam questions
- Both PDF and online practice test
- Free 90 days updates
- No download or practice limits
- 24/7 customer support
Exam simulation
Online Practice Test
- 201 actual exam questions
- Actual exam environment
- 90 days free updates
- Browser-based software
- 24/7 customer support
100% Money Back Guarantee
Your success comes first
At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the DEX-450 Exam (Build Applications Programmatically on the Salesforce Platform) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.