Practice Free Plat-Dev-201 Exam Online Questions
Which scenario is valid for execution by unit tests?
- A . Execute anonymous Apex as a different user.
- B . Generate a Visualforce PDF with getcontentaAsPDF ().
- C . Load data from a remote site with a callout.
- D . Set the created date of a record using a system method.
B
Explanation:
Unit Test Scenarios:
Option Bis valid becausegetContentAsPDF () can generate PDF content for testing purposes.
Why Not Other Options?
A: Unit tests cannot execute anonymous Apex as a different user.
C: Unit tests cannot perform callouts unless mock responses are provided.
D: TheSystem.createdDatefield cannot be set manually in unit tests.
Reference: Testing Best Practices: https: //developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm
Consider the following code snippet for a Visualforce page that is launched using a Custom Button on the Account detail page layout.

When the Save button is pressed the developer must perform a complex validation that involves multiple objects and, upon success, redirect the user to another Visualforce page.
What can the developer use to meet this business requirement?
- A . Apex
- B . trigger
- C . Controller
- D . extension
C
Explanation:
Why Controller?
A customcontrollerallows:
Complex validation involving multiple objects.
Redirection to another Visualforce page upon success.
Controllers can implement custom save logic and redirect usingPageReference.
Why Not Other Options?
A developer created a new after insert trigger on the Lead object that creates Task records for each Lead.
After deploying to production, an existing outside integration that inserts Lead records in batches to Salesforce is occasionally reporting total batch failures being caused by the Task insert statement. This causes the integration process in the outside system to stop, requiring a manual restart.
Which change should the developer make to allow the integration to continue when some records in a batch cause failures due to the Task
insert statement, so that manual restarts are not needed?
- A . Use the Database method with allow one set to false.
- B . Deactivate the trigger before the integration runs.
- C . Remove the Apex class from the integration user’s profile.
- D . Use a try-catch block after the insert statement.
D
Explanation:
A try-catch block allows the batch to continue processing even if some records cause errors. Errors can be logged for review, ensuring the integration process does not stop entirely.
Reference: Error Handling in Apex
Incorrect Options:
A: Database.insertwithallowPartialwould be required for partial processing but is not mentioned.
B: Deactivating the trigger disrupts other processes.
C: Removing Apex classes is unrelated.
A developer created a trigger on a custom object. This custom object also has some dependent pick lists.
According to the order of execution rules, which step happens first?
- A . The original record is loaded from the database.
- B . System validation is run for maximum field lengths.
- C . Old values are overwritten with the new record values.
- D . JavaScript validation is run in the browser,
A
Explanation:
Order of Execution Rules:
Step 1: Original record is loaded from the database.
Step 2: Field-level validations are performed, including maximum field lengths.
Step 3: Old values are overwritten with new record values.
Step 4: JavaScript validation runs in the browser.
Reference: Order of Execution Rules: https: //developer.salesforce.com/docs/atlas.en-us.238.0.salesforce_appdevelopment.meta/salesforce_appdevelopment/apex_triggers_order_of_ex ecution.htm
A developer is designing a new application on the Salesforce platform and wants to ensure it can support multiple tenants effectively.
Which design framework should the developer consider to ensure scalability and maintainability?
- A . Waterfall Model
- B . Flux (view, action, dispatcher, and store)
- C . Model-View-Controller (MVC)
- D . Agile Development
C
Explanation:
MVC: The Model-View-Controller design pattern is ideal for Salesforce development as it separates the business logic (model), user interface (view), and controller logic, ensuring scalability and maintainability.
Salesforce’s architecture inherently supports MVC, with sObjects as the model, Visualforce or Lightning components as the view, and Apex controllers as the controller.
Why not other options?
A: The Waterfall model is a development methodology, not a design framework.
B: Flux is a front-end application architecture and not relevant to Salesforce.
D: Agile is a development methodology, not a design framework.
Salesforce MVC Architecture
A developer is tasked with building a custom Lightning Web Component (LWC) to
collectContactinformation. The form will be shared among different types of users in the org. There are security requirements stating that only certain fields should beeditable and visibleto certain groups of users.
What should the developer use in their Lightning Web Component to support the security requirements?
- A . lightning-input-field
- B . force: inputField
- C . aura: input
- D . ui: inputField
A
Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
A (Correct): lightning-input-field is part ofLightning Data Service (LDS), and itautomatically enforces field-level security (FLS) and CRUD rules. This is thebest practicefor handling sensitive data in LWC forms and ensures compliance with user-level permissions.
Incorrect options:
B: force: inputField is used inAura, not in Lightning Web Components.
C/D: These are deprecated or older framework components that donotinherently enforce FLS.
Reference: LWC Developer Guide C lightning-input-field
This topic relates toUser Interface (25%) andsecurity in LWC development, a key concept in the PD1 exam.
A developer is alerted to an issue with a custom Apex trigger that is causing records to be duplicated.
What is the most appropriate debugging approach to troubleshoot the issue?
- A . Review the Historical Event logs to identify the source of the issue.
- B . Add system.debug statements to the code to track the execution flow and identify the issue.
- C . Use the Apex Interactive Debugger to step through the code and identify the issue.
- D . Disable the trigger in production and test to see if the issue still occurs.
C
Explanation:
The Apex Interactive Debugger allows developers to step through code execution in real time, which is the most effective way to identify the root cause of the duplication issue.
Reference: Apex Debugging Tools
Incorrect Options:
A: Historical event logs are not specific enough for debugging triggers.
B: system.debugcan help but is less efficient than an interactive debugger.
D: Disabling the trigger disrupts the system and prevents further testing.
A developer needs to make a custom Lightning Web Component available in the Salesforce Classic user interface Which approach can be used to accomplish this?
- A . Embed the Lightning Web Component is a Visualforce Component and add directly to the page layout.
- B . Use the Lightning Out JavaScript library to embed the Lightning Web Component in a Visualforce page and add to the page layout.
- C . Use a Visualforce page with a custom controller to invoke the Lightning Web Component using a call to an Apex method.
- D . Wrap the Lightning Web Component in an Aura Component and surface the Aura Component as a Visualforce tab.
B
Explanation:
The Lightning Out library allows a Lightning Web Component to be embedded in a Visualforce page.
This approach is the most suitable to make the LWC accessible in Salesforce Classic.
Reference: Lightning Out Documentation
An org has an existing flow that edits an Opportunity with an Update Records element. A developer must update the flow to also create a Contact and store the created Contact’s ID on the Opportunity.
Which update must the developer make in the flow?
- A . Add a new Update Records element.
- B . Add a new Roll Back Records element.
- C . Add a new Create Records element.
- D . Add a new Get Records element.
C
Explanation:
Why Create Records Element?
The Create Records element adds the functionality to create a Contact record.
The Contact’s ID can then be stored on the Opportunity using a variable or field update.
Why Not Other Options?
A: Update Recordsis for updating existing records, not creating new ones.
B: Roll Back Recordsis used for rolling back transactions, not for creating records.
D: Get Recordsretrieves records but does not create them.
Reference: Flow Builder: https: //help.salesforce.com/s/articleView?id=sf.flow_build.htm
What should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contacts that have the company name "Universal Containers?
- A . FIND ‘Universal Conteiners’ IN CompenyName Fields RETURNING leadjid, name), sccount (ad, name}, conteact (id, name)
- B . SELECT Lead.id, Lead.Neme, Account,Id, Account.Neme, Contact.id, Contact.Neame FROM Lead, Account, Contact WHERE CompanyName = "Universal Containers*
- C . PIND ‘Universal Centainers’ IN Name Fields RETURNING lead (id, name), saceount (id, mame), contact (id, name)
- D . SELECT lead (id, name), account (id, name}, contact (id, name) FROM Lead, Account, Contact WHERE Name = "Universal Containers’
A
Explanation:
Option A: This is the correct syntax for SOSL to retrieve data across multiple objects. It searches for "Universal Containers" in theCompanyNamefields and returns the specified fields forLead,Account, andContact.
Other Options:
Option BandD: These are invalid SOQL statements since SOQL does not support multi-object queries. Option C: Namefields are not relevant to the search term "CompanyName." : SOSL Syntax
