Pi th on 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 difference between a compiler and an interpreter?

A

A compiler compiles a set of high-level programming language instructions all at once so it can be used later. An interpreter executes a program in a high-level language by running it one line at a time.

21
Q

What is a “syntax” error?

A

Syntax errors These are the first errors you will make and the easiest to fix. A
syntax error means that you have violated the “grammar” rules of Python.
Python does its best to point right at the line and character where it noticed
it was confused. The only tricky bit of syntax errors is that sometimes the
mistake that needs fixing is actually earlier in the program than where Python
noticed it was confused. So the line and character that Python indicates in
a syntax error may just be a starting point for your investigation.

22
Q

What is “logic” errors?

A

Logic errors A logic error is when your program has good syntax but there is
a mistake in the order of the statements or perhaps a mistake in how the
statements relate to one another. A good example of a logic error might be,
“take a drink from your water bottle, put it in your backpack, walk to the
library, and then put the top back on the bottle.”

23
Q

what is a semantic error?

A

A semantic error is when your description of the steps to take
is syntactically perfect and in the right order, but there is simply a mistake
in the program. The program is perfectly correct but it does not do what you
intended for it to do. A simple example would be if you were giving a person
directions to a restaurant and said, “. . .when you reach the intersection with
the gas station, turn left and go one mile and the restaurant is a red building
on your left.” Your friend is very late and calls you to tell you that they are
on a farm and walking around behind a barn, with no sign of a restaurant.
Then you say “did you turn left or right at the gas station?” and they say, “I
followed your directions perfectly, I have them written down, it says turn left
and go one mile at the gas station.” Then you say, “I am very sorry, because
while my instructions were syntactically correct, they sadly contained a small
but undetected semantic error.”.

24
Q

What are the strategies for finding and fixing bugs?

A

reading —–Examine your code, read it back to yourself, and check that it says what
you meant to say.
running ——Experiment by making changes and running different versions. Often
if you display the right thing at the right place in the program, the problem
becomes obvious, but sometimes you have to spend some time to build
scaffolding.
ruminating —–Take some time to think! What kind of error is it: syntax, runtime,
semantic? What information can you get from the error messages, or from
the output of the program? What kind of error could cause the problem
you’re seeing? What did you change last, before the problem appeared?
retreating —–At some point, the best thing to do is back off, undoing recent changes,
until you get back to a program that works and that you understand. Then
you can start rebuilding.