You are on page 1of 13

Salesforce Platform Developer Study guide

Whiteboard

Database Class
o Database.delete(myList, false);
o DMLs opt all or none. (true: one fails all fail) (false: one fails, others
wont)
Limits Class
o getAggregateQueries(), getLimitAggregateQueries(); Used to
determine limits of SOQL queries
o getDMLstatements(), getLimitDMLstatements(); Used to determine
limits of dml statements
Schema class
o Obtaining record types/ picklist values
o Id devRecordTypeId = Schema. SObjectType. Account.
getRecordTypeInfosByName(). get('Development'). getRecordTypeId();
o Schema.DescribeFieldResult fieldResult =
OfficeLocation__c.Country__c.getDescribe();
List<Schema.PicklistEntry> pickList = fieldResult.getPicklistValues();
Controller extensions
o Use functionality of standard controller but overwrite or add actions
o Execute in system mode which ignores sharing rules
Custom controllers
o No standard methods
o Execute in system mode which ignores sharing rules
Standard controllers
o Contains provided functions and logic
Salesforce standard object relationship
o http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_er
d_majors.htm
Limits
o Total number of SOQL queries issued: synchronous = 100,
asynchronous = 200
o Total number of records retrieved by SOQL queries = 50,000
o Total number of records retrieved by Database.getQueryLocator =
10,000
o Total number of DML statements issued = 150
o Total number of records processed as a result of DML statements,
Approval.process, or database.emptyRecycleBin = 10,000
o Know that limits exceptions cannot be caught, so no handling can be
done once the exception happens
o The Developer Console allows you to execute Apex code as another
way to generate debug logs that cover specific application logic.
o Used to see limits reached (execution failed)
Exceptions
o DML Exception: Required field missing on insert
o List Exception: List index out of bounds: 1

o
o
o

NullPointerException: Attempt to de-reference a null object


Query Exception: list has no rows for assignment to sObject
sObject Exception: SObject row was retrieved via SOQL without
querying the requested field:
Only first exception is caught
Only one catch block is executed
Catch (Exception e) for all exceptions
Methods: getType(), getMessage()
Custom exceptions: public class MyException extends Exception {}

o
o
o
o
o
o
Order of Execution
o The original record is loaded from the database (or initialized for an
insert statement)
o The new record field values are loaded from the request and overwrite
the old values
o All before triggers execute (TRIGGERS)
o System validation occurs, such as verifying that all required fields have
a non-null value, and running any user-defined validation rules
(VALIDATIONS)
o The record is saved to the database, but not yet committed
o All after triggers execute
o Assignment rules execute
Lead assignments: how leads are assigned to users
Case assignments: how cases are assigned to users
o Auto-response rules execute
Send emails to leads or case submissions based on records
attributes
o Workflow rules execute (WORKFLOW)
o If there are workflow field updates, the record is updated again
o If the record was updated with workflow field updates, before and
after triggers fire one more time (and only one more time)
o Escalation rules execute
Reassign and notify individuals when a case is not closed within
a certain amount of time
o All DML operations are committed to the database
o Post-commit logic executes, such as sending email
Questions
1. A developer has a block of code that has not specified with sharing or
without sharing. In what context would the developer be sure that the
code would execute with the sharing rules defined for the current user?
A. Apex Test Code
B. Triggers
C. Anonymous Apex
i. Execute Anonymous is treated as with sharing if the class
does not specify with or without sharing
D. Apex Classes

2. What is the value of 'x' after the following code block executes?

String x = 'A';
Integer i = 10;
if (i < 15) {
x = 'B';
i = 15;
} else
if (i < 20) {
x = 'C';
i = 20;
} else {
x = 'D';
}
A. A
B. B
a. Else statements are ignored if first if statement is true
C. C
D. D
3. There are currently 100 account records in the database. A developer
executes the following code in Anonymous Apex. How many accounts
exist in the database after the execution completes?
Account a = new Account();
insert a;
try {
for (integer i = 0; i < 150; i++) {
Account acc = new Account();
insert acc;
}
} catch (Exception e) {
// Do nothing

}
Account a2 = new Account();
insert a2;
A.
B.
C.
D.

101
102
252
100
a. Anonymous apex processes DMLs at the same time. Hits 150
dml limit

4. What is a correct example of the order of execution for Salesforce


A. Validation Rules, Before Trigger, After Trigger, Assignment Rules,
Workflow Rules, Commit
B. Before Trigger, Validation Rules, After Trigger, Assignment Rules,
Workflow Rules, Commit
a. Assignment rules come before workflow rules in the order of
execution of salesforce
C. Before Trigger, Validation Rules, After Trigger, Workflow Rules,
Assignment Rules, Commit
D. Validation Rules, Before Trigger, After Trigger, Workflow Rules,
Assignment Rules, Commit

5. In the following code block, which exception (if any) will be caught?
try {
List<String> nameList;
Account a;
String s = a.Name;
nameList.add(s);
} catch (ListException le) {
System.debug('ListException');
} catch (NullPointerException np) {
System.debug('NullPointerException');
} catch (Exception e) {
System.debug('GenericException');
}
A. List Exception
B. Null Pointer Exception

a. List exception is not caught, a.name is null so null pointer


exception is caught, only one catch can be executed
C. Generic Exception
D. None
6. Which statement is true about the Lightning Component Framework?
A. The framework comes with an out-of-the-box set of pre-built
components that emulate a standard Salesforce look-and-feel
B. The Lightning components help to enhance the performance of
Salesforce1 mobile applications
C. The framework is optimized by shifting processing of data to serverside controller logic
D. The components don't require Javascript to operate

7. Which of the following are valid when deploying code from one instance to
another (choose 2)?
A.
B.
C.
D.

Sandbox to Sandbox
Developer Edition to Sandbox
Sandbox to Production
Developer Edition to Production

8. Which of the following are possible to achieve using the Developer Console
(choose 3)?
A. View and download debug logs
B. Create/Edit Apex code
C. Deploy changesets
a. You cannot deploy through the dev console (use changesets)
D. Execute test code
9. In the following code block, what line of code should the developer write on
line 3 (in the try block) to make sure that at least some records are
committed to the database, even if a failure occurs.
List<Account> aList = externalService.getListOfAccounts();
try {
// Line 3 (what code goes here?)
} catch (Exception e) {

}
A. insert aList;
B. Database. Insert (aList, false);
a. Opt all or none is set to false, valid insertions will be committed
C. Database. Insert (aList);

D. Database. Insert (aList, System. ACCEPT_SOME_ROWS);

-- Jared & Mike C

10. Which of the following can you see in the Checkpoints tab?
A. Namespace
B. Exception
a. Use the tests tab to view these
C. Time
D. Debug statement
a. Use the logs tab to view these

11. Which of the following is the correct way to see the ListView for an
account object?System.debug(controller.getListViewOptions()); How would
they do it?
A. StandardController controller = new StandardController([SELECT Id
FROM Account LIMIT 1]);
B. StandardController controller = new
StandardController(Database.getQueryLocator('select Id from Account
limit 1'));
C. StandardSetController controller = new StandardSetController([SELECT
Id FROM Account LIMIT 1]);
D. StandardSetController controller = new
StandardSetController(Database.getQueryLocator('select Id from
Account limit 1'));
a. Use a standard set controller and database.getquerylocator() for
this

12. An engine has a set of parts, and each part can be used in multiple types
of engines? What would be the best way to set up the data model to prevent
orphaned records?
A. Create a junction object between Engine and Part using Master-Detail
relationships
a. Using a master detail can prevent orphaned records
B. Create a master-detail relationship from Part to Engine
C. Create a junction object between Engine and Part with Lookup
relationships
D. Create a lookup relationship from Part to Engine

13. When querying child relationships, how many levels can you traverse?
A. 3
B. 7
C. 1
a. Parent to child limit
D. 5
a. Child to parent limit
14. Which of the following is the best practice for avoiding limits in a trigger
(choose 2):
A.
B.
C.
D.

Use a Set to ensure uniqueness of records


Use an @future call to asynchronously make DML statements
Synchronously make web service callouts
Use a Map to store queried records

15. Which of the following is true regarding change sets (choose 3):
A. In order to deploy, a deployment connection must exist between
organizations
B. The organizations must be related
C. Custom setting data can be deployed using a change set
D. Contact records can be transferred between organizations
E. Deployment uses an all-or-nothing paradigm
a. Must all succeed or the deploy fails

16. If you want to change the field on an object in a trigger without DML,
which of the following contexts would you use (choose 2):
A.
B.
C.
D.

before update
after update
after insert
before insert
a. only works in before cases

17. Which of the following can you do from a before update trigger? (Choose
2)
A. Edit the Trigger. new to change a field on the record without DML
a. Main benefit of before trigger
B. Call a DML update on the records from the trigger
C. Call a DML delete on the records from the trigger
D. Throw an error to prevent the object from updating

18. ...Lightning... (Choose 2) Steven: I think it was asking about where the
controller logic is.
A. Third-party javascript
B. Third-party web service
C. Javascript controller
a. Lighting allows developers to define client side controllers.
D. Visualforce controller

19. Where do you create a managed package?


A. Unlimited Edition
B. Developer Edition
a. This is a requirement for managed packages
C. Developer Sandbox
D. Professional Edition

20. Which of the following are best practices for retrieving record types and
picklist values on Case objects in apex code? (Choose 2)
A. Query the case object and get the record types
B. Query the case object and get the picklist values
C. Use schema call to get the record types (the actual answer has the
code syntax)
D. Use schema call to get the picklist values (the actual answer has the
code syntax)

21. When querying for a multi-select picklist in apex code, how is the data
returned
A.
B.
C.
D.

As
As
As
As

a
a
a
a

List<String>
Set<String>
String, comma-delimited
String, semicolon-delimited

22. Which property on an object describe can be used to get whether a


particular user can create records for that object?
A. isCreateable()
a. Other methods dont exist. Method returns true if user can
create object
B. isInsertable()
C. canCreate()
D. hasAccess()

23. Which of the following are possible return types for a query? (Choose 3)
A.
B.
C.
D.
E.

Integer
List<sObject>
sObject
String
Boolean

24. Which of the following can you do with formula fields (Choose 3)
A.
B.
C.
D.
E.

Use the VLOOKUP function to access fields from other objects


Use the IF function to choose between three images
Use the PRIORVALUE function to see the previous value of a field
Use the HYPERLINK function to create a link to access external system
Use the NOW function to determine if a datetime field is prior to the
present.

25. An intern needs to be able to view the most recently closed case through
a field on the account since they don't have access to the case object. What
would you need on the parent when it is updated to update this field on the
child? (Choose 2)
A.
B.
C.
D.

Trigger with a SOQL query


Workflow to update the field
Process Builder
Cross object formula field

26. Someone has submitted a record for approval - it is midway through the
process and the record is locked - who can edit the record (Choose 2)?
A.
B.
C.
D.

Current approver
Previous approvers in the process
Users above the record owner in the role hierarchy
Administrator

27 What is the output of "{!myString}, {!strMethod1}, {!strMethod2}, {!


myString}" given the following class
public class testclass {
public String myString;
public String getMyString() {
return "Hello";

}
public string strMethod1() {
return myString;
}
public string strMethod2() {
if (myString == null) {
myString = 'strMethod2';
}
return myString;
}
}
A.
B.
C.
D.

"Hello, , strMethod2, Hello"


", , strMethod2, strMethod2"
"Hello, , strMethod2, "
"Hello, strMethod2, strMethod2, Hello"

28. If using Data Loader to import data from a csv, if you want the import to
update records in the org, which fields types would you use? (I don't
remember the exact syntax, I just remember something about importing and
wanted to update data)
A.
B.
C.
D.

Name
Auto Number
Id
External Id

29. How would you add an external javascript file to your visual force page
(Chose 2):
A.
B.
C.
D.

<apex:includeScript>
<script>
<link>
<apex:detail> Pretty sure it was this.

30. What is the minimum log level needed to show user generated debug
statements
A. INFO
B. DEBUG

a. Order from lowest to highest is:


b. NONE
c. ERROR
d. WARN
e. INFO
f. DEBUG
g. FINE
h. FINER
i. FINEST
C. WARN
D. FINE

-- Steven --

31. The developer has created custom settings which contain the URL to each
user's page. How would you display them on a visual force page?
A.
B.
C.
D.

{!$Setup.Client__c.UserURL__c[{$Profile.Id}]}
{!$Setup.Client__c.UserURL__c[{Profile.Id}]}
{!$Setup.Client__c.UserURL__c}
{!$Setup.Client__c.UserURL__c[{!$Profile.Id}]}

32. An organization want to utilize custom objects for Job listings and
applications. Job seekers can only apply one application to a job listing. After
an application is applied to a job listing, the job seeker cannot change the
application to point to another job listing. What type of relationship would
meet these requirements?
A. Master-Detail relationship on Job Listing object to the Application
object.
B. Master-Detail relationship on Application object to the Job Listing
object.
C. Lookup relationship on Job Listing object to the Application object.
D. Lookup relationship on Application object to the Job Listing object.

33. How can we ensure that when an Opportunity record's CloseDate field is
set, that a Description field must be given a value?
A.
B.
C.
D.

Validation rules
Formula Fields
Workflow alerts
Make it a required field

34. A developer needs to override the edit button on the account page to also
run validation on the address. What type of controller would they use to
accomplish this?
A.
B.
C.
D.

Standard Controller
Standard Extension
Custom Controller
Controller Extension

35. What is the recommended way to initialize test data for a unit test?
A. Static resource
a. Uploading an external test data utils class?
B. Document
C. new Account();
D. Don't remember

----- Aaron ----36. What would be examples of the Controller in the MVC architecture of the
Force.com platform? (Choose 2)
A. Custom Apex or Javascript that is used to manipulate data
B. A Static resource that contains css and images
a. view
C. A Javascript function that toggles a panel to display
a. view
D. Standard Controller methods referenced in Visualforce

37. A workflow is created to send an email alert to a case owner manager


when a case is created. When will the email be sent?
A.
B.
C.
D.

Before Trigger execution


After Trigger execution
Before Case is committed to the Database
After Case is committed to the Database

38. A Task is created on a Contact record. What will a developer need to do to


display a related list of Contact's Tasks on the Account detail page?
A. Nothing. A related list of Contact's Tasks will be automatically
generated and displayed.
B. Nothing. You cannot display Tasks for Accounts and Contacts through a
related list.
C. Create a formula field on Account that will populate the Tasks on
related Contacts.

D. Create a Workflow that will create a related list on Account of Contact's


Tasks

39. Which of the following should not be done inside a procedural-loop?


(Choose 2)
A.
B.
C.
D.

Update contactList;
List<Account> accountList = [SELECT Id FROM Account Limit 1];
if (a.AccountId == o.Id);
Boolean isActive = false;

40. When using variables in a class which of the following are appropriate?
(Choose 3)
A. Parallel blocks can use the same variable name
B. Sub blocks can use a parent blocks static variable name as long as it is
set to null
C. Variables can be declared at any point
D. Sub blocks cannot reuse a parent block's variable name

<Unfinished>
41. What are things that a developer must keep in mind when dealing with a
multi-tenant environment? (I can barely remember this question)
A.
B.
C.
D.

Governor limits
Polyglot. Allows for multiple language support across multiple orgs
Security enforced
not sure

</Unfinished>

----- Eric ----42. When creating a Contact record programatically what field is required?
A.
B.
C.
D.

AccountId
LastName
FirstName
MailingStreet