PD1 Study Notes Flashcards

1
Q

Three considerations for using the @InvocableMethod annotation in Apex?

A
  1. Only one method using the @InvocableMethod annotation can be defined per Apex class.
  2. A method using the @Invocablemethod annotation must be declared static.
  3. A method using the @Invocable Method annotation can be declared as public or global.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are two ways a developer can get the status of an enqueued job for a class that implements the queueable interface?

A
  1. Query the AsyncApexJob object.

2. View the Apex Jobs Page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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 Soql to query the org for the required data.
B. Use Test.loadData() and reference a static resource.
C. Use Anonymous Apex to create the required data.
D. Use Test.loadData() and reference a CSV file.

A

B. Use Test.loadData() and reference a static resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A developer observes that an Apex test method fails in the Sandbox. To identify the issue, the developer copies the code inside the test method and executes it via the Execute Anonymous tool in the Developer Console. The code then executes with no exceptions or errors. Why did the test method fail in the sandbox and pass in the Developer Console?

A. The test method does not use the System.runAs to execute as a specific user.
B. The test method has a syntax error in the code.
C. The test method is calling a @future method.
D. The test method relies on existing data in the sandbox.

A

D. The test method relies on existing data in the sandbox.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A developer wants to import 500 Opportunity records into a sandbox. Why should the developer choose to use Data Loader instead of Data Import Wizard?

A. Data loader automatically relates Opportunities to Accounts.
B. Data Import Wizard cannot import all 500 records.
C. Data Loader runs from the developer’s browser.
D. Data Import Wizard does not support Opportunities.

A

D. Data Import Wizard does not support Opportunities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which three steps allow a custom SVG to be included in a Lightning web component? Choose 3 answers.

A. Reference the import in the HTML template.
B. Upload the SVG as a static resource.
C. Reference the getter in the HTML template.
D. Import the SVG as a content asset file.
E. Import the static resource and provide a getter for it in the JavaScript.

A

B. Upload the SVG as a static resource.
C. Reference the getter in the HTML template.
E. Import the static resource and provide a getter for it in the JavaScript.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A developer has a requirement to create an order when an Opportunity reaches a Closed-Won status. Which tool should be used to implement this requirement?

A. Process Builder
B. Lightning component.
C. Lightning flow.
D. Apex Trigger

A

A. Process Builder

This is because order is related to opportunity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A developer is asked to create a Visualforce page for opportunities that allows a user to save or merge the current record. What approach should the developer need to meet this requirement?

A. Custom controller
B. Visualforce page JavaScript.
C. Standard controller extension.
D. Custom controller extension.

A

C. Standard controller extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A developer must build an application that tracks which Accounts have purchased specific piece of equipment Products. Each Account could purchase many pieces of equipment. How should the developer track that an Account has purchased a piece of equipment?\

A. Use a Lookup on Account to Product.
B. Use a Custom object.
C. Use a Master-Detail on Product to Account.
D. Use the Asset object.

A

D. Use the Asset object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What should a developer do to check the code coverage of a class after running all tests?

A. View the Code Coverage column in the list view on the Apex Classes Page.
B. View the overall Code Coverage panel of the Test tab in the Developer Console.
C. Select and run the class on the Apex Test Execution page.
D. View the Class Test Coverage tab on the Apex Class record.

A

B. View the overall Code Coverage panel of the Test tab in the Developer Console.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A developer created this Apex trigger that calls
MyClass.myStaticMethod: trigger myTrigger on Contact(before insert) {
MyClass.myStaticMethod(trigger.new, trigger.oldMap); }

The developer creates a test class with a test method that calls MyClass.myStaticMethod, resulting in 81% overall code coverage. What happens when the developer tries to deploy the trigger and two classes to production, assuming no other code exists?

A. The deployment passes because both classes and the trigger were included in the deployment.
B. The deployment fails because no assertions were made in the test method.
C. The deployment fails because the Apex trigger has no code coverage.
D. The deployment passes because the Apex code has required (>75%) code coverage.

A

C. The deployment fails because the Apex trigger has no code coverage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A developer is debugging the following code to determine why Accounts are not being created. Account a = new Account(Name = ABC); Database.insert(a, false); How should the code be altered to help debug the issue?

A. Collect the insert method value in a SaveResult record.
B. Set the second insert method parameter to TRUE.
C. Add a try/catch around the insert method.
D. Add a System.debug() statement before the insert method.

A

A. Collect the insert method value in a SaveResult record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

An after trigger on the Account object performs a DML update operation on all of the child Opportunities of an Account. There are no active triggers on the Opportunity object, yet a “maximum trigger depth exceeded” error occurs in certain situations. Which two reasons possibly explain the Account trigger firing recursively? (Choose two.)

A. Changes are being made to the Account during Criteria Based Sharing evaluation.
B. Changes are being made to the Account during an unrelated parallel save operation.
C. Changes to Opportunities are causing roll-up summary fields to update on the Account.
D. Changes to Opportunities are causing cross-object workflow field updates to be made on the Account.

A

C. Changes to Opportunities are causing roll-up summary fields to update on the Account.
D. Changes to Opportunities are causing cross-object workflow field updates to be made on the Account.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A developer wants multiple test classes to use the same set of test data. How should the developer create the test data?

A. Define a variable for test records in each test classes.
B. Create a test setup method for each test class.
C. Reference a test utility class in each test class.
D. Use the seealldata=true annotation in each test class.
A

C. Reference a test utility class in each test class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which three methods help ensure quality data? 3 Answers

A. Create a lookup filter.
B. Adding an error to a field in before trigger.
C. Handling an exception in Apex.
D. Adding a validation rule.
E. Sending an email alert using a workflow rule.

A

A. Create a lookup filter.
B. Adding an error to a field in before trigger.
D. Adding a validation rule.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which standard field is required when creating a new contact record?

A. LastName
B. Name
C. AccountID
D. FirstName

A

A. LastName

17
Q

A developer is creating a page that allows users to create multiple opportunities. The developer is asked to verify the current user’s default opportunity record type and set certain default values based on the record type before inserting the record. How can the developer find the current user’s default record type?

A. Create the opportunity and check the opportunity record type before inserting, which will have the record ID of the current user’s default record type.
B. Use the schema.userinfo.opportunity.getDefaultRecordType() method.
C. Query the profile where the ID equals user info.getprofileID() and then use the profile.opportunity,getDefaultRecordTypes() method.
D. Query the profile where the ID equals user info.getprofileID() and then use the profile.opportunity.getDefaultRecordType() method.
E. Use the Opportunity.SobjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until isDefaultRecordTypeMapping() is true.

A

E. Use the Opportunity.SobjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until isDefaultRecordTypeMapping() is true.

17
Q

A developer is creating a page that allows users to create multiple opportunities. The developer is asked to verify the current user’s default opportunity record type and set certain default values based on the record type before inserting the record. How can the developer find the current user’s default record type?

A. Create the opportunity and check the opportunity record type before inserting, which will have the record ID of the current user’s default record type.
B. Use the schema.userinfo.opportunity.getDefaultRecordType() method.
C. Query the profile where the ID equals user info.getprofileID() and then use the profile.opportunity,getDefaultRecordTypes() method.
D. Query the profile where the ID equals user info.getprofileID() and then use the profile.opportunity.getDefaultRecordType() method.
E. Use the Opportunity.SobjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until isDefaultRecordTypeMapping() is true.

A

E. Use the Opportunity.SobjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until isDefaultRecordTypeMapping() is true.

18
Q

A developer must troubleshoot to pinpoint the causes of performance issues when a custom page loads in their org. Which tool should the developer use to troubleshoot?

A. Virtual Studio Code IDE
B. Setup Menu
C. AppExchange
D. Developer Console

A

D. Developer Console

19
Q

A developer needs to implement the functionality for a service agent to gather multiple pieces of information from customer in order to send a replacement credit card. Which automation tool meets these requirements?

A. Lightning component
B. Approval Process
C. Flow Builder
D. Process Builder

A

C. Flow Builder

20
Q

How can a developer check the test coverage of active process builders and flows before deploying them in a change set?

A. Use the flow properties page
B. Use SOQL and the Tooling API
C. Use the ApexTestResult class
D. Use the code coverage setup page

A

B. Use SOQL and the Tooling API

21
Q

Universal Containers wants Opportunities to be locked from editing when reaching the Closed/Won stage. Which two strategies can a developer use to accomplish this? Choose 2 answers.

A. Use the process automation settings
B. Use a validation rule
C. Use flow builder
D. Use a trigger

A

B. Use a validation rule

D. Use a trigger

22
Q

What is an example of a polymorphic lookup field in Salesforce?

A. The LeadId and ContactId fields on the standard Campaign Member object
B. The WhatId field on the standard Event object
C. The ParentId field on the standard Account object
D. A custom field Link c, on the standard Contact object that looksup to an Account or a Campaign

A

B. The WhatId field on the standard Event object

23
Q

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. 2
B. 5
C. 1
D. 6

A

D. 6

24
Q

What is the result of the following code? Account a = new Account(); Database.insert(a, false);

A. The record will be created and no error will be reported
B. The record will be created and a message will be in the debug log
C. The record will not be created and no error will be reported
D. The record will not be created and an exception will be thrown

A

C. The record will not be created and no error will be reported

Account requires a name field.

25
Q

Which aspect of Apex programming is limited due to multi-tenancy?

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

A. The number of records returned from database queries

26
Q

Which scenario is valid for execution by unit tests?

A. Load data from a remote site with a callout
B. Set the created date of a record using a system method
C. Execute Anonymous Apex as a different user
D. Generate a visualforce PDF with getContentAsPDF()

A

A. Load data from a remote site with a callout

27
Q

Which three statements are accurate about debug logs? Choose 3 answers.

A. Debug log levels are cumulative, where FINE log level includes all events logged at the DEBUG, INFO, WARN and ERROR levels
B. Amount of information logged in the debug log can be controlled programmatically
C. To View Debug Logs, “Manage Users” or “Modify All Data” permission is needed
D. To View Debug Logs, “Manage Users” or “View All Data” permission is needed
E. Amount of information logged in the debug log can be controlled by the log levels

A

A. Debug log levels are cumulative, where FINE log level includes all events logged at the DEBUG, INFO, WARN and ERROR levels
D. To View Debug Logs, “Manage Users” or “View All Data” permission is needed
E. Amount of information logged in the debug log can be controlled by the log levels

28
Q

Which two statements are accurate regarding Apex classes and interfaces? Choose 2 answers.

A. Inner classes are public by default
B. A Top-level class only have one inner class level
C. Classes are final by default
D. Interface methods are public by default
A
B. A Top-level class only have one inner class level
C. Classes are final by default
29
Q

Which two statements are true about getter and setter methods as they relate to Visualforce? Choose two answers.

A. There is no guarantee for the order in which getter or setter methods are executed
B. Setter methods always have to be declared global
C. Getter methods can pass a value from a controller to a page
D. Setter methods are required to pass a value from a page to a controller

A

C. Getter methods can pass a value from a controller to a page
D. Setter methods are required to pass a value from a page to a controller

30
Q

While writing an Apex class that creates Accounts, a developer wants to make sure that all required fields are handled properly. Which approach should the developer use to be sure that the Apex class works correctly?

A. include a try/catch block to the Apex class
B. Run the code in an Execute Anonymous block
C. Add the business logic to a test class
D. Perform a code review with another developer

A

A. include a try/catch block to the Apex class