Intermediate Compilers & Programming Language Theory
Q75 / 100

What does "duck typing" mean in dynamically typed languages?

Correct! Well done.

Incorrect.

The correct answer is D) A style where an object's suitability is determined by the presence of certain methods or properties at runtime, rather than by its declared type — "if it walks like a duck and quacks like a duck, it is a duck"

D

Correct Answer

A style where an object's suitability is determined by the presence of certain methods or properties at runtime, rather than by its declared type — "if it walks like a duck and quacks like a duck, it is a duck"

Explanation

In Python or Ruby, a function that calls obj.read() will work with any object providing a compatible read method, regardless of its class hierarchy. The check happens dynamically at the call site rather than through static type declarations.

Progress
75/100