Practice Free Plat-Dev-201 Exam Online Questions
Since Aura application events follow the traditional publish-subscribe model, which method is used to fire an event?
- A . fire ()
- B . SegdetesEvent (}
- C . FireEvent ()
- D . emit ()
A
Explanation:
Option A: Thefire () method is used to publish Aura application events in the traditional publish-subscribe model.
Not Suitable:
Option B: sendEvent () is not a valid method for Aura events.
Option C: FireEvent () does not exist.
Option D: emit () is not part of the Aura event framework.
: Aura Application Events
A software company is using Salesforce to track the companies they sell their software to in the Account object. They also use Salesforce to track bugs in their software with a custom object, Bug__c.
As part of a process improvement initiative, they want to be able to report on which companies have reported which bugs. Each company should be able to report multiple bugs and bugs can also be reported by multiple companies.
What is needed to allow this reporting?
- A . Roll-up summary field of Bug_c on Account
- B . Master-detail field on Bug_c to Account
- C . Lookup field on Bug_c to Account
- D . Function object between Bug__c and Account
D
Explanation:
Many-to-Many Relationship:
To track which companies (Accounts) report which bugs and allow multiple associations for both, ajunction objectis needed.
This junction object will have two master-detail relationships: one toBug__cand one toAccount.
Why Not Other Options?
A developer completed modifications feature that is comprised of two elements:
* Apex trigger
* Trigger handler Apex class
What are two factors that the developer must take into account to properly deploy them to the production environment? Choose 2 answers
- A . Apex classes must have at least 75% code coverage org-wide.
- B . All methods in the test classes must use @istest.
- C . At least one line of code must be executed for the Apex trigger.
- D . Test methods must be declared with the testMethod keyword.
A,C
Explanation:
75% Code Coverage (A): To deploy Apex code to production, Salesforce requires at least 75% of the code to be covered by tests across the organization.
Reference: Apex Testing Framework
Trigger Coverage (C): Apex triggers must have at least one line of code covered by test execution to deploy.
Reference: Testing Apex Triggers
Incorrect Options:
B: Although@isTestis recommended, it is not mandatory for all methods.
D: ThetestMethodkeyword is outdated and replaced by@isTest.
Which statement generates a list ofLeadsandContactsthat have a field containing the phrase "ACME"?
- A . List<SObject> searchList = [FIND ‘*ACME*’ IN FIELDS RETURNING Contact, Lead];
- B . List<List<SObject>> searchList = [SELECT Name, Id FROM Contact, Lead WHERE Name LIKE ‘%ACME%’];
- C . List<List<SObject>> searchList = [FIND ‘*ACME*’ IN ALL FIELDS RETURNING Contact, Lead];
- D . List<SObject> searchList = [find ‘acme’ in all fields returning Contact, Lead];
C
Explanation:
C (Correct): This is the correctSOSL (Salesforce Object Search Language) syntax. It performs a full-text search across multiple objects and fields.
The format FIND ‘*ACME*’ IN ALL FIELDS RETURNING Contact, Lead is thestandard and
correctapproach for cross-object keyword searches.
Incorrect options:
A: Incorrect syntax; needs ALL FIELDS or NAME FIELDS, and proper result typing.
B: SOQL does not support searching across multiple objects in a single query.
D: Incorrect casing and structure; missing proper list handling.
Reference: Apex Developer Guide C SOSL Syntax
This relates toDeveloper Fundamentals (23%), specificallySOSL vs. SOQL use cases and syntax.
What is the value of the Trigger.old context variable in a before insert trigger?
- A . An empty list of sObjects
- B . Undefined
- C . null
- D . A list of newly created sObjects without IDs
C
Explanation:
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 developer wants to improve runtime performance of Apex calls by caching results on the client.
What is the most efficient way to implement this and follow best practices?
- A . Decorate the server-side method with @AuraEnabled (cacheable=true).
- B . Call the setStorable () method on the action in the JavaScript client-side code.
- C . Decorate the server-side method with @AuraEnabled (storable=true).
- D . Set a cookie in the browser for use upon return to the page.
A
Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
In Lightning Web Components, to cache the results of Apex methods on the client side, the Apex method should be annotated with @AuraEnabled (cacheable=true). This enables the Lightning Data Service to cache the method’s response, improving performance by reducing server calls.
Reference: Lightning Web Components Developer Guide: Cacheable Apex Methods
Provide question feedback here (optional):

Based on this code, what is the value of x?
- A . 4
- B . 1
- C . 2
- D . 3
A
Explanation:
The variableisOKis declared but not initialized, so its value isnull. Theif-elseconditions check for specific values ofisOK (trueorfalse), but since it isnull, none of those conditions are satisfied. The program defaults to theelseblock, assigning4tox.
Reference: Apex Developer Guide: Boolean Data Type
The following code snippet is executed by a Lightning web component in an environment with more than 2,000 lead records:

Which governor limit will likely be exceeded within the Apex transaction?
- A . Total number of SOOL quires issued
- B . Total number of DML statements issued
- C . Total number of records processed as a result of DML statements
C
Explanation:
The provided code attempts to update allLeadrecords in an environment with more than 2,000 records. This will likely exceed the governor limit for the total number of records processed in DML statements, which is 10,000 per transaction. To avoid this, the developer can useDatabase.updatewith batching logic.
Reference: Governor Limits for DML Rows
Universal Containers implemented a private sharing model for the Account object. A custom Account search tool was developed with Apex to help sales representatives find accounts that match multiple criteria they specify. Since its release, users of the tool report they can see Accounts they do not own.
What should the developer use to enforce sharing permissions for the currently logged in user while using the custom search tool?
- A . Use the with sharing keyword on the class declaration.
- B . Use the without sharing keyword on the class declaration.
- C . Use the userInfo Apex class to filter all SOQL queries to returned records owned by the logged-in user.
- D . Use the schema describe calls to determine if the logged-in user has access to the Account object.
A
Explanation:
Thewith sharingkeyword ensures that the Apex class respects the sharing rules of the current user, including private sharing models. This means the logged-in user will only see records they own or have been shared with them.
Reference: Apex Class Sharing Rules
Incorrect Options:
B: without sharingignores sharing rules, exposing data the user does not have access to.
C: Filtering withUserInfois not a scalable or maintainable solution.
D: Schema describe calls do not enforce sharing permissions but only check object-level access.
Management asked for opportunities to be automatically created for accounts with annual revenue greater than $1, 000,000. A developer created the following trigger on the Account object to satisfy this requirement.
for (Account a : Trigger.new) {
if (a.AnnualRevenue > 1000000) {
List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE AccountId = : a.Id];
if (oppList.size () == 0) {
Opportunity oppty = new Opportunity (Name = a.Name, StageName = ‘Prospecting’, CloseDate = System.today ().addDays (30) ) ;
insert oppty;
}
}
}
Users are able to update the account records via the UI and can see an opportunity created for high annual revenue accounts. However, when the administrator tries to upload a list of 179 accounts using Data Loader, it fails with system, Exception errors.
Which two actions should the developer take to fix the code segment shown above? Choose 2. answers
- A . Query for existing opportunities outside the for loop.
- B . Check if all the required fields for Opportunity are being added on creation.
- C . Move the DML that saves opportunities outside the for loop.
- D . Use Database query to query the opportunities.
A,C
Explanation:
This is a classicbulkification problem, covered under"Apex Development Best Practices"in the PD1 guide.
Reference: Apex Developer Guide C Bulk Design Patterns
D (Correct): DML operations (like insert) in a loop can cause theDML 151 limiterror. Moving them outside the loop and collecting records in a list before performing a single DML operation is best practice.Reference: Salesforce Platform Developer I Study Guide C Process Automation and Logic (30%)
