CRT-450 Practice Test

CRT-450 Practice Test practice questions, page 6 of 18, with answer review and explanations.

Question 26

What are two valid options for iterating through each Account in the collection List named AccountList? (Choose two.)

  1. for (Account theAccount : AccountList) {ג€¦}
  2. for(AccountList) {ג€¦}
  3. for (List L : AccountList) {ג€¦}
  4. for (Integer i=0; i < AccountList.Size(); i++) {ג€¦}

Question 27

Given: Map accountMap = new Map>ID, Account> ([SELECT Id, Name FROM Account]); What are three valid Apex loop structures for iterating through items in the collection? (Choose three.)

  1. for (ID accountID : accountMap.keySet()) {ג€¦}
  2. for (Account accountRecord : accountMap.values()) {ג€¦}
  3. for (Integer i=0; I < accountMap.size(); i++) {ג€¦}
  4. for (ID accountID : accountMap) {ג€¦}
  5. for (Account accountRecord : accountMap.keySet()) {ג€¦}

Question 28

Universal Containers wants Opportunities to be locked from editing when reaching the Closed/Won stage. Which two strategies should a developer use to accomplish this? (Choose two.)

  1. Use a Visual Workflow.
  2. Use a validation rule.
  3. Use the Process Automation Settings.
  4. Use a Trigger.

Question 29

How should a developer make sure that a child record on a custom object, with a lookup to the Account object, has the same sharing access as its associated account?

  1. Create a Sharing Rule comparing the custom object owner to the account owner.
  2. Create a validation rule on the custom object comparing the record owners on both records.
  3. Include the sharing related list on the custom object page layout.
  4. Ensure that the relationship between the objects is Master-Detail.

Question 30

An org has a single account named `˜NoContacts' that has no related contacts. Given the query: List accounts = [Select ID, (Select ID, Name from Contacts) from Account where Name=`˜NoContacts']; What is the result of running this Apex?

  1. accounts[0].contacts is invalid Apex.
  2. accounts[0].contacts is an empty Apex.
  3. accounts[0].contacts is Null.
  4. A QueryException is thrown.