Chapter 1 Why should you learn to write programs?
- What is the function of the secondary memory in a computer?
Stores programs and data and retains the information even
when the power is turned off. Generally slower than main memory. Examples of
secondary memory include disk drives and flash memory in USB sticks.
- What is a program?
A set of instructions that specifies a computation.
- What is the difference between a compiler and an interpreter?
Compiler: to translate a program written in a high-level
language into a low-level language all at once, in preparation for later
execution.
Interpreter: to execute a program in high-level language by
translating it one line at a time.
-
Which of the following contains “machine code”?
a. The python interpreter
b. The keyboard
c. Python source file
d. A word processing document
-
Explain each of the following using an example of human capability:
central processing unit, main memory, secondary memory, input device, output
device,
Central processing unit: the heart of any computer. It is what runs the software that we write.
Main memory: stores programs and data, main memory loses information when the power is turned off.
Secondary: Stores programs and data and retains its information even when the power is turned off. Generally slower than main memory. Examples of secondary memory include disk drives and flash memory in USB sticks.
Input device: send information to computer
Output device: display information, such as music device, the screen
- How do you fix a “syntax error”?
Run > thinking > modify
print("hello")