PD1 Developer Fundamentals 3 — Questions and Answers
Question 1: A developer needs to query all Accounts including those soft-deleted. Which SOQL clause should be used?
- WHERE IsDeleted = true
- ALL ROWS (Correct answer)
- INCLUDING DELETED
- FROM Recycle Bin
Correct answer: ALL ROWS
The ALL ROWS clause in SOQL retrieves both active and soft-deleted records (those in the Recycle Bin).
Question 2: What is the maximum number of records returned by a single SOQL query in Apex without pagination?
- 1,000
- 10,000
- 50,000 (Correct answer)
- 100,000
Correct answer: 50,000
A single SOQL query can return a maximum of 50,000 records in Apex before hitting the governor limit.
Question 3: Which SOSL search statement correctly searches for 'Acme' across Account Name and Contact Email fields?
- FIND 'Acme' IN ALL FIELDS RETURNING Account(Name), Contact(Email)
- FIND {Acme} IN ALL FIELDS RETURNING Account(Name), Contact(Email) (Correct answer)
- SELECT Name FROM Account WHERE Name LIKE '%Acme%'
- SEARCH {Acme} IN Account, Contact
Correct answer: FIND {Acme} IN ALL FIELDS RETURNING Account(Name), Contact(Email)
SOSL uses curly braces {} around the search term, not quotes, and the FIND keyword to initiate the search.
Question 4: What happens when a DML operation encounters a record-level error in Apex when using Database.insert() with allOrNone=false?
- The entire transaction rolls back
- Only the failed record is skipped; successful records are committed (Correct answer)
- A LimitException is thrown
- The record is placed in the Recycle Bin
Correct answer: Only the failed record is skipped; successful records are committed
When allOrNone=false, Database.insert() performs a partial save, committing successful records and returning error results for failed ones.
Question 5: A developer queries 'SELECT Id, Name, (SELECT Id FROM Contacts) FROM Account'. What type of query is this?
- Semi-join query
- Relationship query with a subquery (Correct answer)
- Polymorphic query
- Aggregate query
Correct answer: Relationship query with a subquery
This is a parent-to-child relationship query using a subquery (inner SELECT) to retrieve related child records in one call.
Question 6: Which governor limit tracks the total number of SOQL queries issued in a single Apex transaction?
- 100 SOQL queries per synchronous transaction (Correct answer)
- 50 SOQL queries per synchronous transaction
- 200 SOQL queries per synchronous transaction
- 500 SOQL queries per synchronous transaction
Correct answer: 100 SOQL queries per synchronous transaction
Salesforce enforces a limit of 100 SOQL queries per synchronous Apex transaction (200 for asynchronous).
Question 7: What is the purpose of SOQL's FOR UPDATE clause?
- It filters records modified in the last update cycle
- It locks the queried records to prevent concurrent modification (Correct answer)
- It automatically commits changes after the query
- It restricts the query to updatable fields only
Correct answer: It locks the queried records to prevent concurrent modification
FOR UPDATE places row-level locks on queried records, preventing other transactions from modifying them until the current transaction completes.
A developer needs to query all Accounts including those soft-deleted.
Which SOQL clause should be used?