This page contains questions and answers for the first quiz in CS100: Principles of Computer Science, a course based on the book The Most Comples Machine.
The answers given here are sample answers only. There is always some variation in the answers that would receive full credit. The Notes contain any extra comments I happen to have; they are not parts of the answers.
Question 1: Explain what is meant by ASCII code and why it, or something like it, is needed by computers.
Answer: ASCII code is a particular encoding used to represent text. Each possible character is assigned an eight-bit binary number as its code. (Characters are things like letters, punctuation, tabs, carriage returns, ...) It is used by most computers to store and manipulate character data. ASCII code is needed because computers can really only work with binary numbers. Other types of data must be encoded as binary numbers before a computer can work with them.
Note: ASCII code is used to represent a particular type of data. It is not used to encode instructions or commands for the computer to execute. The machine language of a computer does consist of instructions, encoded as binary numbers, that can be executed by a computer. However, machine language does not use ASCII code. Each type of computer has its own machine language. However, most computers use the same representation, namely ASCII code, for text data. This allows data to be shared by different types of computers, even though machine language programs cannot.
Question 2:Explain how a picture or image can be represented by a binary number.
Answer: A picture can be made up of pixels. Each pixel is a little square of color. The color of that square can be encoded as a binary number. For example, 0 might be used to represent white and 1 might be used to represent black. The codes for all the individual pixels can then be strung together to give a single binary number that represents the entire picture.
Note: If the pixels can have more than two colors, then you will need more than one bit for each pixel. For example, with 8 bits per pixel, you can represent 256 different colors.
Question 3: Discuss what is meant by a CPU and what role it plays in a computer.
Answer: The CPU, or Central Processing Unit, is the active part of the computer. Its job is to execute machine language programs. The programs are stored in the computer's main memory. The CPU fetches the instructions from the main memory, one-by-one, and executes them.
Question 4: Machine language refers to the simple instructions that are understood directly by a computer. Give several examples of instructions that might be found in a machine language.
Answer: Some examples include: an instruction that tells the CPU to load the number from a specified memory location into the accumulator; an instruction to add the number from a specified memory location to the accumulator; an instruction to store the number from the accumulator into a specified location in memory; and an instruction to jump to another location in the program.
Note: A "loop" is not an example of a machine language instruction. It's not a single instruction. Rather, it is a way of "chunking" together a number of instructions into a meaningful structure. A loop actually consists of a number of instructions, with a jump instruction at the end to transfer control back to the beginning of the loop.
Question 5: One of the main ideas of this course is structured complexity. Explain what is meant by structured complexity, and give an example that has nothing to do with computers.
Answer: Structured complexity refers to hierarchical levels of structure: Simple components are "chunked" together to make slightly more complex components, which can then be used for building even more complex components, and so forth. For example, in the human body, cells are grouped into tissues, which are grouped into organs, and so forth.
Note: There are, of course, many other examples besides the human body. The idea of levels of structures is very important. If we can't build up a complex system one reasonably easy level at a time, we are faced with a complicated mass of unorganized detail, like a jigsaw puzzle or a book full of random characters.