Advanced Ruby
Q96 / 100

What is the difference between "Module#const_get" with inheritance lookup versus directly accessing a constant via "::"?

Correct! Well done.

Incorrect.

The correct answer is B) const_get by default also searches ancestors (included modules and superclasses) for the constant, similar to normal constant lookup, while a second boolean argument can disable ancestor search, giving finer control than "::" syntax

B

Correct Answer

const_get by default also searches ancestors (included modules and superclasses) for the constant, similar to normal constant lookup, while a second boolean argument can disable ancestor search, giving finer control than "::" syntax

Explanation

const_get(name, inherit = true) by default follows the normal constant resolution including ancestors; passing false restricts the search to the receiver itself, offering programmatic control not directly expressible with "::" syntax.

Progress
96/100