PD1 Flashcards
Given the following code snippet, that is part of a custom controller for a Visualforce page:
Public void updateContact(Contact thisContact){
thisContact.Is_Active__c = false;
try{
update thisContact;
}catch(Exception e){
string errormessage = ‘An Error has eccored’;
}
}
In which two ways can the try/catch be enclosed to enforce object and field-level permissions and prevent the DML statement from being executed if the current logged-in user does not have the appropriate level of access? Choose 2 answers
A. Use if (Schema, sobjectType, Contact, isUpdatable ( ) )
B. Use if (Schema , sobjectType. Contact. Field, Is_Acve_c. is Updateable ( ) )
C. Use if (Schema.sObjectType.Contact.isAccessible ( ) )
D. Use if (thisContact.Owner = = UserInfo.getuserId ( ) )
A,B
Refer to the following code snippet for an environment has more than 200 Accounts belonging to the Technology’ industry:
for(Account a : [select id, industry from Account limit 150]){
if(thisAccount.Industry == ‘Technology’){
thisAccout.is_tech__c = true;
}
update thisAccount;
}
When the code execuon, which two events occur as a result of the Apex transacon? When the code executes, which two events occur as a result of the Apex transacon? Choose 2 answers
A . If executed in an asynchronous context, the apex transacon is likely to fall by exceeding the DML governor limit
B . The Apex transacon succeeds regardless of any uncaught excepon and all processed accounts are updated.
C . The Apex transacon fails with the following message. ‘SObject row was retrieved via SOQL without querying the requested field Account.Is.Tech__c’’.
D . If executed In a synchronous context, the apex transacon is likely to fall by exceeding the DHL governor limit.
B,C
Which Lightning code segment should be written to declare dependencies on a Lightning component, c:accountList, that is used in a Visualforce page?
A . Opon A
B . Opon B
C . Opon C
D . Opon D
A
A development team wants to use a deployment script to automatically deploy to a sandbox during their development cycles.
Which two tools can they use to run a script that deploys to a sandbox? Choose 2 answers
A . Ant Migration Tool
B . SFDX CLI
C . Change Sets
D . Developer Console
Answer: A, B
A developer wants to mark each Account in a List as either or Inacve based on the LastModified field value being more than 90 days.
Which Apex technique should the developer use?
A . A for loop, with a switch statement inside
B . A Switch statement, with a for loop inside
C . An If/else statement, with a for loop inside
D . A for loop, with an if/else statement inside
D
Which Apex class contains methods to return the amount of resources that have been used for a parcular governor, such as the number of DML statements?
A . Excepon
B . Messaging
C . OrgLimits
D . Limits
D
A developer wants to get access to the standard price book in the org while writing a test class that covers an OpportunityLineItem trigger. Which method allows access to the price book?
A . Use Test.loadData ( )and a static resource to load a standard price book
B . Use @TestVisible to allow the test method to see the standard price book.
C . Use Test,getStandardPricebookid ( ) to get the standard price book ID.
D . Use @IsTest (SeeAllData=True) and delete the existing standard price book
C
Which two statements accurately represent the MVC framework implementation in Salesforce?
Choose 2 answers
A . Validation rules enforce business rules and represent the Controller (C) part of the MVC framework
B . Lightning component HTML files represent the Model (M) part of the MVC framework.
C . Triggers that create records represent the Model (M) part of the MVC framework.
D . Standard and Custom objects used in the app schema represent the View (V) part of the MVC framework
A,C
Universal Containers hires a developer to build a custom search page to help user- find the Accounts they want. Users will be able to search on Name, Descripon, and a custom comments field.
Which consideraon should the developer be aware of when deciding between SOQ1 Mid SOSI ?
Choose 2 answers
A . SOSL is able to return more records.
B . SOQL is faster for text searches.
C . SOSL is faster for tent searches.
D . SOQL is able to return more records.
C,D
A primaryid_c custom field exists on the candidate_c custom object. The filed is used to store each candidate’s id number and is marked as Unique in the schema definion.
As part of a data enrichment process. Universal Containers has a CSV file that contains updated data for all candidates in the system, f he file contains each Candidate’s primary id as a data point. Universal Containers wants to upload this informaon into Salesforce, while ensuring all data rows are correctly mapped to a candidate in the system.
Which technique should the developer implement to streamline the data upload?
A . Create a Process Builder on the Candidate_c object to map the records.
B . Create a before Insert trigger to correctly map the records.
C . A Update the primaryid__c field definion to mark it as an External Id
D . Upload the CSV into a custom object related to Candidate_c.
C
A developer needs to join data received from an integraon 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 aribute that can be used to idenfy the parent.
Which acon will allow the developer to relate records in the data model without knowing the Salesforce ID?
Create a custom field on the child object of type Foreign Key
A . Create and populate a custom field on the parent object marked as Unique
C . Create and populate a custom field on the parent object marked as an External 10.
D . Create a custom field on the child object of type External Relaonship.
C
What can be developed using the Lightning Component framework?
A . Hosted web applicaons
B . Single-page web apps
C . Dynamic web sites
D . Salesforce integraons
B
Which two characteriscs are true for Aura component events?
Choose 2
A . Calling event, stopPropagaon ( ) may or may not stop the event propagaon based of the current propagaon phase.
B . If a container component needs to handle a component event, add a handleFacets=’’ aribute to Its handler.
C . Only parent components that create subcomponents (either in their markup or programmacally) can handle events.
D . The event propagates to every owner In the containment hierarchy.
A,D
For which three items can a trace flag be configured?
Choose 3 answers
A . Process Builder
B . Visualforce
C . Apex Class
D . Apex Trigger
E . User
C,D,E
What are three capabilities of the < ltng: require > tag when loading JavaScript resources in Aura components?
Choose 3 answers
A . Loading files from Documents
B . One-me loading for duplicate scripts
C . Specifying loading order
D . Loading scripts In parallel
E . Loading externally hosted scripts
B, C, D
A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple subjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the inial URL.
Which three statements are useful inside the unit test to effectively test the custom controller?
Choose 3 answers
A . insert pageRef.
B . Test.setCurrentPage(pageRef);
C . public ExtendedController(ApexPages StandardController cntrl) { }
D . ApexPages.CurrentPage().getParameters().put(‘input', ‘TestValue’);
E . String nextPage - controller.save().getUrl();
B, D, E
What is the value of the Trigger.old context variable in a Before Insert trigger?
A . A list of newly created sObjects without IDS
B . Undefined
C . null
D . An empty list of sObjects
C
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, (SELECT Id FROM Trainers) FROM Gym_C WHERE Name . Viridian City Gym’
B . SELECT Id, (SELECT Id FROM Trainer_c) FROM Gym_c WHERE Name - Viridian City Gym’
C . SELECT ID FROM Trainer_c WHERE Gym__r.Name - Viridian City Gym’
D . SELECT Id, (SELECT Id FROM Trainers) FROM Gym_C WHERE Name - Viridian City Gym’
B
Was A but A is wrong
A workflow updates the value of a custom field for an existing Account. How can a developer access the updated custom field value from a trigger?
A . By wring, a Before Update trigger and accessing the field value from Trigger.new
B . By writing an After Insert trigger and accessing the field value from Trigger.old
C . By writing an Aer Update trigger and accessing the field value from Trigger.old
D . By writing a Before Insert trigger and accessing the field value from Trigger.new
A
A team of many developers work in their own individual orgs that have the same configuraon at the producon org. Which type of org is best suited for this scenario?
A . Developer Sandbox
B . Developer Edion
C . Full Sandbox
D . Partner Developer Edion
A
A developer wants to invoke on outbound message when a record meets a specific criteria. Which three features sasfy this use case?
Choose 3 answer
A . Approval Process has the capacity to check the record criteria and send an outbound message without Apex Code
B . Process builder can be used to check the record criteria and send an outbound message with Apex Code.
C . workflows can be used to check the record criteria and send an outbound message. D . Process builder can be used to check the record criteria and send an outbound messagewithout Apex Code.
E . Visual Workflow can be used to check the record criteria and send an outbound message without Apex Code.
Answer: A, B, C
A developer has to idenfy a method in en Apex class that performs resource intensive acons in memory by iterang over the result set of a SOQL statement on the account. The method also performs a SOQL statement to save the changes to the database.
Which two techniques should the developer implement as the best practice to ensure transaction control and avoid exceeding governor limits?
Choose 2 answers
A . Use the @ReadOnly annotation to bypass the number of rows returned by a SOQL.
B . Use Paral DHL statements to ensure only valid data is committed.
C . Use the Database.Savepoint method to enforce database Integrity.
D . Use the System.Limit class to monitor the current CPU governor limit consumption.
Answer: C, D
A developer needs to create a custom buon for the Account object that, when clicked, will perform a series of calculaon and redirect the user to a custom visualforce page.
Which three aributes need to be defined with values in the tag to accomplish this?
Choose 3 answers
A . renderAs
B . standard Controller
C . readOnly
D . Acon
E . extensions
Answer: A, B, E
Which action may cause triggers to fire?
A . Updates to Feed Items
B . Renaming or replacing a picklist entry
C . Changing a user’s default division when the transfer division opon it checked
D . Cascading delete operations
Answer: A