nerdexam
Salesforce

PDI · Question #91

In the following example, which starting context will mymethod execute it is invoked?

The correct answer is A. Sharig rules will be inherited from the calling context. This question pertains to the execution context of a method, specifically how sharing rules are applied when an Apex method is invoked without explicit sharing keywords.

Submitted by femi9· Apr 18, 2026Logic and Process Automation

Question

In the following example, which starting context will mymethod execute it is invoked?

Options

  • ASharig rules will be inherited from the calling context.
  • BSharig rules will be enforced for the running user.
  • CSharig rules will be enforced by the instartiating class.
  • DSharig rules will not be enforced for the running user.

How the community answered

(27 responses)
  • A
    89% (24)
  • B
    7% (2)
  • C
    4% (1)

Why each option

This question pertains to the execution context of a method, specifically how sharing rules are applied when an Apex method is invoked without explicit sharing keywords.

ASharig rules will be inherited from the calling context.Correct

By default, an Apex method executes with the sharing rules of the calling context, meaning it inherits the user's data visibility and access permissions from the code that invoked it.

BSharig rules will be enforced for the running user.

Sharing rules are not always enforced for the running user if the calling context is set to 'without sharing' or if the method itself is explicitly 'without sharing'.

CSharig rules will be enforced by the instartiating class.

Sharing rules are determined by the execution context, not by the instantiating class itself.

DSharig rules will not be enforced for the running user.

Sharing rules are typically enforced for the running user; the default behavior is to inherit the caller's sharing context, which usually includes enforcement.

Concept tested: Apex sharing context inheritance

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm

Topics

#Apex Sharing#Execution Context#Method Context#Sharing Inheritance

Community Discussion

No community discussion yet for this question.

Full PDI Practice