Prelim 1 Flashcards

1
Q

Argument

A

An argument is an expression that appears within the parentheses of a function call.

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

Assert statement

A

<assert> <boolean-expression>. If the boolean expression is true, the statement does nothing. If it is false, the expression produces an error and the program stops running.
</boolean-expression></assert>

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

Assignment statement

A

<variable> = <expression>. If the variable on the left hand side does not exist yet, it is created and stores the value of the expression inside. If the variable does exist, it replaces the old value stored inside the variable with the value of the expression.
</expression></variable>

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

Attribute

A

A variable that is stored inside an object. Attributes typically have invariants, rules specifying how they can be modified.

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

Call Frame

A

A formal representation of what Python uses when you execute a function call. It contains the name of the function, parameters, local variables and a counter.

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

Call Stack

A

All of the call frames of the currently executing function call

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

Class

A

Any type that is not built-in to python

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

Constructor

A

A function that creates a mutable object. It puts the object in heap space and returns the name of the object so you can store it in a variable.

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

Expression

A

Python code that produces a value. They must be put inside a statement.

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

Function

A

A parameterized sequence of statements that perform a task.

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

Fruitful Function

A

A function that returns a value.

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

Function Call

A

Expression that executes a function body

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

Function Header

A

The first line of a function definition. It includes the keyword def, name of function, parameters within parentheses (if appropriate), and a colon.

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

Global Space

A

Area of memory that stores variables defined outside the body of a function.

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

Heap Space

A

Area of memory that stores mutable objects.

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

Literal

A

An expression that, when evaluated, evaluates to itself. An expression that is also a value

17
Q

Method

A

A function that is stored inside of an object

18
Q

Object

A

A (mutable) object is a value whose type is a class. Objects typically contain attributes and have methods.

19
Q

Procedure

A

A function that does not return a value

20
Q

Scope

A

The set of places in which a variable can be referenced

21
Q

Specification

A

A description of what a function should do. Includes preconditions on arguments and return value of function if it is a fruitful function.

22
Q

Statement

A

A command for Python to do something. There are 5 types: try-except, assert, assignment, conditional, and return.

23
Q

Type

A

A set of values and the operations on them.

24
Q

Variable

A

A named box containing a value.

25
Q

Parameter

A

A variable within the parentheses of a function header.

26
Q

Local variable

A

A variable which is not a parameter, but which is assigned in the body of a function.

27
Q

Global variable

A

A variable which is assigned inside of module, but outside the body or header of a function.