The WebAssembly Component Model enables language-agnostic, composable software. These exercises cover WIT as an IDL, the difference between components and modules, WASI Preview 2's interface-based design, and how composition links components together.
0 / 5 completed
1 / 5
At standup, a colleague asks what WIT stands for and what it is used for in WebAssembly. What is the correct answer?
WIT (WebAssembly Interface Types) is the Interface Definition Language for the WebAssembly Component Model. You write .wit files to declare the types, functions, and interfaces a component exports or imports. WIT definitions are language-agnostic — toolchains for Rust, Python, JavaScript, and Go generate bindings from the same .wit file, enabling components written in different languages to interoperate.
2 / 5
During a PR review, a teammate asks what a Component is in the WebAssembly Component Model vs a regular Wasm module. Which answer is correct?
A WebAssembly Component is a composable unit that builds on top of core Wasm modules. Key differences: components use WIT-defined interfaces with rich types (strings, lists, records, variants) instead of just integers and floats; components communicate via interface boundaries rather than shared linear memory; and components can be composed — linking an import of one component to an export of another without writing glue code. This enables safe, polyglot composition.
3 / 5
In a design review, the team discusses WASI Preview 2. A junior engineer asks what it improves over Preview 1. What is correct?
WASI Preview 2 is a fundamental redesign. Preview 1 exposed a flat, POSIX-like C ABI as a single monolithic module. Preview 2 defines WASI APIs as WIT interfaces in the Component Model — wasi:io, wasi:http, wasi:filesystem, wasi:clocks, etc. — each versioned independently. Components import only the WASI interfaces they need, enabling fine-grained capability control and composability across runtimes like Wasmtime, WAMR, and spin.
4 / 5
An incident report shows two WebAssembly components failing to link because of interface mismatches. A senior engineer asks what composition means in the Component Model. What is correct?
Composition in the WebAssembly Component Model connects a component's imports to another component's matching exports at the interface level. The wac tool or wasm-compose produces a new, single composed component that internally routes calls between the wired components. Components communicate only through WIT-typed boundaries — no shared linear memory — making composition memory-safe even across language boundaries.
5 / 5
During a code review, a senior engineer asks what a world in WIT defines. What is accurate?
A world in WIT is the top-level contract a component targets. It declares imports (interfaces or functions the component needs, provided by the host or other components) and exports (interfaces or functions the component provides to callers). When you compile a component, you target a specific world — the toolchain generates bindings for all declared imports and validates that the component satisfies all declared exports.