Lesson 10_ Read and Write Files - Check Your Understanding_ Su24_ MSBC 5070-601-602 In-Person_ Survey of Business Analytics.pdf

Full Transcript

8/14/24, 11:20 PM Lesson 10: Read and Write Files - Check Your Understanding: Su24: MSBC 5070-601-602 In-Person: Survey of Business Analytics Lesson 10: Read and Write Files - Check Your Understanding Due Aug 4 at 11:59pm Points 22 Questions 11 Time Limit N...

8/14/24, 11:20 PM Lesson 10: Read and Write Files - Check Your Understanding: Su24: MSBC 5070-601-602 In-Person: Survey of Business Analytics Lesson 10: Read and Write Files - Check Your Understanding Due Aug 4 at 11:59pm Points 22 Questions 11 Time Limit None Attempt History Attempt Time Score LATEST Attempt 1 10 minutes 19 out of 22 Score for this quiz: 19 out of 22 Submitted Aug 1 at 3:08am This attempt took 10 minutes.  Question 1 2 / 2 pts The open() function can be used in order to read as well as write to files. Correct! True False  Question 2 0 / 2 pts The open() function will read the contents of a file into a variable. You Answered True Correct Answer False open() doesn't actually read the contents it just opens the file and creates a file object. The most common ways of reading the contents with the read() and readline() methods.  Question 3 2 / 2 pts The string split() method returns a string result. True https://canvas.colorado.edu/courses/102804/quizzes/396928 1/3 8/14/24, 11:20 PM Lesson 10: Read and Write Files - Check Your Understanding: Su24: MSBC 5070-601-602 In-Person: Survey of Business Analytics Correct! False split() returns a list with the values in the list being strings based on the split() arguments.  Question 4 2 / 2 pts Which of the following methods can be used to read a line of a file into a string variable? getline() Correct! readline() open() all of the above  Question 5 2 / 2 pts A try block can be used to detect and handle a file not found error, when trying to open a file for reading. Correct! True False  Question 6 2 / 2 pts The readline() method will return an empty string when there is no more data to read from a file. Correct! True False  Question 7 2 / 2 pts The result of the open function can be used as part of a for statement to loop over and read each line of a file. Correct! True False  https://canvas.colorado.edu/courses/102804/quizzes/396928 2/3 8/14/24, 11:20 PM Lesson 10: Read and Write Files - Check Your Understanding: Su24: MSBC 5070-601-602 In-Person: Survey of Business Analytics Question 8 2 / 2 pts The statements in an except block will get executed. True Correct! False  Question 9 1 / 2 pts A function that can be used to write data to a file is (select all that apply): Correct Answer write() Correct! print() save() read()  Question 10 2 / 2 pts In order to read a file in Python, the open() function can be used to connect a variable with the file. Correct! True False  Question 11 2 / 2 pts The string split() method only recognizes the comma as a delimiter True Correct! False Quiz Score: 19 out of 22 https://canvas.colorado.edu/courses/102804/quizzes/396928 3/3

Use Quizgecko on...
Browser
Browser