Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Language Atlas (mini-courses for more languages) Module 12

Elm and The Elm Architecture interview questions

Interview questions on elm and The Elm Architecture: short warm-ups, then what each harder question tests, the first step of a good answer and its follow-ups.

12 questions: 4 warm-ups and 8 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    Where does an Elm application record the versions of its packages, and what is ~/.elm for?

    Answered in the lesson Elm 0.19.3: install, build and run headlessly

  2. Fresher to mid

    What do Maybe and Result replace in JavaScript, and how do you get a value out of one?

    Answered in the lesson Elm for JavaScript developers

  3. Fresher to mid

    What are the parts of The Elm Architecture, and who calls them?

    Answered in the lesson The Elm Architecture, JSON and ports

  4. Fresher to mid

    Why does the splitter work in whole paise instead of rupees with decimals?

    Answered in the lesson Project: a bill-splitter app in Elm

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Fresher to senior

    Your Elm app's CI starts every job on a fresh machine. On some days the build fails at its first step with PROBLEM LOADING PACKAGE LIST, while builds on laptops work. Nobody changed elm.json. What is going on, and how do you make the CI build reliable?

    What it tests
    Knowing what elm init and elm make fetch, the role of ~/.elm and ELM_HOME, elm.json as its own lock file, and caching dependencies in CI without weakening reproducible builds.
    First step
    Separate the versions from the files. elm.json already fixes every version, direct and indirect, so nothing is being resolved differently; what fails is the download. A fresh machine starts with an empty ~/.elm and must reach package.elm-lang.org before it can build, while a laptop's cache is full, which is why the same project builds there even offline.
    Follow-ups

    From the lesson Elm 0.19.3: install, build and run headlessly

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  2. Mid to staff

    Your admin dashboard is a large JavaScript app. A team wants to write a new multi-step refund flow in Elm, and the flow must use the dashboard's date picker and its signed-in session. Do you agree, and how do you introduce Elm so that the risk stays small?

    What it tests
    Weighing Elm's compile-time guarantees against the cost of the JavaScript border, embedding Browser.element in an existing page, designing flags and ports, and planning a rollout that can be undone.
    First step
    Start from what Elm buys here: a flow with many states that must never mix is where custom types and the compiler's checks pay most. Then count the border crossings: the date picker and the session are JavaScript, so each needs a flag, a port or a custom element. If they are few and stable, embed one Browser.element on the refund page only.
    Follow-ups

    From the lesson Elm 0.19.3: install, build and run headlessly

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Fresher to senior

    The refunds screen of your Elm app shows a refund of 5 paise as 0.95 rupees, while positive amounts look right and every existing test passes. The formatter uses paise // 100 and modBy 100 paise. Explain the bug, fix it, and say which tests would have caught it.

    What it tests
    Knowing Elm's truncating // against the floored modBy, handling the sign when formatting money, and choosing test values at the edges: negative amounts, zero and amounts under one rupee.
    First step
    Work -5 through by hand. -5 // 100 is 0, because // drops the fraction towards zero, while modBy 100 -5 is 95, because modBy takes the sign of the modulus. The two halves of the amount come from different rounding rules, and they agree only for amounts of 0 and more.
    Follow-ups

    From the lesson Elm for JavaScript developers

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Mid to staff

    After a release, the browser console of your Elm app shows "Compiled in DEV mode", and a Debug.log line prints customer totals. The CI log of the deploy ends with Success!. What happened in the pipeline, and how do you fix it so that it cannot happen again?

    What it tests
    Reading DEBUG REMNANTS, knowing that a failed elm make leaves the earlier output in place, trusting exit statuses over log text, and designing a build step that fails closed.
    First step
    Find the optimised build in the CI log. If it printed DEBUG REMNANTS, it failed with exit status 1 and wrote nothing, even though the screen ended with Success!. Then check what was uploaded: the file an earlier development build left in the output folder, which still holds the DEV mode warning and the Debug.log call.
    Follow-ups

    From the lesson Elm for JavaScript developers

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Mid to staff

    Your Elm app shows a payment status that a third-party JavaScript library reports through a port. In production some sessions stop updating, and the console shows "Trying to send an unexpected type of value through port". What is going on, and how do you make that border robust?

    What it tests
    Knowing how typed ports check values, why the exception lands in the sender's JavaScript, ports of type Json.Decode.Value with decoders, and keeping evidence of bad values.
    First step
    Read where the exception is thrown: in the JavaScript that called send, because the value did not match the port's declared type. The library sometimes sends another shape, such as a string or an object where the port wants an Int, and the throw also skips whatever came after send in that callback, which is why the sessions stop updating.
    Follow-ups

    From the lesson The Elm Architecture, JSON and ports

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Mid to staff

    The orders API is moving to a new response format with prices in a nested object, and for a few weeks the server will send both formats. Your Elm app decodes orders. How do you change the decoders, test them and roll out without errors for either format?

    What it tests
    Versioned decoders with andThen or oneOf, strict optional fields, tests on recorded documents of both formats, and the order of a rollout between a server and its clients.
    First step
    Agree on how a document says which format it is: a version field is best, read first, as the lesson's decoder does. Then add a decoder for the new shape beside the old one, both producing the same Order, and keep both strict, so that an unexpected document fails with a path instead of being half read.
    Follow-ups

    From the lesson The Elm Architecture, JSON and ports

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Mid to staff

    Users of your Elm bill splitter notice that the diner whose name comes first always pays the odd paise, a few paise every week. Change the rule so that it is fair over time without breaking the guarantee that the shares add up, and say how you would test it.

    What it tests
    Separating the sum guarantee from the allocation rule, designing a deterministic rotation, keeping old bills reproducible, and testing both properties with fuzz tests.
    First step
    Keep the part that makes the shares add up, equal whole parts plus a leftover from 0 to n - 1 that is always given out, and change only who receives the leftover. A rotation that starts each item where the previous item's leftover stopped spreads the odd paise, and it gives the same answer for the same bill every time.
    Follow-ups

    From the lesson Project: a bill-splitter app in Elm

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  8. Fresher to senior

    A diner says the splitter's total is 2 paise more than the restaurant's printed bill. The restaurant applies tax once to the subtotal, while the splitter rounds tax on each item. Which is right, and how do you make the app match the receipt without breaking the shares?

    What it tests
    Understanding rounding per item against rounding per bill, how far apart they can be, making the rounding rule a choice of the bill, and reconciling a total with a printed document.
    First step
    Show that both follow a rule: rounding each item's tax half up can differ from rounding the subtotal's tax by up to half a paisa per item, so four items of 1450 paise at 5 percent give 4 × 73 = 292 paise of tax when each item is rounded, but 290 on the subtotal of 5800. The receipt is what the diners pay, so the app should be able to follow it.
    Follow-ups

    From the lesson Project: a bill-splitter app in Elm

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes

All Language Atlas (mini-courses for more languages) interview questions · The Language Atlas (mini-courses for more languages) track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.