1/16
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
A ___ loop has no way of ending and repeats until the program is interrupted
infnite
The integrity of a programs output is only as good as the programs…
input
A _____ is a piece of data that is sent to a function
argument
A ___ is a special variable that receives data when a function is called
parameter
This type of file contains data that has not been converted yet
binary file
This is a single piece of data within a record
field
It is necessary to initialize your accumulator variables (T/F)
true
to calculate the total number of iterations in a nested loop, add the number of iterations to all the loops (T/F)
false
A statement in one function can access a local variable in another function (T/F)
false
some libraries are built into the python interpreter (T/F)
true
when you open a file that already exists on the disc using the ‘w’ method, the contents of the existing file will be erased (T/F)
true
you can have more than one except clause in a try/except statement (T/F)
true
What is a sentinel? Why is its value be chosen carefully?
it is a special value that marks the end of a sequence of values. Sentinels are useful when you dont know how many values are in the sequence, and it must not be taken as a regular value. A zero is often used as a sentinel
When a function is executing, what happens when the end of the function block is reached?
the interpreter jumps back to the part of the program that created it and resumes executing statements. Note that this highlights why indentation is so important - all lines in function blocks should be indented the same.
Why do global variables make a program difficult to debug?
Any program statement could change it, so its hard to understand and track an error. Also, if you use the function in another program you’ll likely need to redesign it.
What are the steps taken when a file is used by a program?
Open the file and create an associated file object
Process the file according to mode (r,w,a)
Close the file
What is a files read position? Where is the read position when a file is first opened for reading?
it is a special value that marks the next item to be read from the file. Initially, it is set to the beginning of the file.