Created by
Terms in this set (20)
What is a true statement regarding interfaces in Apex? (2)
a. An interface can only be defined as global.
b. An Apex class that implements an interface must provide a definition for all methods declared in the interface.
c. An Apex class can implement more than one interface at a time.
d. A method defined in an interface can have an access modifier.
a. An interface can only be defined as global.
b. An Apex class that implements an interface must provide a definition for all methods declared in the interface.
c. An Apex class can implement more than one interface at a time.
d. A method defined in an interface can have an access modifier.
Consider the following Anonymous block:
Account newAccount = new Account(Name='ABC Corp);
insert newAccount;
Contact newContact = new Contact(LastName = 'Smith', accountId = newAccount.Id);
insert newContact;
When this code executes, what is a true statement about the save order of execution? (Choose two correct answers.)
a. All custom validations defined on the Account object and the Contact object will be executed immediately after the insertion of newAccount.
b. The newly inserted Contact will not be associated to the referenced Account because the Id of the Account record is not available until the end of the transaction.
c. The Account record and the Contact record will be committed to the database at the end of the transaction, followed by the execution of any post-commit logic defined.
d. In the event of an uncaught exception while inserting the Account record, both insertions will be rolled back.
Account newAccount = new Account(Name='ABC Corp);
insert newAccount;
Contact newContact = new Contact(LastName = 'Smith', accountId = newAccount.Id);
insert newContact;
When this code executes, what is a true statement about the save order of execution? (Choose two correct answers.)
a. All custom validations defined on the Account object and the Contact object will be executed immediately after the insertion of newAccount.
b. The newly inserted Contact will not be associated to the referenced Account because the Id of the Account record is not available until the end of the transaction.
c. The Account record and the Contact record will be committed to the database at the end of the transaction, followed by the execution of any post-commit logic defined.
d. In the event of an uncaught exception while inserting the Account record, both insertions will be rolled back.
A developer needs to write an Apex controller that will be invoked from a Visualforce page. The Visualforce page should allow a user to search for a string of text within the standard Name field for the following objects:
Account, Contact, and Lead.
What is the optimal solution in the Apex controller to perform a text search across these objects?
a. For each sObject that needs to be searched, write a SOQL statement to search for the string of text. Then, combine the results of all of the SOQL statements into a single List<sObject> variable.
b. Write a single SOSL statement to search for the string of text across Account, Contact, and Lead.
c. Use dynamic SOQL to build a query at runtime that specifies which sObjects should be searched.
d. For each object that needs to be searched, write a SOSL statement to search for the string of text. Then, combine the results of all of the SOSL statements into a single List<List<sObject>> variable.
Account, Contact, and Lead.
What is the optimal solution in the Apex controller to perform a text search across these objects?
a. For each sObject that needs to be searched, write a SOQL statement to search for the string of text. Then, combine the results of all of the SOQL statements into a single List<sObject> variable.
b. Write a single SOSL statement to search for the string of text across Account, Contact, and Lead.
c. Use dynamic SOQL to build a query at runtime that specifies which sObjects should be searched.
d. For each object that needs to be searched, write a SOSL statement to search for the string of text. Then, combine the results of all of the SOSL statements into a single List<List<sObject>> variable.
A developer needs to change the value of the name field of an Account record by appending "- previously Deleted" when an Account record is restored from the Recycle Bin.
How can the developer accomplish this?
a. Define a before undelete Trigger.
b. Define an after undelete Trigger
c. Define a workflow field update to update the Name field.
d. Define a Process to update the Name field.
How can the developer accomplish this?
a. Define a before undelete Trigger.
b. Define an after undelete Trigger
c. Define a workflow field update to update the Name field.
d. Define a Process to update the Name field.