Skip to main content
Engineering LibreTexts

1.E: Introduction (Exercises)

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

a) Execute all of the computation and logic of the program
b) Retrieve web pages over the Internet
c) Store information for the long term, even beyond a power cycle
d) Take input from the user

Exercise 2: What is a program?

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

Exercise 4: Which of the following contains "machine code"?

a) The Python interpreter
b) The keyboard
c) Python source file
d) A word processing document

Exercise 5: What is wrong with the following code:

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

Exercise 6: Where in the computer is a variable such as "x" stored after the following Python line finishes?

    x = 123

a) Central processing unit
b) Main Memory
c) Secondary Memory
d) Input Devices
e) Output Devices

Exercise 7: What will the following program print out:

    x = 43
    x = x + 1
    print(x)

a) 43
b) 44
c) x + 1
d) Error because x = x + 1 is not possible mathematically

Exercise 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 9: How do you fix a "Syntax Error"?


  1. http://xkcd.com/231/