Access Introduction to Programming Using Python 1st Edition Schneider Test Bank All Chapters Immediate PDF Download
Access Introduction to Programming Using Python 1st Edition Schneider Test Bank All Chapters Immediate PDF Download
com
https://testbankfan.com/product/introduction-to-programming-
using-python-1st-edition-schneider-test-bank/
OR CLICK HERE
DOWLOAD NOW
https://testbankfan.com/product/introduction-to-programming-using-
python-1st-edition-schneider-solutions-manual/
testbankfan.com
https://testbankfan.com/product/introduction-to-programming-using-
visual-basic-10th-edition-schneider-test-bank/
testbankfan.com
https://testbankfan.com/product/introduction-to-programming-using-
visual-basic-2012-9th-edition-schneider-test-bank/
testbankfan.com
https://testbankfan.com/product/litigation-paralegal-a-systems-
approach-6th-edition-mccord-solutions-manual/
testbankfan.com
Strategic Management in Action 6th Edition Coulter
Solutions Manual
https://testbankfan.com/product/strategic-management-in-action-6th-
edition-coulter-solutions-manual/
testbankfan.com
https://testbankfan.com/product/m-information-systems-2nd-edition-
baltzan-test-bank/
testbankfan.com
https://testbankfan.com/product/management-science-the-art-of-
modeling-with-spreadsheets-excel-2007-update-1st-edition-powell-test-
bank/
testbankfan.com
https://testbankfan.com/product/applied-digital-signal-processing-1st-
edition-manolakis-solutions-manual/
testbankfan.com
https://testbankfan.com/product/experience-sociology-2nd-edition-
croteau-solutions-manual/
testbankfan.com
Engineering Electromagnetics and Waves 2nd Edition Inan
Solutions Manual
https://testbankfan.com/product/engineering-electromagnetics-and-
waves-2nd-edition-inan-solutions-manual/
testbankfan.com
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.