IAE Academy

CORE JOBS

Artificial Intelligence interview questions

Short answers on the fundamentals, for the technical round of core-job interviews. 22 questions for DS & AI students; the numericals show the working.

Companies do not publish their interview questions; these are ours.

Download the PDF (238 KB)

Propositional and predicate logic

Logic notes
  1. What is the difference between a tautology, a contradiction and a satisfiable formula?

    A tautology is true under every assignment, and a contradiction is false under every assignment. A satisfiable formula is true under at least one assignment, so every tautology is satisfiable and no contradiction is. A formula is a tautology exactly when its negation is a contradiction.

  2. What does it mean for a knowledge base to entail a sentence?

    A knowledge base entails a sentence , written , when every assignment that makes all of true also makes true. Equivalently, is unsatisfiable. This is a statement about meaning, which is separate from whether a proof procedure finds a derivation.

  3. Why does proof by resolution add the negation of the goal to the clauses?

    Resolution is a refutation method. It shows by showing that is unsatisfiable, which is reached when the empty clause is derived. All sentences must first be in clause (CNF) form. Resolution is sound, and refutation-complete for propositional logic.

  4. Over the three propositional variables , and , in how many of the 8 truth assignments is true?

    The formula is true in 5 of the 8 assignments, because only 3 assignments make it false: those where is true and is false. An implication is false only in that case.

    WORKING

    1. An implication is false only when its premise is true and its conclusion is false.
    2. Premise is true for 3 of the 4 settings of .
    3. Conclusion is false in 1 way, so the formula is false in rows.
    4. True rows .
  5. Why is "every student likes some course" written with an implication after the universal quantifier and a conjunction after the existential one?

    The sentence is . The implication limits the claim to students, since a conjunction after would say everything is a student. The conjunction after asserts that such a course exists, while an implication there would be satisfied by anything that is not a course.

  6. What is unification in first-order logic, and why is the occurs check needed?

    Unification finds a substitution that makes two expressions identical, ideally the most general one. For and it gives . The occurs check rejects binding a variable to a term that contains it, such as with , which would create an infinite term.

  7. Four propositional variables , , and give 16 truth assignments. How many of them satisfy the clause ?

    The clause is satisfied by 14 of the 16 assignments, since only 2 assignments make it false. A disjunction fails only when every literal is false, which fixes false, true and false, and leaves free.

    WORKING

    1. A disjunction is false only when every literal is false.
    2. That needs false, true and false: 1 setting of .
    3. Variable is free, so there are 2 falsifying assignments.
    4. Satisfying assignments .

Reasoning under uncertainty

Uncertainty notes
  1. What is a Bayesian network, and how does it give the joint distribution?

    A Bayesian network is a directed acyclic graph with one node per random variable and a conditional table at each node. The joint distribution is the product of these tables: . When each node has few parents, this stores far fewer numbers than the full joint table.

  2. Boolean variables and have no parents, has parents and , and has parent . How many independent probabilities does this Bayesian network need, and how many does the full joint table need?

    The network needs 8 independent probabilities, against 15 for the full joint table over four Boolean variables. Each Boolean node needs one number per setting of its parents, for Boolean parents, so the network stores .

    WORKING

    1. A Boolean node with Boolean parents needs probabilities.
    2. : 1, : 1, : , : .
    3. Network total .
    4. Full joint .
  3. How do chain, fork and collider structures differ in d-separation?

    In a chain and a fork , the path is blocked when is observed. A collider is the reverse: the path is blocked while neither nor any descendant of is observed, and observing either opens it.

  4. Why is variable elimination cheaper than inference by enumeration?

    Enumeration sums the full joint product for every combination of the hidden variables, repeating the same sub-products many times. Variable elimination sums out one variable at a time and stores the result as a factor that is reused. Its cost depends on the elimination order, and a poor order can still be expensive.

  5. What is the difference between rejection sampling and likelihood weighting?

    Rejection sampling draws full samples from the prior and throws away those that disagree with the evidence, which wastes many samples when the evidence is unlikely. Likelihood weighting fixes the evidence variables, samples only the others, and weights each sample by the probability of the evidence given its parents.

  6. How does Gibbs sampling estimate a posterior probability?

    Gibbs sampling fixes the evidence variables and starts from an arbitrary state. It repeatedly resamples one non-evidence variable at a time from its distribution given its Markov blanket. In the long run the states visited follow the posterior, so the fraction of states with the query value estimates it. Successive samples are correlated.

  7. Rejection sampling draws 1000 samples from a network. The evidence is true in 200 of them, and the query variable is true in 150 of those 200. What is the estimate of ?

    The estimate of is 0.75, based on the 200 samples that agree with the evidence. The other 800 are rejected, and the estimate is the fraction of kept samples with true, .

    WORKING

    1. Samples that disagree with are rejected: discarded.
    2. Only the 200 consistent samples are counted.
    3. .
  8. For events and , , and . What is ?

    By Bayes' rule, is about 0.774. The denominator comes from summing and , so the probability of rises from 0.3 to about 0.77 once is known.

    WORKING

    1. .
    2. .
    3. .
    4. .