
Dev 1 3/17

Quiz
•
Business
•
1st Grade
•
Hard
Megan Santos
FREE Resource
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A developer wishes to write a test for a private method within a class, how can this be best achieved?
Write a test which executes the public method which calls the private method to be tested
Annotate the private method with @TestVisible
Annotate the test class with @Istest(seePrivate=true)
Change the access modifier to be public
Answer explanation
Using the @TestVisible annotation allows a test method to access a private or protected method or class variable, instanced or static. This
change in access is only applied for test classes and doesn’t affect the access of the class in any other way.
Utilising this annotation allows the original access modifier to be used without sacrificing the ability to precisely test a specific piece of code
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
You have a Visualforce page displaying an Opportunity record. You wish to display details about the Account record linked to this Opportunity.
This page utilises the standard controller. How could you add the Account name to the page?
Create a controller extension which queries the required details on Account
Reference the Account fields using {!opportunity.Account.fieldName}
Replace the standard controller with the standard relationship controller
Write a custom controller to query all required records
Answer explanation
The standard controller for Visualforce provides lots of data access opportunities for the record it is operating on. Notably, it allows access to parent objects, being able to traverse up 5 levels of parent child relationships. For example, you could access details about an Account records owner from an Opportunity. The standard controller also offers 1 level of parent-child traversal, i.e. you could access the Contacts belonging to an Account.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What would be the result of executing the following Apex test?
The test would successfully run
A “List has no rows for assignment to SObject” error would be thrown
A “Index 0 is out of bounds” error would be thrown
The System.assert() would fail
Answer explanation
When running a query which returns no rows, a “List has no rows for assignment to SObject” error will be thrown. An index out of bounds error
would not be thrown in this scenario since we are not directly trying to access an element from an array.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A custom field was added to Opportunity which has become redundant due to new business processes. What must be done before deleting the
field?
Remove all references to the field within the org
Set the Field Usage value on the field to DeprecateCandidate
Schedule the field for deletion via the API
Remove all field values on all Opportunity records
Answer explanation
Before a field can be deleted all references to that field must be removed. These references could be found within declarative tools, such as
reports and flows, or within code. Attempting to delete the field which is referenced elsewhere will throw an error.
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the primary purpose of creating test classes in Apex?
Generate enough code coverage for deployment
Ensure the code executes successfully
Test that the logic within a class is behaving as expected
To check for conflicts with configuration changes
Answer explanation
Test classes within Salesforce play a very important role: they are used to determine whether a piece of code is behaving exactly as it was
intended to.
Properly written tests can act as early warning signs for when things go wrong, and can help easily identify specific pieces of code that are no
longer behaving as expected (for example, due to conflicting with a recently introduced Process Builder or Flow).
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A Lead has been converted to a Contact and Account, which triggers are fired?
Only triggers on Contact
Only triggers on Account
Only triggers on Lead
Triggers on Lead, Contact and Account
Triggers on Contact and Account
Answer explanation
Lead conversion causes Apex triggers to fire, the scope of which depends on the records the Lead is being converted to, but at a bare minimum the triggers on the Lead object are fired. If a Lead is creating or updating any secondary objects, those objects also have their triggers fired.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following statements is true about sharing keywords of Apex classes?
Inner classes inherit the sharing mode from the outer class
Inner classes do not inherit the sharing mode from the outer class
Inner classes must match their outer classes sharing mode
Inner classes must always use with sharing
Answer explanation
Inner classes can have their own sharing modes declared, which don’t have to match that of the outer classes. This can be useful for nesting specific methods which require without sharing inside a class which has with sharing declared.
8.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
You are building an application which tracks student enrollments on a course. A student can be enrolled on many different courses at once and a
course has many students enrolled on it. What data model should be used to track a student’s enrollments on a course and ensure data integrity?
• Create a lookup relationship on the student record pointing to the course
• Create a junction object with a lookup to both the student and the course
• Create a junction object with master-detail relationships to both the student and the course
• Create a lookup relationship on the course pointing the student
Create a lookup relationship on the student record pointing to the course
Create a junction object with a lookup to both the student and the course
Create a junction object with master-detail relationships to both the student and the course
Create a lookup relationship on the course pointing the student
Answer explanation
Since a student can be enrolled on many courses, and a course can have many students enrolled, we require a junction object to keep track of each student enrollment.
The relationships used to create this junction object should be master-detail. This will prevent orphaned records from being created and ensure both lookups are always populated.
Similar Resources on Wayground
12 questions
Calculating Unemployment Rate

Quiz
•
1st Grade
7 questions
PRODUCT MIX

Quiz
•
1st - 6th Grade
10 questions
MGT1103_Chapter 6_Leadership

Quiz
•
1st Grade
10 questions
Demand

Quiz
•
1st - 3rd Grade
12 questions
financial accounting

Quiz
•
1st - 3rd Grade
10 questions
FINAL EXAM

Quiz
•
1st Grade
5 questions
Higher Nitec in Accounting Talk

Quiz
•
1st Grade
10 questions
Microeconomics

Quiz
•
KG - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Business
18 questions
Hispanic Heritage Month

Quiz
•
KG - 12th Grade
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
addition

Quiz
•
1st - 3rd Grade
20 questions
Subject and predicate in sentences

Quiz
•
1st - 3rd Grade
20 questions
Addition and Subtraction facts

Quiz
•
1st - 3rd Grade
20 questions
Place Value

Quiz
•
KG - 3rd Grade
10 questions
Exploring Properties of Matter

Interactive video
•
1st - 5th Grade
10 questions
Odd and even numbers

Quiz
•
1st - 2nd Grade