exam 3 Flashcards

1
Q

a programmer will typically write Python code in a file, and then pass that file as input to the interpreter

A

script

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

a file containing Python code that can be imported and used by scripts, other modules, or the interactive interpreter.

A

module

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

A module being required by another program is often called a ____.

A

dependency

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

A dictionary of the loaded modules is stored in ____.

A

sys.modules

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

A ____ is simply a namespace that contains definitions from the module.

A

module object

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

____is a global string variable automatically added to every module that contains the name of the module.

A

__name__

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

A programmer can specify names to import from a module by using the ____ keyword in an import statement

A

from

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

The program below imports names from the ____ module, a Python standard library module that contains a number of algorithms for creating a secure ____ of a text message.

A

hashlib, hash

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

A ____ maps names to objects.

A

namespace

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

____ is the area of code where a name is visible.

A

Scope

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

The process of searching for a name in the available namespaces is called ____.

A

scope resolution

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

____ is the process of dividing a program into separate modules that can be developed and tested separately and integrated into a single program.

A

Modular development

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

Programs are written using ____, meaning a small amount of code is written and tested, then a small amount more (an incremental amount) is written and tested, and so on.

A

incremental development

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

To assist with the incremental development process, programmers commonly introduce ____, which are function definitions whose statements haven’t been written yet.

A

function stubs

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

One approach is to use the ____ keyword, which performs no operation except to act as a placeholder for a required statement.

A

pass

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

The ____ indicates that the function is not implemented and causes the program to stop execution.

A

NotImplementedError

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

The ____ includes various utilities and tools for performing common program behaviors.

A

Python standard library

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

Functions for creating and editing of dates and times objects

A

datetime

19
Q

Functions for working with random numbers

A

random

20
Q

Functions that create complete copies of objects

A

copy

21
Q

Functions that get the current time, convert time zones, and sleep for a number of seconds

A

time

22
Q

Mathematical functions

A

math

23
Q

Operating system informational and management helper functions

A

os

24
Q

System-specific environment or configuration helper functions

A

sys

25
Q

The Python interactive debugger

A

pdb

26
Q

Python uses ____ to represent every possible character as a unique number, known as a ____.

A

Unicode, code point

27
Q

The two-item sequence for special characters is called an ____.

A

escape sequence

28
Q

Escape sequences can be ignored using a ____.

A

raw string

29
Q

The built-in function ____ returns an encoded integer value for a string of length one.

A

ord()

30
Q

The built-in function ____ returns a string of one character for an encoded integer.

A

chr()

31
Q

Returns a copy of the string with all occurrences of the substring old replaced by the string new. The old and new arguments may be string variables or string literals.

A

replace(old, new)

32
Q

Returns a copy of the string with all occurrences of the substring old replaced by the string new. The old and new arguments may be string variables or string literals., except it only replaces the first count occurrences of old.

A

replace(old, new, count)

33
Q

The string method ____ splits a string into a list of tokens.

A

split()

34
Q

Each ____ is a substring that forms a part of a larger string.

A

token

35
Q

A ____ is a character or sequence of characters that indicates where to split the string into tokens.

A

separator

36
Q

The ____ string method performs the inverse operation of split() by joining a list of strings together to create a single string.

A

join()

37
Q

An ____ is an integer matching a specific position in a string’s sequence of characters.

A

index

38
Q

The ____ determines how much to increment the index after reading each element.

A

stride

39
Q

A ____ may include a field width that defines the minimum number of characters that must be inserted into the string.

A

format specification

40
Q

A format specification can include an ____ that determines how a value should be aligned within the width of the field.

A

alignment character

41
Q

The ____ is used to pad a replacement field when the inserted string is smaller than the field width.

A

fill character

42
Q

The optional ____ component of a format specification indicates how many digits should be included in the output of floating types.

A

precision

43
Q

The ____ function retrieves both the index and corresponding element value at the same time, providing a cleaner and more readable solution.

A

enumerate()