您在這裡

Exercises

23 二月, 2015 - 11:25

Exercise 1.1 What is the function of the secondary memory in a computer?

  1. Execute all of the computation and logic of the program
  2. Retrieve web pages over the Internet
  3. Store information for the long term - even beyond a power cycle
  4. Take input from the user

Exercise 1.2 What is a program?

Exercise 1.3 What is is the difference between a compiler and an interpreter?

Exercise 1.4 Which of the following contains ”machine code”?

  1. The Python interpreter
  2. The keyboard
  3. Python source file
  4. A word processing document

Exercise 1.5 What is wrong with the following code:

>>> primt 'Hello world!'  File "<stdin>", line 1    primt 'Hello world!'                       ˆSyntaxError: invalid syntax>>>

Exercise 1.6 Where in the computer is a variable such as ”X” stored after the following Python line finishes?

x = 123
  1. Central processing unit
  2. Main Memory
  3. Secondary Memory
  4. Input Devices
  5. Output Devices

Exercise 1.7 What will the following program print out:

x = 43x = x + 1print x
  1. 43
  2. 44
  3. x + 1
  4. Error because x = x + 1 is not possible mathematically

Exercise 1.8 Explain each of the following using an example of a human capability: (1) Central processing unit, (2) Main Memory, (3) Secondary Memory, (4) Input Device, and (5) Output Device. For example, ”What is the human equivalent to a Central Processing Unit”?

Exercise 1.9 How do you fix a ”Syntax Error”?