Dev 1 3/17

Dev 1 3/17

1st Grade

8 Qs

quiz-placeholder

Similar activities

weird

weird

1st - 5th Grade

4 Qs

Visa Quiz

Visa Quiz

1st - 6th Grade

4 Qs

Employment Basics

Employment Basics

1st - 5th Grade

5 Qs

Presentation Florence MARRONNIER

Presentation Florence MARRONNIER

1st - 12th Grade

5 Qs

Pathfinder Onboarding Day 2

Pathfinder Onboarding Day 2

KG - 5th Grade

9 Qs

Do you remember that?

Do you remember that?

KG - University

7 Qs

BMM4023 - Topic 10

BMM4023 - Topic 10

1st Grade

13 Qs

quiz 01

quiz 01

1st Grade

4 Qs

Dev 1 3/17

Dev 1 3/17

Assessment

Quiz

Business

1st Grade

Hard

Created by

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

Media Image

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

Media Image

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.