Set 2 Flashcards
Given the following trigger implementation:
trigger leadTrigger on Lead (before update){
final ID BUSINESS_RECORDTYPEID = ‘012500000009Qad’;
for(Lead thisLead : Trigger.new){
if(thisLead.Company != null && thisLead.RecordTypeId != BUSINESS_RECORDTYPEID){
thisLead.RecordTypeId = BUSINESS_RECORDTYPEID;
}
}
}
The developer receives deployment errors every time a deployment is attempted from Sandbox to Production.
What should the developer do to ensure a successful deployment?
A. Ensure the deployment is validated by a System Admin user on Production.
B. Ensure BUSINESS_RECORDTYPEID is retrieved using Schema.Describe calls.
C. Ensure a record type with an ID of BUSINESS_RECORDTYPEID exists on Production prior to deployment.
D. Ensure BUSINESS_RECORDTYPEID is pushed as part of the deployment components.
C
Which three statements are true regarding custom exceptions in Apex? (Choose three.) A. A custom exception class name must end with "Exception".
B. A custom exception class cannot contain member variables or methods.
C. A custom exception class must extend the system Exception class.
D. A custom exception class can implement one or many interfaces.
E. A custom exception class can extend other classes besides the Exception class.
A, C, D
What is the order of operations when a record is saved in Salesforce?
A. Workflow, process flows, triggers, commit
B. Workflow, triggers, process flows, commit
C. Triggers, workflow, process flows, commit
D. Process flows, triggers, workflow, commit
C
In the following example, which sharing context will myMethod execute when it is invoked?
A. Sharing rules will not be enforced for the running user.
B. Sharing rules Ml be enforced for the running user.
C. Sharing rules will be inherited from the calling context.
D. Sharing rules Ail be enforced by the instantiating class
C
What are two ways for a developer to execute tests in an org?
A. Tooling API
B. Bulk API
C. Developer console
D. Matadata API
A, C
Universal Containers wants to back up all of the data and attachments in its Salesforce org once month. Which approach should a developer use to meet this requirement?
A. Use the Data Loader command line.
B. Define a Data Export scheduled job.
C. Create a Schedulable Apex class.
D. Schedule a report.
B
A team of many developers work in their own individual orgs that have the same configuration at the production org. Which type of org is best suited for this scenario?
A. Developer Sandbox
B. Developer Edition
C. Full Sandbox
D. Partner Developer Edition
A
What is the value of the Trigger.old context variable in a Before Insert trigger?
A. An empty list of sObjects
B. null
C. A list of newly created sObjects without IDS
D. Undefined
B
A developer of Universal Containers is tasked with implementing a new Salesforce application that must be able to by their company’s Salesforce administrator.
Which three should be considered for building out the business logic layer of the application? Choose 3 answers
A. Scheduled Jobs
B. Invocable Actions
C. Process Builder
D. Workflows
E. validation Rules
C, D, E
A developer needs to join data received from an integration with an external system with parent records in Salesforce. The data set does not contain the Salesforce IDs of the parent records, but it does have a foreign key attribute that can be used to identify the parent.
Which action will allow the developer to relate records in the data model without knowing the Salesforce ID?
A. Create and populate a custom field on the parent object marked as an External ID.
B. Create a custom field on the child object of type Foreign Key
C. Create a custom field on the child object of type External Relationship.
D. Create and populate a custom field on the parent object marked as Unique
A
Refer to the following code that runs in an Execute Anonymous block:
for (List theseLeads : [SELECT LastName, Company, Email FROM Lead LIMIT 20000]) { for (Lead thisLead : theseLeads) { if (thisLead.Email == null) { thisLead.Email = assignGenericEmail(thisLead.LastName, thisLead.Company); } } Database.Update(theseLeads, false); }
A. The total number of records processed as a result of DML statements will be exceeded
B. The total number of DML statements will be exceeded.
C. The total number of records processed as a result of DML statements will be exceeded.
D. In an environment where the full result set is returned, what is a possible outcome of this code?
E. The transaction will succeed and the first ten thousand records will be committed to the database.
A
what are the three languages used in the visualforce page?
A. Javascript, CSS, HTML
B. C++, CSS, query
C. Apex, Json, SQL
A
Which aspect of Apex programming is limited due to multitenancy?
A. The number of records returned from database queries
B. The number of active Apex classes
C. The number of methods in an Apex Class
D. The number of records processed in a loop
A
How many accounts will be inserted by the following block ofcode? for(Integer i = 0 ; i < 500; i++) { Account a = new Account(Name='New Account ' + i); insert a; } 0 87. Boolean odk; Integer x; if(abok=false;integer=x;){ X=1; }elseif(abok=true;integer=x;){ X=2; }elseif(abok!=null;integer=x;){ X=3; )elseif{ X=4;} A. X=10
B. X=4
C. X=8
D. X=9
B
//Example 1: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId];
for (AggregateResult ar : groupedResults) {
System.debug(‘Campaign ID’ + ar.get(‘CampaignId’));
System.debug(‘Average Amount’ + ar.get(‘expr0’));
}
//Example 2: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId];
for (AggregateResult ar : groupedResults) {
System.debug(‘Campaign ID’ + ar.get(‘CampaignId’));
System.debug(‘Average Amount’ + ar.get(‘theAverage’));
}
//Example 3: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId];
for (AggregateResult ar : groupedResults) {
System.debug(‘Campaign ID’ + ar.get(‘CampaignId’));
System.debug(‘Average Amount’ + ar.get.AVG());
}
//Example 4: AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId];
for (AggregateResult ar : groupedResults) {
System.debug(‘Campaign ID’ + ar.get(‘CampaignId’));
System.debug(‘Average Amount’ + ar.theAverage);
}
Which two examples above use the system. debug statements to correctly display the results from the SOQL aggregate queries? Choose 2 answers
A. Example 1
B. Example 2
C. Example 3
D. Example 4
A, B
A developer created a Visualforce page and custom controller to display the account type field as shown below. Custom controller code:
public class customCtrlr{ private Account theAccount; public String actType; public customCtrlr() { theAccount = [SELECT Id, Type FROM Account WHERE Id = \:apexPages.currentPage().getParameters().get('id')]; actType = theAccount.Type; } }
Visualforce page snippet:
The Account Type is {!actType} The value of the account type field is not being displayed correctly on the page. Assuming the custom controller is property referenced on the Visualforce page, what should the developer do to correct the problem?
A. Add a getter method for the actType attribute.
B. Change theAccount attribute to public.
C. Convert theAccount.Type to a String.
D. Add with sharing to the custom controller.
A
A developer must create a CreditcardPayment class that provides an implementation of an existing Payment class. Public virtual class Payment { public virtual void makePayment(Decimal amount) { /*implementation*/ } } Which is the correct implementation? A. Public class CreditCardPayment implements Payment { public virtual void makePayment(Decimal amount) { /*implementation*/ } }
B. Public class CreditcardPayment extends Payment { public override void makePayment(Decimal amount) { /*implementation*/ } }
C. Public class CreditCardPayment implements Payment { public override void makePayment(Decimal amount) { /*Implementation*/ } }
D. Public class CreditCardPayment extends Payment { public virtual void makePayment(Decimal amount) { /*implementation*/ } }
B
Universal Containers (UC) decided it will not to send emails to support personnel directly from Salesforce in the event that an unhandled exception occurs. Instead, UC wants an external system be notified of the error. What is the appropriate publish/subscribe logic to meet these requirements? A. Publish the error event using the Eventbus.publish() method and have the external system subscribe to the event using CometD.
B. Publish the error event using the addError() method and have the external system subscribe to the event using CometD.
C. Have the external system subscribe to the BatchApexError event, no publishing is necessary.
D. Publish the error event using the addError() method and write a trigger to subscribe to the event and notify the external system.
A
A Licensed_Professional__c custom object exist in the system with two Master-Detail fields for the following objects: Certification__c and Contact. Users with the “Certification Representative” role can access the Certification records they own and view the related Licensed Professionals records, however users with the
“Salesforce representative” role report they cannot view any Licensed professional records even though they own the associated Contact record. What are two likely causes of users in the “Sales Representative” role not being able to access the Licensed Professional records? Choose 2 answers
A. The organization’s sharing rules for Licensed_Professional__c have not finished their recalculation process.
B. The organization has a private sharing model for Certification__c, and Certification__c is the primary relationship in the Licensed_Professional__c object.
C. The organization has a private sharing model for Certification__c, and Contact is the primary relationship in the Licensed_Professional__c object
D. The organization recently modified the Sales representative role to restrict Read/Write access to Licensed_Professional__c
B, C
Which exception type cannot be caught?
A. NoAccessException
B. CalloutException
C. Custom Exception
D. LimitException
D
Which two characteristics are true for Aura component events?
A. Only parent components that create subcomponents (either in their markup or programmatically) can handle events.
B. Calling event, stopPropagation ( ) may or may not stop the event propagation based of the current propagation phase.
C. The event propagates to every owner In the containment hierarchy.
D. If a container component needs to handle a component event, add a handleFacets=’’ attribute to Its handler.
B, C
Universal Containers (UC) uses a custom object called Vendor. The Vendor custom object has a Master-Detail relationship with the standard Account object. Based on some internal discussion, the UC administrator tried to change the Master-Detail relationship to a Lookup relationship but was not able to do so. What is a possible reason that this change was not permitted? A. The Account object is included on a workflow on the Vendor object.
B. The Vendor object must use a Master-Detail field for reporting.
C. The Vendor records have existing values in the Account object.
D. The Account records contain Vendor roll-up summary fields.
D
A custom object Trainer_c has a lookup field to another custom object Gym___c.
Which SOQL query will get the record for the Viridian City gym and it’s trainers?
A. SELECT ID FROM Trainer_c WHERE Gym__r.Name - Viridian City Gym’
B. SELECT Id, (SELECT Id FROM Trainers__r) FROM Gym_C WHERE Name . Viridian City Gym’
C. SELECT Id, (SELECT Id FROM Trainers) FROM Gym_C WHERE Name - Viridian City Gym’
D. SELECT Id, (SELECT Id FROM Trainer_c) FROM Gym_c WHERE Name - Viridian City Gym’
B
A developer is tasked to perform a security review of the ContactSearch Apex class that exists in the system. Whithin the class, the developer identifies the following method as a security threat:
List performSearch(String lastName){ return Database.query('Select Id, FirstName, LastName FROM Contact WHERE LastName Like %'+lastName+'%); }
What are two ways the developer can update the method to prevent a SOQL injection attack? Choose 2 answers
A. Use the @Readonly annotation and the with sharing keyword on the class.
B. Use variable binding and replace the dynamic query with a static SOQL.
C. Use the escapeSingleQuote method to sanitize the parameter before its use.
D. Use a regular expression on the parameter to remove special characters.
B, C
Which Apex class contains methods to return the amount of resources that have been used for a particular governor, such as the number of DML statements? A. Limits
B. Exception
C. OrgLimits
D. Messaging
A
A custom picklist field, Food_Preference__c, exist on a custom object. The picklist contains the following options: ‘Vegan’,’Kosher’,’No Preference’. The developer must ensure a value is populated every time a record is created or updated. What is the most efficient way to ensure a value is selected every time a record is saved?
A. Set a validation rule to enforce a value is selected.
B. Mark the field as Required on the field definition.
C. Set “Use the first value in the list as the default value” as True.
D. Mark the field as Required on the object’s page layout.
B
What is the maximum number of SOQL queries used by the following code?
List aList = [SELECT Id FROM Account LIMIT 5]; for (Account a : aList){
List cList = [SELECT Id FROM Contact WHERE AccountId = :a.Id);
}
A. 6
B. 5
C. 1
D. 2
A
Application Events follow the traditional publish-subscribe model. Which method is used to fire an event?
A. Emit()
B. FireEvent()
C. RegisterEvent()
D. Fire()
D
A developer needs to have records with specific field values in order to test a new Apex class.
What should the developer do to ensure the data is available to the test?
A. Use Test.Loaddata () and reference a static resource.
B. Use SOQL to query the org for the required data.
C. Use Anonymous Apex to create the required data.
D. Use Test.Loaddata () and reference a CSV file
A
Which three resources in an Aura Component can contain Javascript functions? Choose 3 answers
A. Helper
B. Renderer
C. Controller
A, B, C