exam 1 Flashcards

1
Q

A program receives data from a file, keyboard, touchscreen, network, etc.

A

Input

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

A program performs computations on that data, such as adding two values like x + y.

A

Process

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

A program puts that data somewhere, such as a file, screen, or network.

A

Output

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

A sequence of instructions that solves a problem

A

algorithm

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

A common way to become familiar with algorithms

A

turtle graphics

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

a program that allows the user to execute one line of code at a time.

A

interactive interpreter

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

a computer program that executes code written in the Python programming language.

A

Python interpreter

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

a common word for the textual representation of a program

A

Code

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

a row of text.

A

line

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

what is “»>” called?

A

prompt

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

a program instruction. A program mostly consists of a series of statements, and each statement usually appears on its own line.

A

statement

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

are code that return a value when evaluated

A

Expressions

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

A new variable is created by performing an _____ using the “=” symbol

A

assignment

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

function displays variables or expression values.

A

print()

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

Characters such as “#” denote

A

comments

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

Text enclosed in quotes is known as a ____. May have letters, numbers, spaces, or symbols like @ or #.

A

string literal

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

keeps the output of a subsequent print statement on the same line separated by a single space

A

end=’ ‘

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

Output can be moved to the next line by printing __ , known as a _______ .

A

“\n” , newline character

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

Any space, tab, or newline is called

A

whitespace

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

The function ______ causes the interpreter to wait until the user has entered text and pushed the return key.

A

input()

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

The input obtained by input() is any text that a user typed, including numbers, letters, or special characters such as # or @. Such text in a computer program is called a ____.

A

string

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

a ____ determines how a value can behave

A

type

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

violates a programming language’s rules on how symbols can be combined to create a program.

A

syntax error

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

a program’s syntax is correct but the program attempts an impossible operation

A

runtime error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Abrupt and unintended termination of a program is often called a
crash
26
The lines of the program are not properly indented.
Indentation Error
27
An invalid value is used, which can occur if giving letters to int().
Value Error
28
The program tries to use a variable that does not exist.
Name Error
29
An operation uses incorrect types, which can occur if adding an integer to a string.
Type Error
30
The program would load correctly but would not behave as intended. Such an error is known as a _______, because the program is logically flawed.
logic error
31
A logic error is often called a ___.
bug
32
An _________ assigns a variable with a value
assignment statement
33
a ____ is a named item
variable
34
Increasing a variable's value by 1, as in x = x + 1, is common and known as_____ the variable.
incrementing
35
An ____, also called a name, is a sequence of letters (a-z, A-Z), underscores (_), and digits (0–9), and must start with a letter or an underscore.
identifier
36
______, or keywords, are words that are part of the language and cannot be used as a programmer-defined name.
Reserved words
37
outlines the basics of how to write Python code neatly and consistently
Python Enhancement Proposal (PEP 8)
38
A __________number is a real number. The term refers to the decimal point appearing anywhere in the number.
floating-point
39
is a data type for floating-point numbers.
float
40
A _____ is written with the fractional part even if that fraction is 0.
floating-point literal
41
A floating-point literal using ____ is written using an "e" preceding the power-of-10 exponent.
scientific notation
42
Assigning a floating-point value outside of this range generates an _____.
Overflow Error
43
occurs when a value is too large to be stored in the memory allocated by the interpreter.
Overflow
44
A ____ is a specific value in code
literal
45
An ____ is a symbol that performs a built-in calculation
operator
46
what is the exponent operator and in terms of x and y?
**, x to the power of y
47
An expression is evaluated using the order of standard mathematics, and is also known in programming as
precedence rules
48
Items within parentheses are evaluated ____ .
first
49
what is the order of precedence rules?
(), **, unary, * / % , + -, then left to right
50
Minus (-) used as negative is known as ____.
unary minus
51
Special operators called ____ provide a shorthand way to update a variable
compound operators
52
A ____ is a conversion of one type to another, such as an integer to a float.
type conversion
53
An ____ is a type conversion automatically made by the interpreter, usually between numeric types.
implicit conversion
54
Creates integers and can convert integer, float, strings w/integers only
int()
55
Creates floats and can convert integer, float, strings w/integers or fractions
float()
56
Creates strings and can convert any type
str()
57
The ____ evaluates the remainder of the division of two integer operands.
modulo operator or %
58
A ____ is a file containing Python code that can be used by other modules or scripts and is Python code located in another file
module
59
A module is made available for use via the ____.
import statement
60
Once a module is imported, any object defined in that module can be accessed using ____.
dot notation
61
Python comes with a standard ____ to support such advanced math operations.
math module
62
A ____ is a list of statements that can be executed simply by referring to the function's name.
function
63
where does a programmer import a module?
top of the file
64
The process of invoking a function is referred to as a ____.
function call
65
what does floor() do?
Round-down value
66
An ____ represents a value and is automatically created by the interpreter when executing a line of code.
object
67
Deleting unused objects is an automatic process called ____ that frees memory space
garbage collection
68
____ is the process of associating names with interpreter objects.
Name binding
69
what are three defining properties each Python object has?
value, type, identity
70
____ indicates whether the object's value is allowed to be changed.
Mutability
71
Integers and strings as objects are ____ ; meaning integer and string values cannot be changed.
immutable
72
Python provides a built-in function ____ that gives the value of an object's identity.
id()
73
A ____ is a sequence of characters that can be stored in a variable.
string
74
A ____ is a string value specified in the source code of a program.
string literal
75
The string type is a special construct known as a ____: A type that specifies a collection of objects ordered from left to right.
sequence type
76
The ____ built-in function can be used to find the length of a string (and any other sequence type).
len()
77
A programmer can access a character at a specific index by appending ____containing the index
brackets or [ ]
78
A program can add new characters to the end of a string in a process known as ____.
string concatenation
79
A ____, or ____, allows a programmer to create a string with placeholder expressions that are evaluated as the program executes.
formatted string literal, f-string
80
A placeholder expression is also called a ____, as its value replaces the expression in the final output.
replacement field
81
A ____ inside a replacement field allows a value's formatting in the string to be customized.
format specification
82
A ____ is part of a format specification that determines how to represent a value in text form, such as an integer, a floating point, a fixed precision decimal, a percentage, a binary, etc.
presentation type
83
A ____ is a construct used to group related values together and contains references to other objects instead of data.
container
84
A ____ is a container created by surrounding a sequence of variables or literals with brackets [ ].
list
85
A list item is called an ____.
element
86
A list is also a sequence, meaning the contained elements are ordered by position in the list, known as the element's ____ .
index
87
A ____ instructs an object to perform some action, and is executed by specifying the method name following a "." symbol and an object.
method
88
The ____ list method is used to add new elements to a list.
append()
89
Elements can be removed using the ____ or ____ methods.
pop(), remove()
90
____ are built-in functions that operate on sequences like lists and strings.
Sequence-type functions
91
____ are methods built into the class definitions of sequences like lists and strings.
Sequence-type methods
92
A ____ stores a collection of data, like a list, but is immutable
tuple
93
A ____ allows the programmer to define a new simple data type that consists of named attributes.
named tuple
94
The ____ container must be imported to create a new named tuple.
namedtuple
95
Because each memory location is composed of bits (0s and 1s), a processor stores a number using base 2, known as a ____ .
binary number
96
The ____, in the Python Standard Library, provides methods that return random values.
random module
97
The ____ method returns a random floating-point value each time the function is called, in the range 0 (inclusive) to 1 (exclusive).
random()
98
Python's ____ method generates random integers within a specified range.
randrange()
99
The numbers generated by the random module are known as ____.
pseudo-random
100
For the first call to any random method, no previous random number exists, so the method uses a built-in integer based on the current time, called a ____ , to help generate a random number.
seed
101
In programming, an ____ is a grouping of data (variables) and operations that can be performed on that data (functions or methods)
object
102
____ occurs when a user interacts with an object at a high level, allowing lower-level internal details to remain hidden
Abstraction
103
An ____ is a data type whose creation and update are constrained to specific well-defined operations.
abstract data type (ADT)
104
The ____ keyword can be used to create a user-defined type of object containing groups of related variables and functions.
class
105
The object maintains a set of ____ that determines the data and behavior of the class.
attributes
106
An ____ operation is performed by "calling" the class, using parentheses
instantiation
107
An instantiation operation creates an ____, which is an individual object of the given class.
instance
108
A ____ is a function defined within a class.
method
109
The __init__ method, commonly known as a ____, is responsible for setting up the initial state of the new instance.
constructor
110
Attributes can be accessed using the ____ "."
attribute reference operator
111
A function defined within a class is known as an ____.
instance method
112
A ____ acts as a factory that creates instance objects.
class object
113
A ____ is shared among all instances of that class. Class attributes are defined within the scope of a class.
114
An ____ can be unique to each instance.
115
A ____ consists of the methods that a programmer calls to create, modify, or access a class instance.
class interface
116
____ is the process of defining how a class should behave for some common operations.
Class customization
117
Class customization can redefine the functionality of built-in operators like <, >=, +, -, and * when used with class instances, a technique known as ____.
operator overloading