MIT 6.00 Week 1 Flashcards

1
Q

What are the two kinds of knowledge?

A

Declarative and imperative

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

What is declarative knowledge?

A

Statements of fact.

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

What is imperative knowledge?

A

Knowledge of how to do something, instructions to accomplish a task.

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

Algorithm

A

A description of how to perform a computation

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

What is it called when an algorithm has halted?

A

The algorithm has converged.

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

What is flow control?

A

An order of execution for the steps of an algorithm

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

The condition under which the algorithm stops

A

termination condition

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

What kind of computer is hard coded to do a certain set of calculations?

A

Fixed program computer

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

What kind of computer treats both input and the commands to manipulate that input as data?

A

Stored program computer.

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

Why two primary ways that stored program computers are superior to fixed program computers

A

They are infinitely flexible

They allow programs to create programs

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

What is the interpreter?

A

A program that can execute any valid set of instructions

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

Alan Turing proved that:

A

With 6 primitive instructions you can do anything that can be done with a computer (rough)

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

What determines the difference between different programming languages?

A

Instructions

Flow control

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

What are the three characteristics of a programming language?

A

Syntax
Static semantics
Semantics

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

Syntax:

A

What sequence of characters and symbols constitute a well formed string.

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

Static Semantics

A

Provides restrictions on syntactically correct expressions to ensure that the expression is meaningful

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

Semantics

A

Provides rules for the meaningful interpretation of a syntactically correct expression

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

What are the possible negative consequences of running a program?

A

Crash
Infinite loop
Run to completion with an incorrect answer

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

What process does a program written in an interpreted language go through when it is run?

A

source code - checker - interpreter - output

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

What process does a program written in a compiled language go through in order to be run?

A

source code - checker/compiler - object code - interpreter - output

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

What is the IDE (Integrated Development Environment) for Python?

22
Q

What is an object in Python?

A

Everything

23
Q

What does an object’s type tell us?

A

What it is an what we can do with it

24
Q

Types break down into what two categories?

A

Scalar

Non-Scalar

25
What kind of type is indivisible (for the most part)
Scalar
26
What are the Scalar Types?
``` Integer -int Float -float Boolean -bool None -NoneType String -str ```
27
What type does Python not have that most programming languages do?
Character | -char
28
In Python, how is the literal of a string denoted?
Bye single quotes or double quotes ' ' " "
29
Define expression
A sequence of operators, operands, and functions
30
When is an operator overloaded?
When it has different meanings depending on the operands it is working on
31
What is concatenation?
Sticking two things together
32
Why is computation between numbers of different types complicated?
An int divided by an int will produce an int result, which might truncate the remainder
33
How do you change type?
typename(input) Example: str(3) int(2.5)
34
How are comments marked in Python?
#
35
what command prints to the screen?
print
36
In Python, what is variable?
a name for an object?
37
In Python, what does an assignment statement do?
Binds a name to an object
38
what are the two input commands in Python 2.X?
raw_input("prompt") | input("prompt")
39
what type does raw_input return by default?
a string
40
How do you find the type of an object?
type()
41
What is the name of a program wherein each line of code is executed exactly once?
A straight line program
42
What are the conditionals in Python?
else if elif
43
What is the function of indentation in Python?
Indentation determines how code is associated to other code. Code indented to a conditional will only execute with that conditional. Code not indented will always execute
44
What is the name of a program wherein there are multiple paths that the program can follow depending on conditions, before returning to the main line?
A branching program
45
What is the name of a program wherein code can be executed multiple times based on iteration?
A looping construct or program
46
What kind of program is considered Turing complete?
A looping program
47
How do you find the absolute value?
abs()
48
What are the operations in Python?
``` Addition + Subtraction - Multiplication * Division / Exponentiation ** Modulo % For ints only ```
49
What are the comparison operations in Python?
``` Less than < Greater than > Less than or equal to = Does not equal != Does equal == ```
50
What do comparison operations always return?
A boolean value
51
What are the boolean operators in Python?
And Not Or
52
How many operands are needed for each boolean operator?
And - 2 Or - 2 Not - 1