1. Why Should You Learn to Write Programs? Flashcards

1
Q

bug

A

An error in a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

central processing unit

A

The heart of any computer. It is what runs the software that we write; also called “CPU” or “the processor”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

compile

A

To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

high-level language

A

A programming language like Python that is designed to be easy for humans to read and write.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

interactive mode

A

A way of using the Python interpreter by typing commands and expressions at the prompt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

interpret

A

To execute a program in a high-level language by translating it one line at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

low-level language

A

A programming language that is designed to be easy for a computer to execute; also called “machine code” or “assembly language”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

machine code

A

The lowest-level language for software, which is the language that is directly executed by the central processing unit (CPU).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

main memory

A

Stores programs and data. Main memory loses its information when the power is turned off.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

parse

A

To examine a program and analyze the syntactic structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

portability

A

A property of a program that can run on more than one kind of computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

print function

A

An instruction that causes the Python interpreter to display a value on the screen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

problem solving

A

The process of formulating a problem, finding a solution, and
expressing the solution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

program

A

A set of instructions that specifies a computation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

prompt

A

When a program displays a message and pauses for the user to type some input to the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

secondary memory

A

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.

17
Q

semantics

A

The meaning of a program.

18
Q

semantic error

A

An error in a program that makes it do something other than what the programmer intended.

19
Q

source code

A

A program in a high-level language.

20
Q

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

A

Store information for the long term, even beyond a power cycle.

21
Q

What is a program?

A

The definition of a program at its most basic is a sequence of Python statements that have been crafted to do something.

22
Q

What is the difference between a compiler and an interpreter?

A

An Interpreter reads the source code of the program as written by the programmer, parses the source code, and interprets the instructions on the fly.

Compiler needs to be handed the entire program in a fil, and then it runs a process to translate the high-level source code into machine language and then the compiler puts the resulting machine language into a file for later exection.

23
Q

Which of the following contains “machine code”?

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

A

a) The Python interpreter

24
Q

What is wrong with the following code:

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

It should be print and not primt.

print ‘Hello world!’

25
Q

Where in the computer is a variable such as “x” stored after the following Python line finishes?

x = 123

A

Main Memory

26
Q

What will the following program print out:

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

A

44

27
Q

Explain each of the following using an example of a human capaibility:

1) Central processing unit
2) Main Memory
3) Secondary Memory
4) Input Device
5) Output Device.

For example, “What is the human equivalent to a Central Processing Unit”?

A
  1. CPU = Heart
  2. Main Memory = Brain (subconscious)
  3. Secondary Memory = Brain (Conscious Thought)
  4. Input Device = Ears, Hands
  5. Output Device = Mouth
28
Q

How do you fix a “Syntax Error”?

A

The line and character that Python indicates in a syntax error may just be a starting point for your investigation.