Topic 2 : Exam Pool B
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
PaymentTax.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’ }
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’; }
An org has different Apex Classes that provide Account -related functionality.After a new validation rule is added to the object, many of the test methods fail.What can be done to resolve the failures and reduce the number of code changes needed for future validation rules?Choose 2 answers:
A.
Create a method that creates valid Account records, and call this method from within test methods.
B.
Create a method that loads valid Account records from a Static Resource, and call this method within
test methods.
C.
Create a method that performs a callout for a valid Account record, and call this method from within test
methods.
D.
Create a method that queries for valid Account records, and call this method from within test methods.
Create a method that creates valid Account records, and call this method from within test methods.
Create a method that loads valid Account records from a Static Resource, and call this method within
test methods.
A Visualforce page has a standard controller for an object that has a lookup relationship to a parent object. How can a developer display data from the parent record on the page?
A.
By adding a second standard controller to the page for the parent record.
B.
By using a roll-up formula field on the child record to include data from the parent record.
C.
By using SOQL on the Visualforce page to query for data from the parent record.
D.
By using merge field syntax to retrieve data from the parent record.
By using merge field syntax to retrieve data from the parent record.
Which standard field needs to be populated when a developer inserts new Contact records programmatically?
A.
Accountld
B.
Name
C.
LastName
D.
FirstName
LastName
Which Apex collection is used to ensure that all values are unique?
A.
A Set
B.
An Enum
C.
A List
D.
An sObject
A Set
A developer has a block of code that omits any statements that indicate whether the code block should execute with or without sharing. What will automatically obey the organization-wide defaults and sharing settings for the user who executes the code in the Salesforce organization?
A.
Apex Triggers
B.
HTTP Callouts
C.
Apex Controllers
D.
Anonymous Blocks
Anonymous Blocks
How can a developer refer to, or instantiate a PageReference in Apex? Choose 2 answers
A.
By using a PageReference with a partial or full URL.
B.
By using the Page object and a Visualforce page name.
C.
By using the ApexPages.Page() method with a Visualforce page name.
D.
By using the PageReference.Page() method with a partial or full URL.
By using a PageReference with a partial or full URL.
By using the Page object and a Visualforce page name.
A developer in a Salesforce org with 100 Accounts executes the following code using the Developer console:
Account myAccount = new Account(Name = 'MyAccount');Insert myAccount;For (Integer x = 0; x < 250;
x++)
{Account newAccount = new Account (Name='MyAccount' + x);try {Insert newAccount;}catch (Exception
ex) {System.debug (ex) ;}}insert new Account (Name='myAccount'); How many accounts are in the org after this code is run?
A.
101
B.
100
C.
102
D.
252
100
A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the initial URLWhich statement is unnecessary inside the unit test for the custom controller?
A.
Public ExtendedController (ApexPages.StandardController cntrl) { }
B.
ApexPages.currentPage().getParameters().put('input', 'TestValue')
C.
Test.setCurrentPage(pageRef),
D.
String nextPage = controller.save().getUrl();
Public ExtendedController (ApexPages.StandardController cntrl) { }
ApexPages.currentPage().getParameters().put('input', 'TestValue')
Page 18 out of 39 Pages |
Previous |