Salesforce coding lessons for the 99%
Finally, Apex tutorials for point-and-click admins! Written by a self-taught Google engineer.
  • Beginner Tutorials
    • Apex
    • Certifications
    • Career Info
    • Technical Architect
    • Visualforce
    • Videos
  • Apex Academy
  • Success Stories
  • About Me
  • Misc
    • Mailbag
    • Challenges
    • Links
    • Login to my Org
Follow @dvdkliuor SUBSCRIBE!

Quiz – Chapter 3

January 30, 2014

Preface – This post is part of the Core Apex Tools series.

Chapter 3 Questions:

1. What is ‘2’ + ‘2’?

2. What kind of data type is this value? true

3. Which of the following are sObjects?
– Account
– Task
– Opportunity Line Item
– Account Contact Role
– Contact History
– Price Book

4. What’s the difference between a List and a Set? What type is Trigger.new?

5. You have a list of “yummyDonuts” with values “chocolate glaze”, “cream filled”, and “jelly”, in that order. What does yummyDonuts[1] return? How about yummyDonuts[3]?

6. What is wrong with this dot notation: myContact.Best_Friend__c.Account.Opportunities.size()

7. What are two methods you can use on any List using dot notation?

8. What kind of variable would you need to store the output of this dot notation? myOpportunity.Account.Tasks

9. How many times would this loop run?
List leads = [SELECT Id FROM Lead LIMIT 99];
for (Integer i = 1; i < leads.size(); i++) { // Drink a beer }

10. When should you use == as a comparison operator and when should you use .equals()?

11. Select true or false for each of these scenarios. The opportunity is in stage ‘Closed Won’:
!opp.StageName.equals(‘Negotiation’) || !opp.StageName.equals(‘Closed Won’)

!(opp.StageName.equals(‘Open’) && opp.StageName.equals(‘Pending’))

!opp.StageName.equals(‘Demo’) && (!opp.StageName.equals(‘Open’) && !opp.StageName.equals(‘Closed Lost’))

opp.StageName.equals(‘Pending’) || (!opp.StageName.equals(‘Demo’) && opp.StageName.equals(‘Closed Won’))

12. What will my status be if I buy two dozen Krispy Kreme donuts?
String status;
if (donuts.size() > 20) {
  status = ‘Heartburn’;
} else if (donuts.size() > 10) {
  status = ‘Eazy Peazy’;
} else if (donuts.size() == 24) {
  status = ‘King of Donut Land!’;
}

13. What’s wrong with this DML code?
Contact me = new Contact();
me.FirstName = ‘David’;
me.LastName = ‘Liu’;
update me;

14. Does this DML statement work?
List<Account> accounts = [SELECT Id FROM Account];
delete accounts;

Answers

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


*

*

Theme: Simple Style by Fimply