Praxis Academy
Home › Platform Developer › Developer Fundamentals

Platform Developer practice questions: Developer Fundamentals

Developer Fundamentals is 27% of the Salesforce Certified Platform Developer exam. It covers multi-tenancy, data modeling, SOQL/SOSL, governor limits and Apex basics. Try these 21 free questions, then open each answer to see why every option is right or wrong.

01

A media company wants to replace several custom Apex classes with point-and-click automation to lower long-term upkeep. Which two benefits are typically associated with declarative customization compared to programmatic development? Choose 2 answers.

Choose two.

  1. Declarative changes are exempt from any security review, so no scanning is ever needed.
  2. Declarative features are enhanced by Salesforce in each release, so the org gains improvements without developer effort.
  3. Declarative automation can never cause performance problems because it runs on optimized infrastructure.
  4. Declarative configuration needs less ongoing maintenance because there is no code to version, compile, or debug.
Show answer

Answer: B, D

A. Declarative changes are exempt from any security review, so no scanning is ever needed.Declarative configuration still has to meet security requirements and can be reviewed; it is not automatically exempt.
B. Declarative features are enhanced by Salesforce in each release, so the org gains improvements without developer effort. ✓Correct. Salesforce improves declarative features in each release without any work from the customer.
C. Declarative automation can never cause performance problems because it runs on optimized infrastructure.Poorly designed flows or formulas can still create performance issues and hit limits.
D. Declarative configuration needs less ongoing maintenance because there is no code to version, compile, or debug. ✓Correct. Without code, there is no syntax to troubleshoot, no unit tests to maintain, and less deployment overhead.

Why: Declarative tools are maintained and improved by Salesforce with every release and avoid the overhead of code, tests, and deployment scripts, which makes them easier to maintain over time.

02

A veterinary clinic stores each Pet__c and its Checkup__c records. Every checkup must belong to a pet, and the Pet__c page must show the total number of checkups and the latest checkup date without code. Which relationship should be created on Checkup__c?

  1. A lookup relationship to Pet__c
  2. A master-detail relationship to Pet__c
  3. A master-detail relationship on Pet__c that points to Checkup__c
  4. An external lookup relationship to Pet__c
Show answer

Answer: B

A. A lookup relationship to Pet__cLookup relationships do not support native roll-up summary fields.
B. A master-detail relationship to Pet__c ✓Correct. A master-detail field on the child makes each checkup require a pet and enables roll-up summaries on Pet__c.
C. A master-detail relationship on Pet__c that points to Checkup__cThe relationship field must be on the child; putting it on Pet__c would make each pet belong to one checkup.
D. An external lookup relationship to Pet__cExternal lookups relate to external objects and do not support roll-up summaries.

Why: Roll-up summary fields are only available on the master side of a master-detail relationship. Creating the master-detail field on the child Checkup__c makes Pet__c the master and allows COUNT and MAX roll-ups.

03

A bakery chain's Production_Run__c object has roll-up summary fields Loaves_Made__c, Loaves_Approved__c, and Loaves_Rejected__c. Managers want to see the rejection rate (rejected divided by approved) on each production run. Which solution has the lowest maintenance?

  1. An Apex trigger on the child object that recalculates the rate
  2. A formula field that divides the existing roll-up summary fields
  3. A record-triggered flow that stores the rate in a number field
  4. A new roll-up summary field that calculates the ratio
Show answer

Answer: B

A. An Apex trigger on the child object that recalculates the rateA trigger adds code and tests for something a formula can do.
B. A formula field that divides the existing roll-up summary fields ✓Correct. A formula field always reflects the current roll-up values without extra automation.
C. A record-triggered flow that stores the rate in a number fieldA flow works, but it is more to maintain than a formula field.
D. A new roll-up summary field that calculates the ratioRoll-up summary fields only support COUNT, SUM, MIN, and MAX; they cannot divide one value by another.

Why: A formula field can reference roll-up summary fields on the same record and calculate the ratio automatically, with no automation to maintain.

04

An existing class is defined as: public virtual class ShippingRate { public virtual Decimal calculate(Decimal weight) { ... } }. A developer needs an ExpressRate class that provides its own version of calculate(). Which definition is correct?

  1. public class ExpressRate implements ShippingRate { public override Decimal calculate(Decimal weight) { ... } }
  2. public class ExpressRate extends ShippingRate { public virtual Decimal calculate(Decimal weight) { ... } }
  3. public class ExpressRate extends ShippingRate { public override Decimal calculate(Decimal weight) { ... } }
  4. public class ExpressRate implements ShippingRate { public virtual Decimal calculate(Decimal weight) { ... } }
Show answer

Answer: C

A. public class ExpressRate implements ShippingRate { public override Decimal calculate(Decimal weight) { ... } }implements is used for interfaces, not classes.
B. public class ExpressRate extends ShippingRate { public virtual Decimal calculate(Decimal weight) { ... } }Redefining the method without override causes a compile error.
C. public class ExpressRate extends ShippingRate { public override Decimal calculate(Decimal weight) { ... } } ✓Correct. extends inherits the class and override redefines the virtual method.
D. public class ExpressRate implements ShippingRate { public virtual Decimal calculate(Decimal weight) { ... } }implements cannot be used with a class, and override is missing.

Why: A class inherits from a virtual class with extends, and it replaces a virtual method with the override keyword.

05

A construction firm uses Work_Package__c records that belong to a parent Site__c. The firm needs to: show the total planned hours of all work packages on the Site__c record, calculate a cost on each work package from hours and rate, and move work packages to a different site when plans change. Which relationship meets all of these needs without Apex?

  1. A master-detail relationship from Work_Package__c to Site__c with reparenting allowed
  2. A lookup relationship from Work_Package__c to Site__c with reparenting allowed
  3. A master-detail relationship from Site__c to Work_Package__c with reparenting allowed
  4. A lookup relationship from Site__c to Work_Package__c with reparenting allowed
Show answer

Answer: A

A. A master-detail relationship from Work_Package__c to Site__c with reparenting allowed ✓Correct. Master-detail on the child supports roll-ups, and reparenting allows moving records.
B. A lookup relationship from Work_Package__c to Site__c with reparenting allowedLookups do not support native roll-up summary fields.
C. A master-detail relationship from Site__c to Work_Package__c with reparenting allowedThe relationship field must be on the child object, Work_Package__c.
D. A lookup relationship from Site__c to Work_Package__c with reparenting allowedThe direction is wrong and lookups do not support roll-ups.

Why: A master-detail field on the child enables roll-up summaries on the parent, a formula field on the child can calculate cost, and the Allow reparenting option lets child records move to another parent.

06

Which field is an example of a polymorphic relationship?

  1. WhatId on the Event object, which can point to Accounts, Opportunities, or custom objects
  2. LastModifiedById, which always points to a User
  3. A custom lookup on a custom object that points to one parent object
  4. ContactId on the Case object, which always points to a Contact
Show answer

Answer: A

A. WhatId on the Event object, which can point to Accounts, Opportunities, or custom objects ✓Correct. WhatId can reference many different object types.
B. LastModifiedById, which always points to a UserLastModifiedById always refers to a User.
C. A custom lookup on a custom object that points to one parent objectCustom lookup fields always reference a single object type.
D. ContactId on the Case object, which always points to a ContactContactId always refers to a Contact.

Why: A polymorphic relationship can reference records of more than one object type. WhatId on Task and Event, and OwnerId on many objects, are examples.

07

A Lightning web component shows Travel_Request__c records returned by an Apex method. Only records the current user is allowed to see may be returned. What should the developer do in the Apex class?

  1. Declare the class with sharing.
  2. Add WITH SECURITY_ENFORCED to the query.
  3. Make the class global.
  4. Run the returned list through Security.stripInaccessible().
Show answer

Answer: A

A. Declare the class with sharing. ✓Correct. with sharing applies the user's sharing rules to the query.
B. Add WITH SECURITY_ENFORCED to the query.WITH SECURITY_ENFORCED checks object and field permissions, not record sharing.
C. Make the class global.Access modifiers do not affect record sharing.
D. Run the returned list through Security.stripInaccessible().stripInaccessible() removes inaccessible fields, not records.

Why: Declaring a class with sharing enforces the running user's record-level access, so the query returns only records the user can see.

08

An agency tracks Client__c and Service__c records. A client can use many services and a service can be used by many clients, and the agency needs reports showing which clients use which services. What should be implemented?

  1. A master-detail relationship from Service__c to Client__c
  2. A lookup from Service_Request__c to Client__c only
  3. A junction object between Client__c and Service__c
  4. A roll-up summary on Client__c
Show answer

Answer: C

A. A master-detail relationship from Service__c to Client__cThis allows each service to belong to only one client.
B. A lookup from Service_Request__c to Client__c onlyOne lookup alone cannot model many-to-many.
C. A junction object between Client__c and Service__c ✓Correct. A junction object models the many-to-many relationship.
D. A roll-up summary on Client__cA roll-up summary only aggregates values.

Why: A many-to-many relationship is modeled with a junction object that has master-detail relationships to both objects, which also supports reporting across them.

09

A developer is converting a Visualforce page that shows one Property__c record into a Lightning web component that uses Lightning Data Service. Which security behavior should the developer know about?

  1. Lightning Data Service enforces the user's sharing and field-level security automatically.
  2. with sharing must be added to the component's JavaScript.
  3. checkAccess() must be called for every field.
  4. Lightning Data Service skips security to improve performance.
Show answer

Answer: A

A. Lightning Data Service enforces the user's sharing and field-level security automatically. ✓Correct. LDS enforces CRUD, FLS, and sharing automatically.
B. with sharing must be added to the component's JavaScript.Sharing keywords are Apex, not JavaScript.
C. checkAccess() must be called for every field.There is no such method that is required.
D. Lightning Data Service skips security to improve performance.LDS does not bypass security.

Why: Lightning Data Service respects the running user's CRUD, field-level security, and sharing, so only data the user can access is returned.

10

A software vendor is building its product on a multitenant platform such as Salesforce. What is a key benefit compared to a single-tenant environment?

  1. The platform requires strict test coverage for all custom code.
  2. Applications scale on shared infrastructure, while governor limits keep resource usage predictable for every tenant.
  3. Each tenant has unlimited processing power and memory.
  4. Each tenant receives large pre-allocated storage for big data.
Show answer

Answer: B

A. The platform requires strict test coverage for all custom code.Test coverage is a platform rule, not a benefit of multitenancy.
B. Applications scale on shared infrastructure, while governor limits keep resource usage predictable for every tenant. ✓Correct. Shared infrastructure scales, and limits keep performance predictable.
C. Each tenant has unlimited processing power and memory.Resources are limited by governor limits.
D. Each tenant receives large pre-allocated storage for big data.Storage is allocated according to edition and licenses.

Why: In a multitenant architecture, tenants share infrastructure that Salesforce scales and upgrades. Governor limits make sure no tenant monopolizes shared resources.

11

What is the value of result after this code runs? Boolean isOpen; Integer result; String stage = 'New'; if (isOpen == false && stage == 'New') { result = 1; } else if (isOpen == true && stage == 'New') { result = 2; } else if (isOpen != null && stage == 'New') { result = 3; } else { result = 4; }

  1. 1
  2. 2
  3. 3
  4. 4
Show answer

Answer: D

A. 1null is not equal to false.
B. 2null is not equal to true.
C. 3isOpen is null, so isOpen != null is false.
D. 4 ✓Correct. No condition is true, so the else branch sets result to 4.

Why: isOpen is never assigned, so it is null. null == false and null == true are both false, and isOpen != null is false, so the else branch runs and result is 4.

12

A field service app processes work orders in a trigger and needs fast access to Technician__c records by their Id. Which statement builds this collection in a single line?

  1. Map<Id, Technician__c> techs = [SELECT Id, Name FROM Technician__c];
  2. List<Id, Technician__c> techs = new List<Id, Technician__c>([SELECT Id, Name FROM Technician__c]);
  3. Map<Id, Technician__c> techs = new Map<Id, Technician__c>([SELECT Id, Name FROM Technician__c]);
  4. Map<Id, Technician__c> techs = Database.getMap('SELECT Id, Name FROM Technician__c');
Show answer

Answer: C

A. Map<Id, Technician__c> techs = [SELECT Id, Name FROM Technician__c];A SOQL query returns a List, so assigning it directly to a Map variable does not compile.
B. List<Id, Technician__c> techs = new List<Id, Technician__c>([SELECT Id, Name FROM Technician__c]);A List takes only one type parameter; it cannot be keyed by Id.
C. Map<Id, Technician__c> techs = new Map<Id, Technician__c>([SELECT Id, Name FROM Technician__c]); ✓Correct. The Map constructor accepts a list of sObjects and uses each record's Id as the key.
D. Map<Id, Technician__c> techs = Database.getMap('SELECT Id, Name FROM Technician__c');Database.getMap is not an Apex method; Database.query returns a List, not a Map.

Why: Apex lets you build a Map<Id, sObject> directly from a SOQL result by passing the list to the Map constructor. This is a common pattern for bulk-safe lookups in triggers.

13

A utility method at a marketing agency receives a generic SObject that may be a Lead or a Contact, and it must run different logic for each type. Which syntax handles this cleanly?

  1. switch on rec { when Lead l { /* lead logic */ } when Contact c { /* contact logic */ } when else { /* other */ } }
  2. switch (rec) { case Lead: /* lead logic */ break; case Contact: /* contact logic */ break; }
  3. if (rec instanceof 'Lead') { /* lead logic */ } else if (rec instanceof 'Contact') { /* contact logic */ }
  4. switch on rec.Name { when 'Lead' { /* lead logic */ } when 'Contact' { /* contact logic */ } }
Show answer

Answer: A

A. switch on rec { when Lead l { /* lead logic */ } when Contact c { /* contact logic */ } when else { /* other */ } } ✓Correct. Apex switch statements support sObject types and bind the record to a typed variable in each when block.
B. switch (rec) { case Lead: /* lead logic */ break; case Contact: /* contact logic */ break; }This is Java-style switch syntax; Apex uses switch on with when blocks, not case labels.
C. if (rec instanceof 'Lead') { /* lead logic */ } else if (rec instanceof 'Contact') { /* contact logic */ }instanceof takes a type name, not a string literal, so this does not compile.
D. switch on rec.Name { when 'Lead' { /* lead logic */ } when 'Contact' { /* contact logic */ } }The Name field holds the record's name, not its object type, and a generic SObject cannot use dot notation for fields.

Why: The Apex switch statement can branch on sObject type, binding the value to a typed variable (when Lead l). This avoids manual casting and long if/else chains.

14

At a warehouse, two Apex processes can update the Quantity__c of the same Inventory_Bin__c record at nearly the same time, and updates are sometimes lost. How can the developer make sure only one transaction changes a bin at a time?

  1. Query the bins with FOR UPDATE so the records are locked until the transaction ends.
  2. Query the bins with FOR VIEW so Salesforce tracks who is viewing them.
  3. Query the bins with WITH SECURITY_ENFORCED to block concurrent access.
  4. Query the bins with ALL ROWS so every version of the record is returned.
Show answer

Answer: A

A. Query the bins with FOR UPDATE so the records are locked until the transaction ends. ✓Correct. FOR UPDATE locks the returned records, so other transactions trying to lock them wait until the first one commits or rolls back.
B. Query the bins with FOR VIEW so Salesforce tracks who is viewing them.FOR VIEW updates recently viewed data; it does not lock records.
C. Query the bins with WITH SECURITY_ENFORCED to block concurrent access.WITH SECURITY_ENFORCED checks field and object permissions; it has no effect on concurrency.
D. Query the bins with ALL ROWS so every version of the record is returned.ALL ROWS includes deleted and archived records; it does not prevent concurrent updates.

Why: Adding FOR UPDATE to a SOQL query locks the returned records for the rest of the transaction. This prevents race conditions when several processes update the same records.

15

A global retailer stores tax rates per country that Apex uses during checkout. The rates must move from sandbox to production along with the code, and reading them should not use up SOQL queries. The team chooses a custom metadata type. Which two statements about this choice are true? (Choose 2)

  1. Values can automatically differ by user or profile, like a hierarchy.
  2. Records can be deployed with change sets, packages, or the Metadata API.
  3. Apex can insert and update the records with standard DML statements.
  4. Records can have lookup relationships to individual Account records.
  5. The getAll() and getInstance() methods return records without counting against the SOQL query limit.
Show answer

Answer: B, E

A. Values can automatically differ by user or profile, like a hierarchy.That behavior belongs to hierarchy custom settings, not custom metadata types.
B. Records can be deployed with change sets, packages, or the Metadata API. ✓Correct. Custom metadata records are metadata, so they deploy along with the type and the code that uses them.
C. Apex can insert and update the records with standard DML statements.Custom metadata records cannot be changed with DML; they are changed in Setup, by deployment, or with the Apex Metadata API.
D. Records can have lookup relationships to individual Account records.Metadata relationships point to other metadata, such as objects, fields, or other custom metadata types, not to data records.
E. The getAll() and getInstance() methods return records without counting against the SOQL query limit. ✓Correct. These custom metadata methods do not consume SOQL queries.

Why: Custom metadata types are ideal for deployable configuration. Their records travel with deployments, and reading them with getAll() or getInstance() does not count against SOQL limits.

16

A form-processing class at an insurance broker checks a comments field before saving. What is written to the debug log? String note = ' '; System.debug(String.isBlank(note)); System.debug(String.isEmpty(note));

  1. false, then false
  2. true, then true
  3. false, then true
  4. true, then false
Show answer

Answer: D

A. false, then falseisBlank treats a string of only whitespace as blank, so the first result is true.
B. true, then trueisEmpty returns true only for null or a zero-length string; ' ' has three characters.
C. false, then trueThe results are reversed: isBlank ignores whitespace, while isEmpty does not.
D. true, then false ✓Correct. isBlank returns true for null, empty, or whitespace-only strings, while isEmpty returns true only for null or empty strings.

Why: String.isBlank() is usually the safer check for user input because it also treats whitespace-only values as missing. String.isEmpty() checks only for null or zero length.

17

A community bank's search page runs this statement in Apex: FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName) Which variable declaration can hold the result?

  1. List<SObject> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];
  2. List<List<SObject>> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];
  3. Map<String, List<SObject>> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];
  4. List<AggregateResult> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];
Show answer

Answer: B

A. List<SObject> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];SOSL returns one list per object in RETURNING, so a single flat list of SObjects cannot hold the result.
B. List<List<SObject>> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)]; ✓Correct. SOSL returns a list of lists, with one inner list for each object in the RETURNING clause, in the same order.
C. Map<String, List<SObject>> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];SOSL results are not keyed by object name; they are returned as a list of lists.
D. List<AggregateResult> results = [FIND 'Riverside' IN ALL FIELDS RETURNING Account(Name), Contact(LastName)];AggregateResult is used for SOQL aggregate queries, not SOSL searches.

Why: An inline SOSL query returns List<List<SObject>>. results[0] holds the Account matches and results[1] the Contact matches, which can be cast to List<Account> and List<Contact>.

18

A construction company has a master-detail relationship from Expense__c (detail) to Project__c (master). Which two values can roll-up summary fields on Project__c calculate? (Choose 2)

  1. The total of a currency field across all related Expense__c records
  2. The average of a number field across related Expense__c records
  3. The count of Invoice__c records related to Project__c through a lookup relationship
  4. The latest date in a date field across related Expense__c records
  5. A comma-separated list of text values from related Expense__c records
Show answer

Answer: A, D

A. The total of a currency field across all related Expense__c records ✓Correct. SUM is a supported roll-up type for number, currency, and percent fields.
B. The average of a number field across related Expense__c recordsAVERAGE is not a roll-up summary type; only COUNT, SUM, MIN, and MAX are available.
C. The count of Invoice__c records related to Project__c through a lookup relationshipRoll-up summaries on custom objects require a master-detail relationship, not a lookup.
D. The latest date in a date field across related Expense__c records ✓Correct. MAX is supported for date fields, so it returns the most recent date.
E. A comma-separated list of text values from related Expense__c recordsRoll-up summaries cannot concatenate text; they only count or calculate SUM, MIN, or MAX.

Why: Roll-up summary fields on a master object support COUNT, SUM, MIN, and MAX over detail records. Other aggregations, such as averages over lookups, need Flow or Apex.

19

A consulting firm has a lookup field Client__c on Project__c. Users must not be able to delete a Client__c record while any project still references it. How should the developer configure this without code?

  1. Change the field to a master-detail relationship.
  2. Create a validation rule on Client__c that checks for related projects.
  3. Keep the default lookup option Clear the value of this field.
  4. Set the lookup option Don't allow deletion of the lookup record that's part of a lookup relationship.
Show answer

Answer: D

A. Change the field to a master-detail relationship.Master-detail would delete the related projects when the client is deleted, rather than blocking the deletion.
B. Create a validation rule on Client__c that checks for related projects.Validation rules run on insert and update, not on delete, so they cannot block deletion.
C. Keep the default lookup option Clear the value of this field.This default lets the client be deleted and simply blanks the lookup on related projects.
D. Set the lookup option Don't allow deletion of the lookup record that's part of a lookup relationship. ✓Correct. This lookup setting prevents deleting a parent record that is still referenced by child records.

Why: Lookup relationships offer delete options: clear the field (default), prevent deletion of the referenced record, or, in some cases, cascade delete. Choose the restrictive option when parents must not be removed while in use.

20

A hotel booking class has two constructors: public class Booking { Integer nights; String roomType; public Booking() { /* ? */ } public Booking(Integer n, String r) { nights = n; roomType = r; } } The no-argument constructor must reuse the second constructor with 1 and 'Standard'. What should replace the comment?

  1. this(1, 'Standard');
  2. super(1, 'Standard');
  3. Booking(1, 'Standard');
  4. new Booking(1, 'Standard');
Show answer

Answer: A

A. this(1, 'Standard'); ✓Correct. this() calls another constructor of the same class and must be the first statement in the constructor.
B. super(1, 'Standard');super() calls a constructor of the parent class, and Booking does not extend a class with that constructor.
C. Booking(1, 'Standard');A constructor cannot be called by name like a method, so this does not compile.
D. new Booking(1, 'Standard');This creates a separate Booking object and leaves the current object's fields unset.

Why: Constructor chaining with this() lets overloaded constructors share initialization logic. The this() call must be the first statement in the constructor.

21

A product catalog page pages through results with this query: SELECT Id, Name FROM Product2 ORDER BY Name LIMIT 50 OFFSET :startRow Users report an error when they jump far ahead in the list. What is the most likely cause?

  1. LIMIT cannot be combined with ORDER BY in the same query.
  2. OFFSET can be used only on custom objects.
  3. A bind variable cannot be used in the OFFSET clause.
  4. The OFFSET value exceeded the maximum of 2,000 rows.
Show answer

Answer: D

A. LIMIT cannot be combined with ORDER BY in the same query.LIMIT and ORDER BY are commonly used together, especially for pagination.
B. OFFSET can be used only on custom objects.OFFSET works on standard objects such as Product2 as well as custom objects.
C. A bind variable cannot be used in the OFFSET clause.Bind variables are allowed in OFFSET, so the value can come from Apex.
D. The OFFSET value exceeded the maximum of 2,000 rows. ✓Correct. SOQL OFFSET supports up to 2,000 rows; larger values cause an error.

Why: OFFSET is handy for simple pagination but is capped at 2,000 rows. For deeper paging, use a different approach, such as filtering on the last Id or sort value seen.

Find out if you're ready to pass

Take the free Platform Developer diagnostic: 20 questions, no account needed. Then unlock all 300 questions, full practice exams and the study guide.

Start the free diagnosticSee plans

Other sections of this exam