Introduction to Programming Using Python 1st Edition Schneider Test Bank download
Introduction to Programming Using Python 1st Edition Schneider Test Bank download
https://testbankdeal.com/product/introduction-to-programming-
using-python-1st-edition-schneider-test-bank/
https://testbankdeal.com/product/introduction-to-programming-using-
python-1st-edition-schneider-solutions-manual/
https://testbankdeal.com/product/introduction-to-programming-using-
visual-basic-10th-edition-schneider-test-bank/
https://testbankdeal.com/product/introduction-to-programming-using-
visual-basic-2012-9th-edition-schneider-test-bank/
https://testbankdeal.com/product/horngrens-accounting-the-managerial-
chapters-10th-edition-nobles-solutions-manual/
Differential Equations Computing and Modeling and
Differential Equations and Boundary Value Problems
Computing and Modeling 5th Edition Edwards Solutions
Manual
https://testbankdeal.com/product/differential-equations-computing-and-
modeling-and-differential-equations-and-boundary-value-problems-
computing-and-modeling-5th-edition-edwards-solutions-manual/
https://testbankdeal.com/product/biology-exploring-the-diversity-of-
life-canadian-3rd-edition-russell-test-bank/
https://testbankdeal.com/product/statistics-for-management-and-
economics-10th-edition-gerald-keller-test-bank/
https://testbankdeal.com/product/rodaks-hematology-clinical-
principles-and-applications-5th-edition-keohane-test-bank/
https://testbankdeal.com/product/busn-introduction-to-business-
canadian-3rd-edition-kelly-test-bank/
TX GOV 1st Edition Maxwell Solutions Manual
https://testbankdeal.com/product/tx-gov-1st-edition-maxwell-solutions-
manual/
Chapter 5
Multiple Choice (21) WARNING: CORRECT ANSWERS ARE IN THE SAME POSITION AND TAGGED WITH **.
YOU SHOULD RANDOMIZE THE LOCATION OF THE CORRECT ANSWERS IN YOUR EXAM.
1. When reading data from a file, the open function returns a(n) __________.
a. file object **
b. file name
c. file handle
d. file tuple
3. After all the lines of a file have been read, the readline method returns __________.
a. the empty string **
b. an empty tuple
c. the value None
d. a Throwback error
4. Python uses a(n) __________ as a temporary holding place for data to be written to disk.
a. buffer **
b. temp space
c. special memory location
d. list
6. Which standard library module do you need to import in order to use the remove and rename
functions for files?
a. os **
b. file
c. path
15. To avoid a potential runtime error when opening files for reading or writing:
a. use the os.path.isfile function **
b. use the os.path.file.exists function
c. prompt the user for the action to take if the file does not exist
d. use the Boolean value try to check if the file exists
18. Each piece of data in a CSV file record is referred to as a(n) __________.
a. field **
b. record
c. tuple
d. line
19. In a dictionary, a pair such such as “dog” : “rover” is called a(n) __________.
a. item **
b. pair
c. key
d. couple
20. Which file format stores data as a sequence of types that can only be access by special readers?
a. binary **
b. text
21. In order for Python to use functions to work with binary files, you must first import which
standard library module?
a. pickle **
b. os
c. binaries
d. osfile
True/False (23)
1. After all the lines of a file have been read, the readline method returns the value None.
Answer: false
2. You must close a file in order to guarantee that all data has been physically written to the disk.
Answer: true
3. The remove and rename functions cannot be used with open files.
Answer: true
Answer: true
Answer: false
Answer: true
Answer: false
Answer: true
Answer: true
Answer: false
11. infile is a descriptive name bot not mandatory for file input usage.
Answer: true
12. An attempt to open a nonexistent file for input generates a syntax error.
Answer: false
13. If a file that already exists is opened for writing, the contents of the file will be erased.
Answer: true
Answer: false
Answer: true
Answer: true
17. The data in the fields of each record in a CSV file normally should be related.
Answer: true
Answer: true
Answer: true
Answer: false
Answer: false
Answer: true
1. Complete the following function to open the file for reading and read the contents into a single
string named contents.
def readFile(file):
Answer:
infile = open(file, ‘r’)
contents = infile.read()
2. Write a Python statement to open a file called names for writing and assign it to a variable called
outfile.
3. Write a Python statement to open a file called grades with the intent to add values to the end of
the file and assign it to a variable called outfile.
4. Write a single Python statement to convert the list [“spring”, “summer”, “fall”, “winter”] to a set
called seasons.
5. Write a single Python statement to convert the tuple (“spring”, “summer”, “fall”, “winter”) to a
set called seasons.
7. Explain the difference between a simple text file and a CSV-formatted file.
Answer: A simple text file has a single piece of data per line. A CSV-formatter file has several items
of data on each line with items separated by commas.
9. Write a Python statement to create a copy of the dictionary called dogs into a new dictionary
called canines.
11. Why can’t lists and sets serve as keys for dictionaries?
Answer: Because dictionary keys must be immutable objects. Lists and sets are mutable.
Play music.
Hence arose his nickname of ‘Tiddy-doll.’ In Hogarth’s print of the
execution of the ‘Idle ’Prentice,’ at Tyburn, Tiddy-doll is seen holding
up a gingerbread cake with his left hand, his right being within his
coat, and addressing the mob in his usual way:—‘Mary, Mary,’ &c. His
costume agrees with the aforesaid description. For many years, (and
perhaps at present,) allusions were made to his name, as thus:
—‘You are so fine, (to a person dressed out of character,) you look
like Tiddy-doll. You are as tawdry as Tiddy-doll. You are quite Tiddy-
doll,’ &c.—Soon after the late lord Coventry occupied the house,
corner of Engine-street, Piccadilly, (built by sir Henry Hunlocke, Bart.,
on the site of a large ancient inn, called the Greyhound;) he being
annoyed with the unceasing uproar, night and day, during the fair,
(the whole month of May,) procured, I know not by what means, the
entire abolition of this festival of ‘misrule’ and disorder.”
The engraving here given is from an old print of Tiddy-doll; it is
presumed, that the readers of the Every-Day Book will look at it with
interest.
EVIL MAY-DAY.
testbankdeal.com