Topic 2 : Exam Pool B
A developer runs the following anonymous code block:List
A. 11, 150
B. 150, 2
C. 150, 11
D. 2, 150
Which trigger event allows a developer to update fields in the Trigger.new list without using an additional DML statement?Choose 2 answers
A. Before insert
B. Before update
C. After update
D. After insert
When creating unit tests in Apex, which statement is accurate?Choose 2
A. Unit tests with multiple methods result in all methods failing every time one method fails.
B. Increased test coverage requires large test classes with many lines of code in one method.
C. Triggers do not require any unit tests in order to deploy them from sandbox to production.
D. System Assert statements that do not Increase code coverage contribute important feedback in unit tests
The Review_c object have a lookup relationship to the job_Application_c object. The job_Application_c object has a master detail relationship up to the position_c object. The relationship is based on the auto populated defaults? What is the recommended way to display field data from the related Review _C records a Visualforce page for a single Position_c record? Select one of the following:
A. Utilize the Standard Controller for Position_c and cross-object Formula Fields on the Job_Application_c object to display Review_c data.
B. Utilize the Standard Controller for Position_c and a Controller Extension to query for Review_c data.
C. Utilize the Standard Controller for Position_c and expression syntax in the Page to display related Review_c through the Job_Applicacion_c inject.
D. Utilize the Standard Controller for Position_c and cross-object Formula Fields on the Review_c object to display Review_c data.
A company has a custom object named Warehouse. Each Warehouse record has a distinct record owner, and is related to a parent Account in Salesforce.Which kind of relationship would a developer use to relate the Account to the Warehouse?
A. One -to -Many
B. Lookup
C. Master -Detail
D. Parent -Child
How can a developer retrieve all Opportunity record type labels to populate a list collection?Choose 2 answers
A. Obtain describe object results for the Opportunity objct.
B. Write a for loop that extracts values from the Opportunity.RecordType.Name field.
C. Use the global variable $RecordType and extract a list from the map.
D. Write a SOQL for loop that iterates on the RecordType object
The Sales Management team hires a new intern. The intern is not allowed to view Opportunities, but needs to see the Most Recent Closed Date of all child Opportunities when viewing an Account record. What would a developer do to meet this requirement?
A. Create a trigger on the Account object that queries the Close Date of the most recent Opportunities.
B. Create a Workflow rule on the Opportunity object that updates a field on the parent Account.
C. Create a formula field on the Account object that performs a MAX on the Opportunity Close Date field.
D. Create a roll-up summary field on the Account object that performs a MAX on the Opportunity Close Date field.
What is an accurate constructor for a custom controller named "MyController"?
A. public MyController () { account = new Account () ; }
B. public MyController (sObject obj) { account = (Account) obj; }
C. public MyController (List objects) { accounts = (List ) objects; }
D. public MyController (ApexPages.StandardController stdController) { account = (Account) stdController.getRecord(); }
A developer is creating a test coverage for a class and needs to insert records to validate functionality. Which method annotation should be used to create records for every method in the test class?
A. @BeforeTest
B. @isTest(SeeAllData=True)
C. @TestSetup
D. @PreTest
A developer creates a method in an Apex class and needs to ensure that errors are handled properly.What would the developer use? (There are three correct answers.)
A. ApexPages.addErrorMessage()
B. A custom exception
C. .addError()
D. Database.handleException()
E. A try/catch construct
A developer has the following code block: public class PaymentTax {public static decimal SalesTax = 0.0875;} trigger OpportunityLineItemTrigger on OpportunityLineItem (before insert, before update) {PaymentTax PayTax = new PaymentTax();decimal ProductTax = ProductCost * XXXXXXXXXXX;} To calculate the productTax, which code segment would a developer insert at the XXXXXXXXXXX to make the value the class variable SalesTax accessible within the trigger?
A. SalesTax
B. PayTax.SalesTax
C. PaymentTax.SalesTax
D. OpportunityLineItemTngger.SalesTax
Which option would a developer use to display the Accounts created in the current week and the number of related Contacts using a debug statement in Apex?
A. For(Account acc: [SELECT Id, Name,(SELECT Id, Name FROM Contacts) FROM Account WHERE CreatedDate = THIS_WEEK]) { List cons = acc.Contacts; System.debug(acc.Name + ‘ has ’ + cons.size() + ‘Contacts’; }
B. For(Account acc: [SELECT Id, Name, (SELECT Id, Name FROM Contacts) FROM Account WHERE CreatedDate = CURRENT_WEEK]){ List cons = acc.Contacts; System.debug(acc.Name + ‘ has ‘ + cons.size() + ‘Contacts’); }
C. For(Account acc:[SELECT Id, Name, Account.Contacts FROM Account WHERE CreatedDate = CURRENT_WEEK]) { List cons = acc.Account.Contacts; System.debug(acc.Name + ‘ has ‘ + cons.size() + ‘Contacts’); }
D. For(Account acc: [SELECT Id, Name, Account.Contacts FROM Account WHERE CreatedDate = THIS_WEEK]){ List cons = acc.Account.Contacts; System.debug(acc.Name + ‘ has ‘ + cons.size() + ‘Contacts’ }
Page 14 out of 33 Pages |
Previous |