COMP560 W6 ZyCh7_Files
1) When reading a file in Python, you must specify two items:A) a file name and mode 2) Before accessing a file, the program must:A) open the file3) After executing the following code snippet, what part is the file object?…
1) When reading a file in Python, you must specify two items:A) a file name and mode 2) Before accessing a file, the program must:A) open the file3) After executing the following code snippet, what part is the file object?…
1) A set is a container that stores a collection of:A) unique values2) One key difference between a set and a list is:A) Set elements are not stored in any particular order3) Which statement correctly creates a set named colors that contains…
1) Which of the following is considered by the text to be the most important consideration when designing a class?A) Each class should represent a single concept or object from the problem domain. 2) Which of the following questions should…
1) Consider the triangleArea function from the textbook shown below: Where is/are the recursive call(s)?A) line #7 2) Consider the triangleArea function from the textbook shown below: Where is/are the terminating condition(s)?A) lines #3 and #53) Consider the following code snippet for recursive addition:…
1) A ___________________________ is a sequence of instructions with a name. A) function 2) Consider the following function call round(3.14159, 3) what is the return value?A) 3.141 3) Consider the following function call ceil(3.14159) what is the return value?A) 4.0 4) Which of the…
1) What is a list in Python?A) a container that stores a collection of elements that are arranged in a linear or sequential order 2) Given the following list, what value is at index 5? A) 6 3) Consider the following line…
1) To store a value for later use in Python, the programmer needs to create a:A) variable2) How is a value stored in a variable?A) an assignment statement3) What is the value of the variable num after the following code snippet? A)…
1) How many times will the following loop run? i = 0 while i < 10 : print(i) i = i + 1 A) 10 2) How many times does the code snippet given below display “Loop Execution”?…
1) What is printed by the following code snippet? A) The answers are: 10 11 2) Although the following code statement is valid, print(10/0), what will happen when this code is executed?A) The error message ZeroDivisionError: int division or modulo by zero is…
2.8.1: Calculate the length of this string literal. 2.8.2: Test your understanding of strings. 2.8.3: Test your understanding of concatenation. 2.8.4: Determine the result from each of the following string operations. 2.8.5: What is printed by the following code segment? 2.8.6: Test your understanding of converting…