Salesforce certification · Exam Salesforce-Platform-Developer

Salesforce-Platform-Developer Mock Exam Page 4

Salesforce Platform Developer - Plat-Dev-201

Free Salesforce-Platform-Developer mock exam questions 31–40, each with the answer and an explanation.

20 questions · 35 minutes · free, no sign-up

Free Salesforce-Platform-Developer questions

31–40 of 51 free
Question 31 Choose 2
Which two are phases in the Aura application event propagation framework? Choose 2 answers
Show answerHide answer

Correct answer: C, D DefaultBubble

Explanation

Explanation:

In the Aura component framework, when an application event is fired, it goes through two main phases in the event propagation lifecycle:

✔️ C. Default Phase
This is the first phase.
Components that register for the event using handler="APPLICATION" can handle the event.
This phase is where default handlers respond to the event.

✔️ D. Bubble Phase
This is the second phase.
The event bubbles up the component hierarchy.
Components can handle or stop propagation during this phase.

❌ Incorrect Options:

A. Emit
❌ Not a valid phase in Aura’s event framework.
"Emit" is terminology often used in JavaScript event systems, not Aura.

B. Control
❌ Control phase is specific to component events, not application events.
Application events only go through Default and Bubble phases.
Question 32 Choose 1
While What writing an Apex class, a developer warts to make sure thai all functionality being developed Is handled as specified by the requirements. Which approach should the developer use to be sure that the Apex class is working according to specification?
Show answerHide answer

Correct answer: A Create a test class to execute the business logic and run the test in the Developer Console.

Explanation

Explanation:

To ensure that an Apex class works according to the requirements, the best and most reliable approach is to:

✅ Write a test class that includes unit tests for each piece of functionality.

This approach allows the developer to:

Automatically verify that the code behaves as expected
Catch any regressions or logic errors
Achieve code coverage requirements for deployment
Simulate different input and edge cases using System.assert() statements

❌ Why the other options are not sufficient:

B. Include a savepoint and Database.rollback
❌ Useful for managing data changes during testing, but does not validate business logic on its own.

C. Include a try/catch block to the Apex class
❌ Helps with error handling, but does not confirm correctness or validate logic per requirements.

D. Run the code in an Execute Anonymous block in the Developer Console
❌ Useful for manual testing, but:
Not repeatable or automated
Not a good long-term validation strategy
Does not support System.assert() validation
Question 33 Choose 1
A Salesforce Administrator used Flow Builder to create a flow named ‘’accountOnboarding’’. The flow must be used inside an Aura component. Which tag should a developer use to display the flow in the component?
Show answerHide answer

Correct answer: C Lightning:flow

Explanation

Explanation:

To embed a Flow (like accountOnboarding) in an Aura component, the correct tag to use is:


This component is part of the Lightning Base Components and is specifically designed to embed Flow Builder flows in Aura components.

🔍 Example Usage in Aura:

< aura : component > < br > < lightning : flow aura : id = "flow " > < / lightning : flow >


You can then start the flow using JavaScript in the controller:

var flow = component.find("flow");
flow.startFlow("accountOnboarding");

❌ Incorrect Options:

A. lightning-flow
❌ Incorrect syntax — this is used in LWC, not Aura.

B/D. aura:flow / Aura:flow
❌ These are invalid component names — no such tag exists.
Question 34 Choose 1
A developer must create a CreditCardPayment class that provides an implementation of an existing Payment class.
public virtual class Payment { public virtual void makePayment(Decimal amount) { /implementation/ } }
Which is the correct implementation?
Show answerHide answer

Correct answer: A public class CreditCardPayment extends Payment {

Explanation

Explanation:

Why A (using extends and override) is correct:

Inheritance (extends): In Apex, Payment is defined as a virtual class. Classes that are virtual (or regular classes) are inherited using the extends keyword. The implements keyword is reserved exclusively for interfaces, not classes.

Method Overriding (override): The method makePayment in the parent class is marked as virtual. To provide a subclass-specific implementation of a virtual method, the subclass must explicitly use the override keyword.

Why the other options are incorrect:

Using implements with a class: You cannot use implements on a class unless it is an interface. implements will trigger a compilation error when applied to a class definition.

Reference
Salesforce Apex Developer Guide: Inheritance (Virtual and Abstract Classes)
Salesforce Apex Developer Guide: Overriding Methods
Question 35 Choose 2
Assuming that naze is 8 String obtained by an tag on 8 Visualforce page, which two SOQL queries performed are safe from SOQL injection? Choose 2 answers
Show answerHide answer

Correct answer: C, D Option COption D

Explanation

Explanation:

Option C: String.escapeSingleQuotes()

String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + String.escapeSingleQuotes(name) + '%\'';
List results = Database.query(query);

Why Safe?

String.escapeSingleQuotes() sanitizes the input by escaping single quotes (' → \').
Prevents attackers from breaking the query with malicious input (e.g., name = "test' OR Name != ''").

Option D: Bind Variable

String query = '%' + name + '%';
List results = [SELECT Id FROM Account WHERE Name LIKE :query];

Why Safe?
Bind variables (:query) are automatically escaped by Salesforce.
No string concatenation = no injection risk.

Why Not the Others?

Option A: Unsafe Concatenation

String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + name + '%\'';

Risk: Direct concatenation allows SOQL injection (e.g., if name = "test' OR Name != ''").

Option B: noQuotes() (Invalid Method)
String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + name.noQuotes() + '%\'';

Risk: noQuotes() doesn’t exist in Apex. Even if it did, it wouldn’t escape quotes.
Question 36 Choose 1
Universal Containers has a Visualforce page that displays a table of every Container c being rented by a given Account. Recently this page is failing with a view state limit because some of the customers rent over 10,000 containers. What should a developer change about the Visualforce page to help with the page load errors?
Show answerHide answer

Correct answer: B Implement pagination with a StandardSetController.

Explanation

Explanation:

The issue here is that the Visualforce page is exceeding the View State limit because it's trying to display a very large dataset (10,000+ Container__c records). To fix this efficiently, the developer should:

✅ Use a StandardSetController to paginate the data.

This approach:

Loads and displays a subset of records at a time (e.g., 50 per page)
Keeps the view state small and manageable
Is the most declarative and Salesforce-recommended way to paginate in Visualforce

🔍 Example:

public with sharing class ContainerPaginationController {
public ApexPages.StandardSetController setCon {
get {
if (setCon == null) {
setCon = new ApexPages.StandardSetController(
[SELECT Id, Name FROM Container__c WHERE Account__c = :ApexPages.currentPage().getParameters().get('id')]
);
setCon.setPageSize(50);
}
return setCon;
}
set;
}

public List getContainers() {
return (List) setCon.getRecords();
}
}

❌ Why other options are less appropriate:

A. JavaScript Remoting with SOQL OFFSET
❌ OFFSET is inefficient at large scale (10,000+ records)
Also requires custom JavaScript and Apex code

C. OffsetController
❌ Not a standard Salesforce controller — likely refers to a custom implementation, which is more complex and error-prone

D. Lazy loading and transient List
❌ transient helps reduce view state, but by itself won’t fix the issue
Lazy loading requires custom logic, still won't handle paging automatically
Question 37 Choose 2
When importing and exporting data into Salesforce, which two statements are true? Choose 2 answers
Show answerHide answer

Correct answer: A, C Bulk API can be used to import large data volumes in development environments without bypassing the storage limits.Developer and Developer Pro sandboxes have different storage limits.

Explanation

Explanations:

A. Bulk API & Storage Limits

True. Bulk API is optimized for large data volumes (up to 10k records/batch) but does not bypass storage limits.
Storage limits (e.g., data, file storage) are enforced in all environments, including sandboxes.

C. Sandbox Storage Limits

True. Salesforce sandboxes have tiered storage:

Developer Sandbox: 200 MB data + 200 MB file storage.
Developer Pro Sandbox: 1 GB data + 1 GB file storage.

Why the Others Are False:

B. Bulk API Bypassing Limits
False. No tool (Bulk API, Data Loader, etc.) can bypass Salesforce storage limits.

D. Data Import Wizard as a Client App
False. The Data Import Wizard is a built-in Salesforce UI tool (accessible via Setup), not a separate client application.
Question 38 Choose 1
A Next Best Action strategy uses an Enhance element that invokes an Apex method to determine a discount level for a Contact, based on a number of factors. What is the correct definition of the Apex method?
Show answerHide answer

Correct answer: D Option D

Explanation

Explanation:

In Next Best Action (NBA) with Einstein Recommendations, when using the Enhance element to call an Apex method, the method must meet specific requirements defined by the InvocableMethod interface.

🔒 Requirements for @InvocableMethod used with Enhance:

Must be global static

Must accept a List input
Must return a List> (typically List>)
NBA expects multiple recommendation results per input record

🔍 Why Option D is correct:

✅ Uses @InvocableMethod
✅ Declared as global static
✅ Input is List → valid
✅ Output is List> → matches the required return type for Enhance in NBA

❌ Why the other options are incorrect:

A. Missing static keyword → ❌
B. Return type is List instead of List> → ❌
C. Input is not a list, return type is a single object → ❌
Question 39 Choose 1
What should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contracts that have the company name "Universal Containers"?
Show answerHide answer

Correct answer: A FIND "Universal Containers" IN ALL FIELDS RETURNING Lead(Id, Name), Account(Id,Name), Contract(Id, Name)

Explanation

Explanation:

Why A is correct: The requirement involves searching across multiple distinct objects (Leads, Accounts, and Contracts) for a specific text value ("Universal Containers"). This requires a SOSL (Salesforce Object Search Language) query. The correct SOSL syntax uses the FIND clause followed by the search term, an optional IN clause (defaulting to ALL FIELDS if not specified or explicitly stated as IN ALL FIELDS), and a RETURNING clause that specifies the objects and the fields (Id, Name) to retrieve.

Why the other options are incorrect:

B & D: These options attempt to use SOQL (Salesforce Object Query Language) syntax (like FROM Lead, Account... or WHERE Name = ...), which is invalid. SOQL queries can only query one primary object at a time (though you can traverse relationships), and they use SELECT, not FIND. Furthermore, Contracts do not have a Name field; they use a ContractNumber field, meaning a standard SOQL equality check on Name for a Contract would fail.

C: While IN Name Fields restricts the search to name fields only, the prompt asks for leads, accounts, and contracts with the company name "Universal Containers." In Salesforce, Accounts and Leads have a Company field, and SOSL searching across multiple objects for a company name string typically utilizes IN ALL FIELDS or IN Name Fields, but option A correctly provides the standard syntax structure. Wait, let's verify if IN ALL FIELDS or IN Name Fields is typically preferred or if both work—actually, IN ALL FIELDS is standard when searching across multiple objects where field names might differ (e.g., Account Name vs Company vs Contract fields). Let's double-check standard Salesforce exam phrasing for SOSL.

Reference:
Salesforce Object Query Language and Object Search Language (SOQL and SOSL) Guide: SOSL Syntax
Salesforce Developer Guide: RETURNING Clause
Question 40 Choose 2
A developer at AW Computing is tasked to create the supporting test class for a programmatic customization that leverages records stored within the custom object, Pricing Structure c. AW Computing has a complex pricing structure for each item on the store, spanning more than 500 records. hich two approaches can the developer use to ensure Pricing _Structure c records are available when the test class is executed? Choose 2 answers
Show answerHide answer

Correct answer: A, B Use a Test Date Factory class.Use the @raTeat (seeAllData=true) annotation.

Explanation

Explanation:

When writing test classes in Apex, the goal is to ensure that all required test data is created or made available during the test execution. Let’s look at the two valid options:

✔️ A. Use a Test Data Factory class

✅ Recommended best practice

A Test Data Factory is a reusable class designed to create test data (e.g., 500 Pricing_Structure__c records).
It improves test reliability, readability, and maintainability.
Keeps test methods clean by separating data setup from test logic.

✔️ B. Use the @isTest(seeAllData=true) annotation

✅ Allows access to actual org data during test execution.
Can be used if 500+ Pricing_Structure__c records already exist and are too complex to replicate.
⚠️ Not recommended for managed packages or long-term maintainability, as it's not future-proof (data may change or be deleted).

❌ Incorrect Options:

C. Use the Test.loadData() method
❌ This option is not listed, but if you meant Test.loadData(), that could work only if a static .csv file is available.
However, Test.leadtear{} is not a valid Apex method — possibly a typo.

D. Use without sharing on the class declaration
❌ This affects record visibility, not data availability.
It allows access to records the running user doesn't own or have access to, but doesn't create or load data for tests.
Full mock exam

Sit the Salesforce-Platform-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Salesforce-Platform-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Salesforce-Platform-Developer mock exam
  • 60questions per mock
  • 105 mintime limit
  • 184questions in the bank
  • Newmock on every attempt