MIS 315 - Exam 2 Review

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which mode specifier will erase the contents of a file if it already exists and create the file if it does not already exist? A) 'w' B) 'r' C) 'e' D) 'a'

A) 'w'

Which list will be referenced by the variable number after the following code is executed? number = range(0, 9, 2) A) [0, 2, 4, 6, 8] B) [2, 4, 6, 8] C) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] D) [1, 3, 5, 7, 9]

A) [0, 2, 4, 6, 8]

What is the first negative index in a list? A) -0 B) -1 C) 0 D) the size of the list minus 1

B) -1

What are the data items in a list called? A) values B) elements C) data D) items

B) elements

The primary difference between a tuple and a list is that... A)you don't use commas to separate elements in a tuple B) once a tuple is created, it cannot be changed C) a tuple can only include string elements D) a tuple cannot include lists as elements

B) once a tuple is created, it cannot be changed

When a file has been opened using the 'r' mode specifier, which method will return the file's contents as a string? A) input B) write C) read D) get

C) read

True or False: A tuple can be converted to a list, but a list can't be converted to a tuple.

False

True or False: A tuple is mutable.

False

True or False: Both tuples and lists are enclosed in square brackets.

False

True or False: Failure to close an output file NEVER results in data loss.

False

True or False: Functions don't reduce duplication of code.

False

True or False: Hierarchy Charts show the flow of logic inside a function.

False

True or False: If a file with the specified name already exists when the file is opened and the file is opened in 'w' mode, then an alert will appear on the screen.

False

True or False: Indexing starts at one for a list.

False

True or False: Lists can't be an argument that is passed to a function.

False

True or False: Making changes to a parameter will also change the argument.

False

True or False: Matplotlib is part of the standard Python Library.

False

True or False: Matplotlib.pyplot creates line graphs, but not bar charts.

False

True or False: One drawback in reading python text files is, there is no way to read data one line at a time for processing.

False

True or False: Python file modes include: 'r' to read a file, 's' to save a file, and 'a' to append a file.

False

True or False: The append method add list elements to the beginning of the list.

False

True or False: There are no rules for function names.

False

True or False: To call a function, indent three times, () function name.

False

True or False: When two lists are concatenated, they are deleted and a new single list replaces them.

False

True or False: The index of the first element in a list is 1, the index of the second element is 2, and so forth.

False

True or False: A function is a group of statements that exist within a program for the purpose of performing a specific task.

True

True or False: A sequence is an object that contains multiple items of data.

True

True or False: A slicing expression selects a range of elements from a sequence.

True

True or False: A void function simply executes the statements it contains and terminates.

True

True or False: An exception handler is a piece of code that is written using the try/except statement.

True

True or False: Closing a file disconnects the communication between the file and the program.

True

True or False: In a function definition, indents are necessary.

True

True or False: Matplotlib contains a module called pyplot that creates graphs.

True

True or False: Pieces of data sent to a function are called arguments.

True

True or False: Programmers usually refer to the process of saving data in a file as 'writing data' and use the term output file to describe the file that the data was written to.

True

True or False: Python works with text files only. One must convert numbers to text.

True

True or False: The * symbol becomes a repetition operator if the operand on the left side is a sequence and the operand on the right side is an integer.

True

True or False: The \n escape sequence often causes an extra line in printed output and can be removed with rstrip (\n).

True

True or False: The built-in len function returns the length of a sequence.

True

True or False: The open function creates a file object it associates it with a file on the disk.

True

True or False: The second row, third column in a two dimensional list would be index position row 1, column 2.

True

True or False: When a value is assigned to a variable in a function, it has scope only in that function.

True

True or False: When using try/except, you can create a handler to show your instructions rather than have the program display a traceback error.

True

True or False: When writing files, the newline escape sequence (\n), causes each line to appear as a separate line in the text editor.

True

True or False: While loops terminate when readline encounters an empty string.

True

True or False: Writing data to an exiting file will replace the file.

True

True or False: Global variables make programs hard to debug.

True

True or False: To delete list elements by index position it is... del name_of_list[index number]

True

True or False: Tuples process faster and tuples are immutable.

True


संबंधित स्टडी सेट्स

Chapter 37: Caring for Clients with Central and Peripheral Nervous System Disorders

View Set

Fundamentals of Management Exam 2 (Ch. 5-8)

View Set

The Etruscans (and their influence on early Rome)

View Set

Physio Lab 11 - Respiratory Physiology and PhEx 7 - Respiratory System Mechanics

View Set

prop and casuality practice test

View Set

Chapter 4 - The Secondary Mortgage Market

View Set

Period 5 (Part 1) - Manifest Destiny and Sectional Conflict?

View Set

Ch 1. Microbiology Assignment Questions

View Set

Difference between Class I and Class II MHC proteins

View Set