PD1 Study Notes Flashcards
Three considerations for using the @InvocableMethod annotation in Apex?
- Only one method using the @InvocableMethod annotation can be defined per Apex class.
- A method using the @Invocablemethod annotation must be declared static.
- A method using the @Invocable Method annotation can be declared as public or global.
What are two ways a developer can get the status of an enqueued job for a class that implements the queueable interface?
- Query the AsyncApexJob object.
2. View the Apex Jobs Page.
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.
B. Use Test.loadData() and reference a static resource.
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.
D. The test method relies on existing data in the sandbox.
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.
D. Data Import Wizard does not support Opportunities.
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.
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.
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. Process Builder
This is because order is related to opportunity.
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.
C. Standard controller extension.
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.
D. Use the Asset object.
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.
B. View the overall Code Coverage panel of the Test tab in the Developer Console.
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.
C. The deployment fails because the Apex trigger has no code coverage.
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. Collect the insert method value in a SaveResult record.
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.
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 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.
C. Reference a test utility class in each test class.
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. Create a lookup filter.
B. Adding an error to a field in before trigger.
D. Adding a validation rule.