chapter 1 instruction

限于喜欢 提交于 2020-02-27 10:53:17

Chapter 1 Why should you learn to write programs?

  1. 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.

  1. What is a program?

A set of instructions that specifies a computation.

  1. 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.

  1. Which of the following contains “machine code”?

    a. The python interpreter

    b. The keyboard

    c. Python source file

    d. A word processing document

  2. 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

  1. How do you fix a “syntax error”?

Run > thinking > modify

print("hello")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!