Note that the CPU often contains some small amount of scratch memory as well. This memory is usually called registers. In most architectures, the registers are treated quite differently than other memory, but a few architectures treat them in similar ways.
It may seem odd for contemporary users to refer to a file as an external device, since for computers like PCs and Macs, files are stored on disks that generally reside inside the computer. Similarly, the screen and keyboard are also tightly integrated with most contemporary computers, so that it's difficult to imagine a computer without a keyboard and screen (and mouse and disk...). What is really meant by input and output is with respect to the CPU and RAM and other devices in the system- not whether the data actually enters or exits the box that computer resides in.
Each program, by the time the CPU gets it, is broken down into a sequence of operations. By default, the control logic is quite simple- execute the operations in the sequence that appear in the program. However, the control logic can also execute the operations in a sequence that is computed as the part of the program itself- for example, with the C if statement.
One component of the datapath is the ALU (the Arithmetic Logic Unit), which is the brain of the CPU (just as the CPU is the brain of the computer). The ALU is responsible for computing the mathematical functions that actually implement the arithmetic and logic operations that the CPU executes. It may seem quite surprising that all of the operations that the CPU can compute reduce to a small set of logical and arithmetic functions.
If someone hands you four bytes containing some arbitrary bit pattern, and then asks you what they represent, you can't answer without more information. It could be four characters, two 16-bit integers, a 32-bit integer, a floating point number- and of characters, integers, and floating point numbers have more than one convention for representation, so the number of possible interpretations is gigantic. However, if someone hands you four bytes containing some arbitrary bit pattern, and then asks what 32-bit big-endian two's complement integer they represent, then you should be able to answer them.
Dan Ellard - (firstname.lastname@example.org)