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?

A

IDLE

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
Q

What kind of type is indivisible (for the most part)

A

Scalar

26
Q

What are the Scalar Types?

A
Integer
  -int
Float
  -float
Boolean
  -bool
None
  -NoneType
String
  -str
27
Q

What type does Python not have that most programming languages do?

A

Character

-char

28
Q

In Python, how is the literal of a string denoted?

A

Bye single quotes or double quotes
‘ ‘
“ “

29
Q

Define expression

A

A sequence of operators, operands, and functions

30
Q

When is an operator overloaded?

A

When it has different meanings depending on the operands it is working on

31
Q

What is concatenation?

A

Sticking two things together

32
Q

Why is computation between numbers of different types complicated?

A

An int divided by an int will produce an int result, which might truncate the remainder

33
Q

How do you change type?

A

typename(input)
Example: str(3)
int(2.5)

34
Q

How are comments marked in Python?

A

#

35
Q

what command prints to the screen?

A

print

36
Q

In Python, what is variable?

A

a name for an object?

37
Q

In Python, what does an assignment statement do?

A

Binds a name to an object

38
Q

what are the two input commands in Python 2.X?

A

raw_input(“prompt”)

input(“prompt”)

39
Q

what type does raw_input return by default?

A

a string

40
Q

How do you find the type of an object?

A

type()

41
Q

What is the name of a program wherein each line of code is executed exactly once?

A

A straight line program

42
Q

What are the conditionals in Python?

A

else
if
elif

43
Q

What is the function of indentation in Python?

A

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
Q

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

A branching program

45
Q

What is the name of a program wherein code can be executed multiple times based on iteration?

A

A looping construct or program

46
Q

What kind of program is considered Turing complete?

A

A looping program

47
Q

How do you find the absolute value?

A

abs()

48
Q

What are the operations in Python?

A
Addition
  \+
Subtraction
  -
Multiplication
  *
Division
  /
Exponentiation
  **
Modulo
  %
    For ints only
49
Q

What are the comparison operations in Python?

A
Less than
  <
Greater than
  >
Less than or equal to
  =
Does not equal
  !=
Does equal
  ==
50
Q

What do comparison operations always return?

A

A boolean value

51
Q

What are the boolean operators in Python?

A

And
Not
Or

52
Q

How many operands are needed for each boolean operator?

A

And - 2
Or - 2
Not - 1