1.
What features are available when writing apex test classes? (Choose 2 Answers)
Correct Answer(s)
C. The ability to set and modify the CreatedDate field in apex tests.
E. The ability to select testing data using csv files stored in the system.
Explanation
The two features available when writing apex test classes are the ability to set and modify the CreatedDate field in apex tests and the ability to select testing data using csv files stored in the system.
2.
What is the easiest way to verify a user before showing them sensitive content?
Correct Answer
B. Calling the generateVerificationUrl method in apex.
Explanation
The easiest way to verify a user before showing them sensitive content is by calling the generateVerificationUrl method in apex. This method generates a verification URL that can be sent to the user. By clicking on the URL, the user can be redirected to a verification page where they can confirm their identity before accessing the sensitive content. This method eliminates the need for sending SMS or email messages with passcodes, making it a simpler and more efficient verification process.
3.
A developer runs the following anonymous code block:
List<Account> acc = [SELECT Id FROM Account LIMIT 10];
Delete acc;
Database.emptyRecycleBin(acc);
system.debug(Limits.getDMLStatements()+ ', ' +Limits.getLimitDMLStatements());
What is the result?
Correct Answer
D. 2, 150
Explanation
The code block first queries for 10 Account records and stores them in the acc variable. Then, it attempts to delete the acc variable, which is not possible because it is a List and not an individual record. The code then tries to empty the recycle bin for the acc variable, but since it is not a record, this operation does not affect the recycle bin. Finally, the system.debug() statement outputs the number of DML statements used and the limit for DML statements, which is 2 and 150 respectively. Therefore, the result is 2, 150.
4.
On which object can an administrator create a roll-up summary field?
Correct Answer
A. Any object that is on the master side of a master-detail relationship.
Explanation
An administrator can create a roll-up summary field on any object that is on the master side of a master-detail relationship. This is because a roll-up summary field calculates values from related records and displays the result on the master record. In a master-detail relationship, the master record controls the behavior and access to the detail records, making it the appropriate object to create a roll-up summary field.
5.
Which statement about the Lookup Relationship between a Custom Object and a Standard Object is correct?
Correct Answer
C. The Custom Object will be deleted when the referenced Standard Object is deleted.
Explanation
The correct answer is that the Custom Object will be deleted when the referenced Standard Object is deleted. This is because a Lookup Relationship creates a dependency between the two objects, where the Custom Object relies on the existence of the Standard Object. If the Standard Object is deleted, the Custom Object no longer has a valid reference and is also deleted.
6.
Where can debug log filter settings be set? Choose 2 answers
Correct Answer(s)
A. The Filters link by the monitored user's name within the web UI
D. The Log Filters tab on a class or trigger detail page.
Explanation
The debug log filter settings can be set in two places. First, they can be set by clicking on the "Filters" link next to the monitored user's name within the web UI. Second, they can be set on the "Log Filters" tab on a class or trigger detail page.
7.
On a Visualforce page with a custom controller, how should a developer retrieve a record by using an ID that is passed on the URL?
Correct Answer
A. Use the constructor method for the controller
Explanation
In order to retrieve a record by using an ID passed on the URL in a Visualforce page with a custom controller, the developer should use the constructor method for the controller. This method allows the developer to access the ID parameter from the URL and use it to query the record from the database. By retrieving the record in the constructor, the developer can then use it to populate the page fields or perform any necessary operations.
8.
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?
Correct Answer
C. PaymentTax.SalesTax
Explanation
The SalesTax variable is defined as a public static variable within the PaymentTax class.
Since it is public static, it can be accessed using the class name PaymentTax followed by the variable name SalesTax.
Therefore, PaymentTax.SalesTax is the correct syntax to access the value of SalesTax within the trigger.
9.
What is the result when a Visualforce page calls an Apex controller, which calls another Apex class, which then results in hitting a governor limit?
Correct Answer
B. Any changes up to the error are rolled back.
Explanation
When a Visualforce page calls an Apex controller, which in turn calls another Apex class, if hitting a governor limit occurs, any changes made up to the error will be rolled back. This means that any modifications or updates made before reaching the governor limit will not be saved and will be reverted back to their previous state.
10.
When the number of record in a recordset is unknown, which control statement should a developer use to implement a set of code that executes for every record in the recordset, without performing a .size() or .length() method call?
Correct Answer
C. For (variable : list_or_set) { }
Explanation
The correct answer is "For (variable : list_or_set) { }". This control statement is known as a "for-each" loop and is used to iterate through elements in a list or set without needing to know the size of the collection beforehand. It automatically handles the iteration and provides access to each element in the collection one at a time.
11.
Which one do you like?
Correct Answer
A. Option 1