Salesforce certification · Exam Salesforce-Platform-Developer

Salesforce-Platform-Developer Mock Exam Page 5

Salesforce Platform Developer - Plat-Dev-201

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

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

Free Salesforce-Platform-Developer questions

41–50 of 51 free
Question 41 Choose 2
Which two events need to happen when deploying to a production org?

Show answerHide answer

Correct answer: A, B All Apex code must have at least 75% test coverage.All custom objects must have visibility set to a value other than In Development.

Explanation

Explanation\;

A. All Apex code must have at least 75% test coverage.
Correct. When deploying Apex to a production org, Salesforce requires the deployment to meet the required Apex test coverage threshold. The standard requirement is at least 75% overall Apex code coverage, and Apex tests must successfully pass.

B. All custom objects must have visibility set to a value other than In Development.
Correct. Custom objects that are still in the In Development status cannot be deployed to production. They must be set to an appropriate deployment status before deployment.

C. All Visual flows must have at least 1% test coverage.
Incorrect. Salesforce does not require Visual Flows to have a 1% test-coverage requirement for production deployment in this manner.

Key Exam Point
For Salesforce production deployments, remember:
Apex: minimum 75% code coverage and tests must pass.
Custom objects: cannot remain In Development.
Flows: there is no general 1% flow test coverage requirement.
Question 42 Choose 3
What are three ways for a developer to execute tests in an org? Choose 3.
Show answerHide answer

Correct answer: B, C, D Tooling APISetup MenuSalesforce DX

Explanation

Explanation:

Salesforce provides several ways for developers to execute tests in an org. Here's a breakdown:

✔️ B. Tooling API

✅ True

The Tooling API supports running tests programmatically, often used by IDEs and CI tools.
You can execute specific test classes or methods and retrieve code coverage results.

✔️ C. Setup Menu

✅ True

Developers and admins can run Apex tests directly from Setup by navigating to:
Setup → Apex Test Execution

✔️ D. Salesforce DX (SFDX CLI)

✅ True

Salesforce DX provides the sfdx force:apex:test:run command to run tests from the command line.
Widely used in automated CI/CD pipelines.

❌ Incorrect Options:

A. Bulk API
❌ Not used for running Apex tests
Designed for importing, exporting, and deleting large volumes of data.

E. Metadata API
❌ Used for deploying and retrieving metadata
Cannot run tests directly, though tests are run as part of deployments.
Question 43 Choose 3
For which three items can a trace flag be configured? Choose 3 answers
Show answerHide answer

Correct answer: C, D, E Apex ClassApex TriggerUser

Explanation

Explanation:

A trace flag in Salesforce is used to enable debug logging for specific items. Here’s how the correct answers apply:

✔️ C. Apex Class

✅ True
You can set a trace flag for a specific Apex Class to debug its behavior and execution.

✔️ D. Apex Trigger

✅ True
You can enable a trace flag on a specific Apex Trigger to log its execution.

✔️ E. User

✅ True
This is the most common use — enabling a trace flag for a user captures all code run in their context (e.g., when testing something in the UI or running a flow).

❌ Incorrect Options:

A. Process Builder
❌ False
You cannot configure trace flags directly for Process Builder. However, if it triggers Apex code, that can be traced.

B. Visualforce
❌ False
You cannot directly set a trace flag for a Visualforce page. You would trace the user or Apex class involved.
Question 44 Choose 2
What are two use cases for executing Anonymous Apex code? Choose 2 answers
Show answerHide answer

Correct answer: B, C To schedule an Apex class to run periodicallyTo run a batch Apex class to update all Contacts

Explanation

Explanation:

Here are the two correct use cases for executing Anonymous Apex:

Scheduling an Apex Class (B):

Anonymous Apex can schedule jobs using System.schedule().

Example:

System.schedule('Daily Update', '0 0 12 * * ?', new MyScheduledClass());

Running Batch Apex (C):

Anonymous Apex can launch batch jobs with Database.executeBatch().

Example:

Database.executeBatch(new UpdateContactsBatch(), 200);

Why Not the Others?

A. Deleting 15,000 Accounts in a single transaction:
Governor limit violation: Anonymous Apex has a 10,000-record DML limit. Use Batch Apex instead.

D. Adding unit test coverage:
Tests must be in test classes (@isTest). Anonymous Apex doesn’t count toward coverage.
Question 45 Choose 3
Which three data types can a SOQL query return? Choose 3 answers
Show answerHide answer

Correct answer: A, D, E ListsObJectDouble

Explanation

Explanation:

A SOQL (Salesforce Object Query Language) query can return results in several data types, primarily collections of records (objects) or aggregate results. Here’s how the correct answers break down:

A. List

✅ True
SOQL typically returns a List of sObjects.
Example:
List accounts = [SELECT Id, Name FROM Account];

D. sObject

✅ True
You can store a single record from a SOQL query directly in an sObject variable.
Example:
Account acc = [SELECT Id, Name FROM Account LIMIT 1];

E. Double

✅ True
When using aggregate functions (like AVG() or SUM()), SOQL can return numeric values like Double.
Example:
AggregateResult[] result = [SELECT AVG(Amount) avgAmount FROM Opportunity]; Double average = (Double)result[0].get('avgAmount');

❌ Incorrect Options:

B. Long
❌ Not a return type for SOQL. While some fields might store long integers, SOQL itself doesn't return Long types directly.

C. Integer
❌ Similar to Long, SOQL does not return raw Integer values — even COUNT() typically returns Long.
Question 46 Choose 1
Universal Containers has an order system that uses an Order Number to identify an order for customers and service agents. Order records will be imported into Salesforce. How should the Order Number field be defined in Salesforce?
Show answerHide answer

Correct answer: B External ID and Unique

Explanation

Explanation:

When integrating external systems (like an order system) into Salesforce, the best way to match and identify records is by using a field that is marked as:

✅ External ID and Unique

This allows Salesforce to:

Quickly locate records based on the external Order Number
Prevent duplicate imports
Match incoming data from an external system using that field

🔍 Why use External ID + Unique for Order Number?

External ID allows external systems to reference records without using Salesforce IDs.
Unique ensures no duplicate Order Numbers exist in Salesforce.
Great for data import, integration, and record upserts.

❌ Why other options are incorrect:

A. Direct Lookup
❌ Not a valid field type in Salesforce.

C. Lookup
❌ Lookups are used to relate one object to another — they don’t ensure uniqueness or support upserts based on external data.

D. Indirect Lookup
❌ Only used in External Objects (via Salesforce Connect), not standard or custom objects directly.
Question 47 Choose 1
A developer is asked to write helper methods that create test data for unit tests.


What should be changed in the Testvtils class so that its methods are only usable by unit test methods?
Show answerHide answer

Correct answer: B Add @IsTest above line 03,

Explanation

Explanation:

To ensure that the TestUtils class and its methods are only usable in test context (i.e., cannot be used in production code), you must annotate the entire class with:

@IsTest

This ensures:

The class is not included in production code
Its methods can only be called from test methods
It's excluded from your organization’s Apex code size limit

🔍 Updated Code (with @IsTest):

@IsTest
public class TestUtils {

public static Account createAccount() {
Account act = new Account();
// ...set some fields on acct...
return act;
}

// ...other methods...
}

❌ Why the other options are incorrect:

A. Change public to private
❌ Makes the class inaccessible outside itself — not useful for shared test utility methods.

B. Add @IsTest above line 03
❌ You can’t annotate individual methods in this way unless they are test methods, which this is not.

D. Remove static from line 03
❌ Static is required for utility methods to be called without instantiating the class.
Question 48 Choose 1
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 t report multiple bugs and bugs can also be reported by multiple companies. What is needed to allow this reporting?
Show answerHide answer

Correct answer: B Junction object between Bug c and Account

Explanation

Explanation:

- Since each company can report multiple bugs, and each bug can be reported by multiple companies, this is a many-to-many relationship.
- Salesforce does not support direct many-to-many relationships, so a junction object is required to link Bug__c and Account.
- The junction object will have two lookup fields, one to Bug__c and one to Account, allowing flexible reporting on which companies reported which bugs.

❌ Why the other options are incorrect:
A. Roll-up summary field of Bug__c on Account

❌ Only works with master-detail relationships, and only rolls up child data — doesn’t allow many-to-many.
C. Lookup field on Bug__c to Account

❌ This creates a one-to-many relationship: one bug to many accounts is not supported with just one lookup.
D. Master-detail field on Bug__c to Account

❌ Also creates a one-to-many relationship: each bug could belong to only one account.

Key Takeaways:

✅ Junction object (B) is the only way to model many-to-many relationships in Salesforce.
🚫 Other options force one-to-many relationships, violating the requirement.
Question 49 Choose 1
Given the following Anonymous Block:

Which one do you like? What should a developer consider for an environment that has over 10,000 Case records?
Show answerHide answer

Correct answer: A The transaction will fail due to exceeding the governor limit.

Explanation

Explanation:

The anonymous block attempts to query and update 50,000 Case records:

for(Case thisCase : [SELECT Id, Status FROM Case LIMIT 50000]){
thisCase.Status = 'Working';
casesToUpdate.add(thisCase);
}

Then it performs a bulk update:

Database.update(casesToUpdate, false);

However, Salesforce enforces a strict governor limit:

❗ Maximum DML rows per transaction: 10,000

This code updates 50,000 records, which exceeds the limit, and will cause the transaction to fail with a "Too many DML rows" exception.

❌ Why the other options are incorrect:

B. The try/catch block will handle any DML exceptions thrown
❌ Partially true — it can catch exceptions, but governor limit exceptions are uncatchable once hit.

C. The transaction will succeed and changes will be committed
❌ False — It will exceed the 10,000 DML rows limit and fail.

D. The try/catch block will handle exceptions thrown by governor limits
❌ False — Governor limit exceptions are not catchable. Once a limit is hit, the transaction is immediately halted.
Question 50 Choose 1
A developer wants to import 500 Opportunity records into a sandbox. Why should the developer choose to use data Loader instead of Data Import Wizard?
Show answerHide answer

Correct answer: B Data Import Wizard does not support Opportunities.

Explanation

Explanation:

The Data Import Wizard is a user-friendly, web-based tool in Salesforce, but it has limited object support. Specifically:

🔹 The Data Import Wizard does not support importing Opportunity records.

Instead, it supports standard objects like:

Leads
Contacts
Accounts
Campaign Members
Custom objects
To import Opportunities, a developer must use a tool like the Data Loader.

❌ Why the other options are incorrect:

A. Data Loader runs from the developer's browser
❌ False: Data Loader is a client application that runs on your desktop, not in a browser.

C. Data Loader automatically relates Opportunities to Accounts
❌ False: You must explicitly map the AccountId field or provide matching criteria — it doesn’t happen automatically.

D. Data Import Wizard cannot import all 500 records
❌ False: It can handle more than 500 records — limits depend on the object and user profile, but 500 is well within its capacity.
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