Information Theory interview question

StatisticsInformation Theorybasic

In information theory, what does the Shannon entropy H(X) of a discrete random variable measure?

  1. AThe average squared distance of the outcomes from the mean of X, computed as Σ p(x)(x − μ)².
  2. BThe probability of the single most likely outcome, so a higher entropy means one outcome is more certain.
  3. CThe average uncertainty, or expected information content, of an outcome, computed as −Σ p(x) log p(x).
  4. DThe number of distinct values X can take, no matter how the probability is spread across those values.
Show the answer and explanation

Correct answer: C, The average uncertainty, or expected information content, of an outcome, computed as −Σ p(x) log p(x).

Explanation Information Theory

Shannon entropy H(X) = −Σ p(x) log p(x) is the expected information content (surprise) of an outcome, i.e. how uncertain we are, on average, about the value of X before seeing it.

DistributionEntropy (bits)
one certain outcome0
coin with p = 0.9 / 0.1≈ 0.469
fair coin1
uniform over 4 values2

Why the other statements are wrong:

  • Σ p(x)(x − μ)² is the variance; it depends on the numeric values of X, while entropy depends only on the probabilities.
  • A dominant outcome means low entropy, not high: the more predictable X is, the smaller H(X).
  • The number of values only sets the maximum entropy, log n, reached by the uniform distribution; a skewed distribution over the same values has lower entropy.

Interview tip: connect it to ML: decision trees using the entropy criterion pick splits that maximize information gain (the drop in entropy), and cross-entropy loss builds on the same quantity.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Statistics questions

  1. What is the difference between descriptive and inferential statistics?
  2. To stress-test a ratio metric, a data scientist simulates 10,000 draws of the ratio of two independent standard normal noise terms (a standard Cauchy…
  3. before and after hold the weekly spend of the same 40 customers before and after a loyalty-tier change, in the same customer order. What does this ttest_ind…
  4. A pricing team fits the demand model below on weekly store data. How should the coefficient on ln(price) be interpreted?
  5. Two analysts plot kernel density estimates (KDEs) of the same 5,000 basket values from a grocery chain, one with a bandwidth of 10 € and one with 2 €. The two…