Practice question · Multiple choice
A text file opened as an image produces coloured noise rather than an error message. Why does the computer not object?
Hints
- Ask what is physically stored: bytes, or bytes plus a label saying what they are?
- The viewer never asks what the file 'is'. What does it do instead?
Show the answer
D. Because the bytes carry no type, so the viewer reads them as pixel values
Why
There is no type tag in the bytes, the viewer simply reads them as pixels and paints the result. File extensions and magic numbers are conventions layered on top by software, which is why renaming a file changes nothing about it and why parsing untrusted input is where so many security holes live.
Practise Information Encoding and Binary Representation
The app has 8 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.