PD 2 Flashcards
The Contact object has a custom field called “Zone.” Its data type is “Text” and field length is 3.
What is the outcome after executing the following code snippet in the org?
List<Contact> contactsToBeInserted=new List<Contact>(); Contact contactInstance= new Contact(LastName='Smith',
Department='Tech', Zone_c='IAD'); contactsToBeInserted.add(contactInstance); contactInstance= new Contact
(LastName='Sm1th', Department='Tech', Zone_c='PITT'); contactsToBeInserted.add(contactInstance); Database.insert
(contactsToBeInserted,true);
A. Both inserts succeed and the contact record that has the Zone value of 'PI'I'I' is set to NULL
B. A partial insert succeeds and the contact record that has the Zone value 'IAD' is inserted
C. Both inserts succeed and the contact record that has the Zone value of 'PITT' is truncated
D. An unhandled DML exception is thrown and no contact records are inserted</Contact></Contact>
D. An unhandled DML exception is thrown and no contact records are inserted
ABC Company has an Apex process that makes multiple extensive database operation and web service callouts. The database processes and web services can take a length time to run and must be run sequentially.
How should the developer write this Apex code without running into governor limits and system limitations?
Use Limits class to stop entire process once governor limits are reached.
Use multiple @future methods for each process and callout.
Use Queueable Apex to chain the jobs to run sequentially.
Use Apex Scheduler to scheduled each process.
Use Limits class to stop entire process once governor limits are reached.
A developer needs to create a Lightning page for entering Order Information. An error message should be displayed if the zip code entered as part of the Order’s shipping address is not numeric.
What is a recommended way for the error message be displayed to the end user?
A. Use the apex:message tag to display errors
B. Use the aura:component tag to display errors
C. Use the ui:outputText tag to display errors
D. Use the ui:inputDefaultError tag to display errors
D. Use the ui:inputDefaultError tag to display errors
As part of point-to-point integration, a developer must call an external web service which, due
to high demand, takes a long time to provide a response. As part of the request, the developer must
collect key inputs from the end user before making the callout.
Which two elements should the developer use to implement these business requirements?
Choose 2 answers
A. Screen now
B. Process Builder
C. Lightning web component
D. Apex method that returns a Continuation object
C. Lightning web component
D. Apex method that returns a Continuation object
What are the ways a developer can create test data of Contacts? (Choose two.)
A. myDataFactory.createContacts(10)
B. Test.createTestData ()
C. Test.loadTestRecords(Contact.sObjectType, ‘staticResource’)
D. Test.loadData(Contact.sObjectType, ‘staticResource’)
A. myDataFactory.createContacts(10)
D. Test.loadData(Contact.sObjectType, ‘staticResource’)
A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on
the Opportunity’s Account whenever an Opportunity is dosed. In the test class for the trigger, the
assertion to validate the Last Sold Date field fails.
What might be causing the failed assertion?
A. The test class has not implemented seeAIIData-truwh the test method.
B. The test class has not re-queried the Account record after updating the Opportunity.
C. The test class has not defined an Account owner when inserting the test data.
D. The test class is not using System.runAs() to run tests as a Salesforce administrator.
B. The test class has not re-queried the Account record after updating the Opportunity.
A developer is building a Visualforce page that interacts with external services.
Which interface should the developer implement to test this functionality? (Choose two.)
A. HTTPCalloutMock
B. HTTPRequestMock
C. StaticResourceCalloutMock
D. HTTPResponseMock
A. HTTPCalloutMock
C. StaticResourceCalloutMock
Which annotation exposes an Apex class as a RESTful web service?
A . RemoteAction.
B . HttpInvocable.
C . AuraEnabled.
D . RestResource.
D . RestResource.
A developer created three Rollup Summary fields:
Total_timesheets_c, Total_Approved_timesheet_c and
Total_project_Timesheet_c in the custom object, project _c Now, the developer is tasked with created a new field to show the ratio between rejected and approved. what is two benefits using formula field instead of apex trigger
1.No test methods will be executed during deployment.
2.A test class that validates the formula field is needed for deployment.
3.Using a formula field reduces maintenance overhead.
4.A formula field will calculate the value retroactively for existing records
3.Using a formula field reduces maintenance overhead.
4.A formula field will calculate the value retroactively for existing records
An Apex Trigger creates a Contract record every time an Opportunity record is marked as Closed and Won. This trigger is working great, except (due to a recent acquisition) historical Opportunity records need to be loaded into the Salesforce instance. When a test batch of records is loaded, the Apex Trigger creates Contract records. A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created. What is the most extendable way to update the Apex Trigger to accomplish this?
A. Use a Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data.
B. Add a Validation Rule to the Contract to prevent Contract creation by the user who loads the data.
C. Use a List Custom Setting to disable the trigger for the user who loads the data.
D. Add the Profile ID of the user who loads the data to the trigger so the trigger will not fire for this user.
A. Use a Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data.
A developer is writing a complex application involving triggers, workflow rules, Apex classes, and processes. The developer needs to carefully consider the order of execution when developing the application.
1. Before Triggers
2. After Triggers
3. Post commit logic such as sending email
4. DML committed to the database
5. Workflow rules
6. Roll-up summary calculations
In what order do the following operations execute?
A. 1, 2, 5, 6, 4, 3
B. 1, 5, 6, 2, 4, 3
C. 1, 2, 4, 5, 6, 3
D. 1, 6, 5, 2, 4, 3
A. 1, 2, 5, 6, 4, 3
A developer wants to retrieve and deploy metadata, perform simple CSV export of query results, and debug Apex REST calls by viewing JSON responses.
Which tool should the developer use?
A. Developer Console
B. Force.com Migration Tool
C. Workbench
D. Force.com IDE
C. Workbench
A developer encounters an error that states that the Apex heap size is exceeded. Which technique may reduce heap size?
A. Add the transient keyword to the variable definition
B. Move the variable definition inside the scope of the function
C. Use static variables instead of instance variables
D. Use SOQL for loops instead of standard SOQL queries
D. Use SOQL for loops instead of standard SOQL queries
Which interface needs to be implemented by a Lightning Component so that it may be
displayed in modal dialog by clicking a button on a Lightning Record page?
A. Lightning:editAction
B.Force:lightningQuickAction
C. Force:lightningEditAction
D. Fightning:quickAction
B.Force:lightningQuickAction
The progress of an apex job queued is using the System.enqueueJob method and needs to be monitored.
Which options are valid? (Choose two.)
A. Use the Apex Jobs page in setup
B. Query the Queueable Apex record
C. Query the AsyncApexJob record
D. Use the Scheduled Jobs page in setup
A. Use the Apex Jobs page in setup
C. Query the AsyncApexJob record
A developer has been asked to create code that will meet the following requirements:
Receives input of: Map<Id, Project_c), List<Account>
Performs a potentially long-running callout to an outside web service
Provides a way to confirm that the process executed successfully
Which asynchronous feature should be used?
A. @future (callout=true)
B. Database.AllowCallouts interface
C. Schedulable interface
D. Queueable interface</Account>
D. Queueable interface
Which are relevant practices while analyzing the timeline of different types of transactions in the execution overview panel? (Choose two.)
A. Log lines in the execution log panel can be analyzed for details about specific events
B. The performance tree should be use to analyze events further starting from the one that take the least amount of time
C. The execution tree can be used with the execution log to filter and get specific information about events
D. Multiple short bursts of Apex events should be analyzed since they can add up to a significant amount of time
A. Log lines in the execution log panel can be analyzed for details about specific events
D. Multiple short bursts of Apex events should be analyzed since they can add up to a significant amount of time
A developer created the following test method:
The developer org has five accounts where the name starts with Test”. The developer executes this
test in the Developer Console.
After the test code runs, which statement is true?
A. The test will fail.
B. There will be five accounts where the name starts with Test”
C. There will be six accounts where the name starts with Test”.
D. There will be no accounts where the name starts with “Test”
B?
A Salesforce org has more than 50,000 contacts. A new business process requires a
calculation that aggregates data from all of these contact records. This calculation needs to run once
a day after business hours.
Which two steps should a developer take to accomplish this?
Choose 2 answers
A. Implement the Queuable Interface in the class that contains the aggregate calculation method.
B. Use the areadOnly annotation on the method that performs the aggregate calculation.
C. Implement the schedulable Interface In the class that contains the aggregate calculation method.
D. Use the @future annotation on the method that performs the aggregate calculation.
A. Implement the Queuable Interface in the class that contains the aggregate calculation method.
C. Implement the schedulable Interface In the class that contains the aggregate calculation method.
What is the transaction limit on the number of Apex jobs added to the queue?
A. 200
B. There is no limit
C. 50
D. 100
E. 150
C. 50
A company has reference data stored in multiple Custom Metadata records that represent
default information for certain.
When a Contact is inserted, the default information should be set on the Contact from the Custom
Metadata records .. Address information.
What is the optimal way to automate this?
A. Apex Trigger
B. Process Builder
C. Visual Flow
D. Workflow Rule
B. Process Builder?
If the “PageReference.setRedirect” Apex function is set to True, what type of request is
made?
A. Postback request
B. If PageReference points to the same controller and subset of extensions, postback request,
otherwise get request
C. Get request
C. Get request
A lead developer for a Salesforce organization needs to develop a page-centric application
that allows the user to interact with multiple objects related to a Contact The application needs to
implement a third-party JavaScript framework such as Angular, and must be made available in both
Classic and Lightning Experience.
Given these requirements, what is the recommended solution to develop the application?
A. Visualforce
B. Lightning Web Components
C. Aura Components
D. Lightning Experience Builder
A. Visualforce
A developer created an Opportunity trigger that updates the account rating when an
associated opportunity is considered high value. Current criteria for an opportunity to be considered
high value is an amount greater than or equal to SI,000,000. However, this criteria value can change
over time.
There is a new requirement to also display high value opportunities In a Lightning web component.Which two actions should the developer take to prevent the business logic that obtains the high
value opportunities from being repeated in more than one place?
Choose 2 answers
A. Leave the business logic code Inside the trigger for efficiency.
B. Create a helper class that fetches the high value opportunities.
C. Call the trigger from the Lightning web component.
D. Use custom metadata to hold the high value amount.
B. Create a helper class that fetches the high value opportunities.
D. Use custom metadata to hold the high value amount.
- >
C. List
- >