126 terms

Salesforce Advanced Developer DEV-501 Apex Coding 1.0

STUDY
PLAY

Terms in this set (...)

"Salesforce is described as what type of platform, allowing clients to run applications in the cloud without software?
on-demand
What term describes the Salesforce as a platform which allows clients to share hardware, storage and other infrastructure?
multi-tenant
What two ways are available to customize and create applications in salesforce?
declaratively, programmatically
How are declarative customizations done in Salesforce?
Setup menu
How are programmatic cusomizations done in Salesforce?
Apex, Visualforce, and APIs
Identify the differences between Apex and the other programming languages. (Select all that
apply.)
- Apex runs in a multitenant environment.
- Apex performs uncontrolled program invocations.
- Apex is case-insensitive.
- Apex can be processed on any platform.
Apex runs in a multitenant environment., Apex is case-insensitive.
Which invocation method occurs when triggers are called by the Force.com platform during
the save process?
O Explicit invocation
O Implicit invocation
O Explicit invocation using anonymous blocks
O External API invocation
Implicit invocation
Classes are the blueprint for the creation of a single object.
O True
O False
FALSE
Which of the following will you use for browsing objects and fields in the Force.com IDE?
O Force.com Projects
O Schema Explorer
O Development Work Nea
O Debug View
Schema Explorer
Which environments can developers write code? (Select all that apply.)
□ Developer edition production org
□ Enterprise edition production org
□ Enterprise edition sandbox org
□ Professional edition sandbox org
Developer edition production org, Enterprise edition sandbox org
Apex is an ________________ and _________ programming language.
object-oriented, on-demand
Apex code is always saved as what?
Class, trigger
What language is Apex similar to?
Java
What can the Force.com IDE be used to create?
Apex code, Visualforce pages, and controllers
What is Apex relationship to the declarative features of Salesforce?
Create complex functionality declarative features cannot provide.
Match the keywords with the definitions.

List
Set
Map

Collection of key-value pairs where each unique key maps to a single value.
Ordered collection of typed primitives. sObjects. User-defined objects. Apex objects or collections that are distInguished by their indices.
Unordered collection of elements that do not contain any duplicates.
List, Ordered collection . . .
Set, Unordered collection of elements . . .
Map, Collection of key-value pairs where . . .
Which of the following are collection data types? (Select all that apply.)
□ String
□ Map
□ List
□ Date
□ Set
□ Number
Map, List, Set
Which of the following statements are used to repeatedly execute a block of code until the
exit condition is met?
O do-while loops
O if statements
O for loops
O if—Lhen statements
for loops
Which of the following code will u use to instantiate a map called numbers that has
integers as keys and strings as values?
O Map<SLrng, :nLeger> numbers = new Map<String, Integer>;
O Map<ThLeyer, SLring> numbers = new Map<Integer, String>;
O Map<nLeger> numbers = new Map<String>;
O Map<Slring> numbers = new Map<Integer>;
Map<Integer, String> numbers = new Map<Integer, String>;
Which type of for loops are defined with the following syntax?

FOR(initstmt; exit_condition; increment stmt){
codeblock
}

O Traditional for loops
O List iteration for loops
O Set iteration for loops
O SOQLforloops
Traditional for loops
What name identifies datatypes such as Integer, Boolean, String and Enum in Salesforce?
Primitive
What are all the datatypes that Salesforce supports?
Primitive, sObject, Collections, Null
What datatype is used for standard or custom objects that store record data?
sObject
What are the five types of Apex procedural loops?
do-while loop, traditional for loop, list or set iteration loops, and soql for loops
Which syntax should you use to create a new public class named MyNewClass?
O public class MyNewClass {}
O class public MyNewClass {}
O class MyNewClass {} public
O MyNewClass public {} class
public class MyNewClass
Which access modifier should u specify for a class containing the webService keword?
O public
O private
O protected
O global
global
The method used to create an object out of a class definition is called a:
constructor
ft is necessary to instantiate an instance of a class to access a static method of the class.
O True
O False
FALSE
Which statement is true about an Apex class?
O A class cannot be disabled for profiles.
O An inner class can be nested at multiple levels.
O Static methods can only be declared in a top-level class definition.
O The default access modifier for methods in a class is public.
Static methods can only be declared in a top-level class definition.
Which keywords should u specify to define a constant?
O static and exception
O static and final
O static and private
O exception and final
static and final
What is a class?
A template from which objects are created
What two ways can classes be created in salesforce?
Through UI, Force.com IDE project
What are access modifiers used to implement?
Encapsulation principles
What do the ""with sharing"" and ""without sharing"" keywords help the developer to enforce?
Record level access
How are static methods and attributes access?
Through class itself
What is the this keyword used to represent?
Methods and attributes of the current instance of a class
What does Apex provide to support programmatic control of the workflow?
Apex process classes
What is the default return type of a sosl statement?
List of List Objects
What fields are not searched by sosl queries?
Dates, Ids, Numbers
Which fields are returned by sosl by default?
Ids
Each setSavepoint() and rollback statement counts against the total number of DML statements. True or false?
TRUE
Which of the following statements are true about a SOQL SELECT statement? (Selecta!!
that apply.)
□ It is similar to the SELECT statement in SQL.
□ It is used to perform searches across multiple sObjects.
□ It helps retrieve records from an object in the Force.com database.
□ It returns a list of lists of sObjects.
It is similar to the SELECT statement in SQL., It helps retrieve records from an object in the Force.com database.
What are the two ways to insert SOQL into Apex? (Select all that apply.)
□ DaLabase.search() method
□ Square-bracketed expressions
□ search() method
□ DaLabase.query() method
Square-bracketed expressions, DaLabase.query() method
Identify the data types that can be returned from SOQL. (Select all that apply.)
□ String
□ List of sObjects
□ Single sObject
□ Boolean
□ Integer
□ List of Aggregate Result
List of sObjects, Single sObject, Integer, List of Aggregate Result
How are parent-to-child sObject relationships named?
O plural name plus_r
O singular name plus_c
O singular name plus_r
O plural name plus_c
plural name plus__r
Match the SOQL keywords on the top with the correct description on the bottom.
IN
LIKE
NOT
GROUP BY

Is used for negative conditions in a SOQL.
Is used to select records using wildcards.
Is used to limit bulk queries.
Is used to control the order of the query results.
IN Is used to limit bulk queries.
LIKE Is used to select records using wildcards.
NOT Is used for negative conditions in a SOQL.
GROUP BY Is used to control the order of the query results.
Identify the clause that is used in a SOSL statement to limit results to specified object types.
O IN
O RETURNING
O WHERE
O ORDER BY
RETURNING
What statements are used to retrieve recofds from an sObject in the Force.com database?
SOQL statements
What type of loops are used to iterate over all sObject records returned by a SOQL query?
SOQL for loops
What are some examples of SOQL keywords?
In, like, and, or, not, group by, order by, all rows, limit
What two for forms of dml operations can be used in apex?
Standalone, database class methods
Which form of dml operation allows execution to occur with subsequent records even if an error occurs with a single record?
Database class method
List the execution order of triggers.
1. The original record is loaded from the database or initialized for insert.
2. The new record field values are loaded and old values are overwritten.
3. System validation rules are executed and required fields are verified.
4. All before triggers are executed.
5. Most system validation steps are run again and validation rules are checked.
6. The record is saved database, but not committed.
7. All after triggers are executed.
8. Assignment rules, auto-response rules, and workflow rules are executed.
9. Records are updated again if workflow fields are updated.
10. before and after triggers are executed again ¡f fields are updated based on workflow rules.
11. Escalation rules are executed.
12. Rollup summary formula or cross-object formula fields are updated in the parent records and affected records are saved.
13. Repeat the same process for affected grand parent records.
14. Criteria Based Sharing evaluation is executed.
15. All DML operations are committed to the database.
16. Post-commit logic is executed.
Trigger.new and Trigger.old can be used as part of the argument of a DML operation in Apex. TRUE or FALSE.
FALSE
Which trigger context variable is always read-only?
Trigger.old
Which trigger context variable cannot be deleted?
Trigger.new
Which trigger context variable allows you to modify field values before they are written to the database in the before trigger?
Trigger.new
Which trigger context variable is not saved in the after trigger and causes an exception to be thrown?
Trigger.new
The before trigger can be used to access system-updated field values and affect changes
in other records.
O True
O False
FALSE
Drag the definitions on the right to the appropriate keywords on the left.

new
size
oldMap
newMap

Returns a map of IDs for the new versions of sObject records.
Returns a map relating the record IDs to the existing records in the database.
Is used to return the total number of new and old records.
Is a collection that returns a list for the new versions of sObject records.
new - Is a collection that returns a list for the new versions of sObject records.
size - Is used to return the total number of new and old records.
oldMap - Returns a map relating the record IDs to the existing records in the database.
newMap - Returns a map of IDs for the new versions of sObject records.
An upsert event is associated with two separate events, delete and update.
O True
O False
FALSE
How many times will a trigger execute for 1,001 records?
O 5
O 6
O 10
O 11
6
What trigger method is used to correlate IDI-to-sObject maps?
Trigger.newMap, Trigger.oldMap
What trigger method is used to help prevent completion of a DML event?
addError
What is the size of the batches in which triggers execute?
200
What types of sharing are available to developers to share records?
Manual sharing, apex sharing
Which of the following statements identifies the block of code that can handle a particular
exception?
O catch
O finally
Otry
O throw
catch
Identify the true statement about system logs. (Select all that apply.)
□ The Apex debug statement output is written in the system log,
□ System log records errors and system processes that occur in an organization.
□ System log contains the stack trace of any uncaught exceptions if system log is open
and is executing Apex code.
□ System log contains variables in scope at the end of execution and their sizes.
The Apex debug statement output is written in the system log, System log records errors and system processes that occur in an organization, System log contains the stack trace of any uncaught exceptions if system log is open and is executing Apex code.
A good unit test must
O Not use the System.assert() methods.
O Use at least five records to make the test execution meaningful.
O Make calls to methods using both valid and invalid inputs.
O Not check governor limits.
Make calls to methods using both valid and invalid inputs.
What does Apex use to record disruptions in code execution?
Exceptions
Which keywords do developers use to handle exceptions in Apex?
Throw, try, catch, finally
What are the types of exception classes developers can choose between in Apex?
System-defined, user-defined
What are two key tools to debug code in Salesforce?
Logs, anonymous blocks
What are the two types of logs?
System, debug
What are the three ways to run unit tests?
Salesforce ui, force.com ide, runTests web service
Sequence the steps in the correct order to deploy Apex code using Force.com IDE.
Validate deployment.
Click Force.com I Deploy to Server.
Execute deployment.
Select the items to migrate.
Enter authentication credentials.
Enter the path for destination and project archives.
1. Click Force.com I Deploy to Server.
2. Enter authentication credentials.
3. Enter the path for destination and project archives.
4. Select the items to migrate.
5. Validate deployment.
6. Execute deployment.
Match the tasks given on the left to the development stages on the right.
Unit testing
Functional testing
Integration testing
Deployment

In the code development stage
Before full regression testing
Before integration testing
During staging
Unit testing - Before integration testing
Functional testing - During staging
Integration testing - In the code development stage
Deployment - Before full regression testing
What are the four ways to deploy Apex code?
Force.com IDE for developers, force.com migration tool, changesets, third-party tools
Can apex code be created directly in the production environment?
No
What components must be deployed manually to the production environment?
Queues, time triggers
What are the stages of an application development process?
Develop, integrate, stage, production/training
Webservice methods can be instance methods. TRUE or FALSE
FALSE, they must be static
Webservice methods cannot be overloaded. TRUE or FALSE
TRUE
What code is the webservice keyword not allowed to be used?
code contained in a trigger
What is the maximum size of a SOAP request or response?
3 MB
What is the maximum size of a SOAP request or response regulated by?
a governor limit
Under what profile do Webservice methods execute by default?
System
How can the default profile under which Webservices execute be changed?
with sharing keyword
What annotation can be used with Web Services to allow unrestricted queries when no DML operations are necessary?
@ReadOnly
What is the maximum number of callouts that can be made in a single Apex transaction?
10
What is the default request time out of a callout in a single Apex transaction?
120 seconds
How many loopback connections to Salesforce are allowed by callouts?
1
What is required to allow endpoints to be accesed from Salesfsorce?
must be registered in Your Name | Setup | Security Controls | Remote Site Settings
You can call Web Services from external sources using SOAP Web Service Callouts.
True
False
TRUE
Which of the following guidelines are used for creating custom Web Services? (Select all
that apply.)
□ webservice methods must be static.
□ webservice methods cannot be overloaded.
□ A system-defined enum can be used anywhere in a webservice method.
□ All classes that contain methods defined with the webService keyword must be declared as private.
webservice methods must be static, webservice methods cannot be overloaded
Identify the XMLstrearn classes that provide methods to read and write XML strings.
(Select all that apply.)
□ XMLStreanWriter
□ XMLWriter
□ XMLStreamReader
□ XMLReader
XMLStreanWriter, XMLStreamReader
Identify the classes that u can use to make HTTP or RESTful callouts. (Select all that
apply.)
□ HTTP class
□ HTTPRequesL class
□ HTTPServerRequest. class
□ HTTPRsponse class
□ HTTPServerResponse class
HTTP class, HTTPRequesL class, HTTPRsponse class
What keyword is used to create custom Web Services from an apex method?
Webservice
What are two ways to invoke a custom web service?
Ajax toolkit, client program
How do you call Web Services from external sources?
SOAP Web Service Callouts
What are some RESTful service callout HTTP verbs?
GET, POST, PUT, DELETE
List the HTTP classes available in Salesforce?
HTTPRequest, HTTPResponse, HTTP
What do email services use to process inbound emails?
Apex classes
What does each email service have for which users can send messages?
Salesforce-generated email address
An email service processes only those messages that are received for its addresses. TRUE or FALSE.
TRUE
What is the total number of messages that all email services put together can process in a day?
number of user licenses multiplied by 1000
What dictates how email messages beyond the daily limit are handled?
failure response settings
What options are available for the handling of email messages beyonod the daily limit?
bounced, discarded, queued
Target email addresses created in the sandbox can be deployed to the production org. TRUE or FALSE.
FALSE
What are the steps for setting up inbound email services?
1. Create the email handler class shell
2. Configure an email service.
3. Complete the email handler class.
4. Configure failure response settings.
5. Generate service email addresses.
6. Activate service email addresses.
7. Test inbound email.
What three classes along with the Messaging.InboundEmailHandler are used to handle inbound email messages in Salesforce?
Messaging.InboundEmail, Messaging.InboundEmailResult, Messaging.InboundEnvelope
What is the name of the method used to send emails from Salesforce in Apex?
Messaging.sendEmail
What are the two properties of the sendEmail method?
isSuccess, sendEmailError
Sequence the steps to set up an inbound email service.
1) Create the shell of an email handler class.
2) Configure the email service.
3) Generate target email addresses.
4) Complete the email handler class.
5) Test the class.
Identify the true statements about email messages. (Select all that apply.)
□ You can restrict the domains from which an email service can receive emails.
□ Inbound email service allows binary attachments only.
□ Emails sent using Apex to internal Salesforce users count against the org email limits
for the day.
□ You can use email templates to send mass emails to users.
□ Miltiple email addresses can be generated per service.
You can restrict the domains from which an email service can receive emails., Miltiple email addresses can be generated per service.
How does the Email service process inbound emails?
Apex classes
What interface does the Apex email handler implement to setup and inbound email service?
Messaging.InboundEmailHandler
What determines how the email service responds when an attempt to access the email service fails?
Failure response settings
How can the status of emails be tracked?
Debug logs, email logs
What email addresses can emails be sent to out of Salesforce?
Internal and external
How should one prevent soql injection when using dynamic soql?
Utilize the String.escapeSingleQuotes(string) method
What is the list of steps to match regular expressions using the Pattern and Matcher classes?
1. Instantiate a pattern object from the expression you wish to match.
2. Instantiate a matcher object from the pattern that contains the string you want
to check.
3. Use the matcher object to detect if the matcher matches the pattern.
What are the components of dyanamic Apex?
Schema describe, dynamic soql, dynamic sosl and dynamic dml
What components of apex are available to improve the processing of data in Salesforce?
Batch apex, apex scheduler.
Which of the following statements are true about components of dynamic Apex?
O Schema describe is a way to program matically learn about the metadata of your data
model within Apex.
O Dynamic SOQL refers to the creation of a SOQL string before runtime within an Apex
script,
O In dynamic SQQL, you use Sring.escapeSinqIeQuoLes (sLrng)to prevent
SQQL injection.
O You can use dynamic SOSL to create a tree structure of all the objects and fields in
your schema browser.
Schema describe is a way to program matically learn about the metadata of your data model within Apex.
List the hierarchy of steps to access object data and properties when utilizing dynamic apex describe information.
1. Generate a list or map of tokens for the sObjects in your organization.
2. Determine the sObject you need to access.
3. Generatethe describe result for the sObject.
4. Generate a map of field tokens for the sObject.
5. Generate the describe result for the field the script needs to access."
YOU MIGHT ALSO LIKE...