Every request begins by turning a name into an address, and that translation is DNS. The lookups here read from the device itself, so they show the same name and address idea without needing a network connection.
Each one is marked as you go, and the explanation arrives straight after, which is
the part worth reading.
4 questions, marked as you go.
Tasks
These need your own device. Run the command in Termux, then paste what it printed.
The marking looks at what the output means, so spacing, version numbers and
ordering do not matter. If you have not installed anything yet, the
lesson covers the setup.
Resolve a name to an address
This asks the system to turn the name localhost into an address, then asks it to turn the loopback address back into a name. Both lookups read from the machine's own hosts file, so they work with no network at all.
Run this in Termux
On your own device. Nothing on this page executes it. The command runs in
your terminal, and this box only reads what you paste back.
getent hosts localhost; getent hosts 127.0.0.1
Two lines should come back. On some devices the first is the IPv6 loopback and on others the IPv4 one.
the name localhost resolves to a loopback address
the address 127.0.0.1 resolves back to the name
the name itself appears in the answer
the commands actually ran
What a good answer looks like
Two lines, each an address followed by the name it belongs to. The first lookup turns the name localhost into an address, and the second turns 127.0.0.1 back into the name, so the two directions of the same mapping are shown side by side. Your first line may read ::1 or 127.0.0.1 depending on how the device orders its hosts file, and that is the lesson: the name stays fixed while the address it answers with can differ. It is why you share a name and never hard-code an address.
Marking your own work
Both halves of this are checked in your browser, with no server involved, so nothing
stops you from pasting output you did not run. The tasks are written so that the
easiest way to pass one is to actually do it and read the result, which is the whole
intention.