Final Exam Study BIS 628
True or False: If you do not specify the alignment, all values displayed in a field are right aligned by default.
False - only numeric values are right aligned by default
True or False: The == comparison evaluates to True only if both dictionaries have the same key-value pairs in the same order.
False - regardless of their order, == does this.
True or False: String method find causes a ValueError if it does not find the specified substring.
False - returns -1. index causes ValueError.
True or False: Set method pop returns the first element added to the set.
False - returns an arbitrary set element.
True or False: Sets may be compared with only the == and != comparison operators.
False - you can use all comparison operators to compare sets.
True or False: The ? quantifier matches exactly one occurrence of subexpression.
False - zero to one occurrences
Module copy provides function deep_copy, which returns a deep copy of its argument.
False: deepcopy
True or False: By default, NumPy displays trailing 0s to the right of the decimal point in a floating-point value.
False: does not display trailing 0s in the fractional part of a float
True or False: If the finally clause appears in the function, it is guaranteed to execute, regardless of whether the function raises an exception.
False: only executes if program control enters the corresponding try suite.
The array method copy returns a new array that is a view (shallow copy) of the original copy.
False: produces a deep copy of the original array.
True or False: In Python, it is possible to return to the raise point of an exception via keyword return.
False: try
Which of the following statements is false? ch 8
The re module's finditer function works like findall, but returns a greedy iterable of match objects.
Function array creates an array from:
an array or other collection of elements
ndim contains:
an array's number of dimensions
Set
an unordered collection of unique immutable elements
Presentation type _________ formats a character code as its corresponding character.
c
________ is the key technology typically used to implement recommender systems ("if you liked this movie, you might also like..."). ch 12
collaborative filtering
Method _________ returns the number of times a given substring occurs in a string.
count
Preparing data for analysis is called __________ or __________. A subset of this process is data cleaning.
data munging, data wrangling
Tokens are separated from one another by _________.
delimiters
Sentiment analysis:
determines whether text is positive, neutral, or negative.
Two sets are _______ if the sets do not have any common elements.
disjoint
Presentation types ________ and ________ format floating point and Decimal values in scientific notation.
e, E
The classes that Python uses to create file objects are defined in the Python Standard Library's _______ module.
io
Method ___________ returns True if a string contains only letters and numbers.
isalnum
Method __________ returns True if a string contains only letters.
isalpha
Dictionary method __________ returns each key-value pair as a tuple.
items
Dictionary method _________ returns an unordered list of the dictionary's keys.
keys
lstrip removes ________ and rstrip removes _________.
leading whitespace, trailing whitespace
NumPy function __________ returns an ndarray containing evenly spaced floating-point values.
linspace
________ are sets of consecutive words in a corpus for use in identifying words that frequently appear adjacent to one another. ch 12
n -grams
The NumPy library provides the __________ data structure, which is typically much faster than lists.
ndarray
Legacy Code
old code that is often no longer supported.
A subset is a ___________ subset of another set if all the subset's elements are in the other set and the other set has more elements.
proper
Use the ________ statement to indicate that a problem has occurred at execution time.
raise
The statement that raises an exception is sometimes called the __________ of the exception
raise point
The os module's _____ and ______ functions delete a file and specify a new name for a file, respectively.
remove, rename
Closing the files helps prevent a __________ in which the file resource is not available to other programs because a program using the file never closes it.
resource leak
noun_phases property:
returns a WordList object containing a list of Word objects - one from each noun phrase in the text.
Function _________ finds in a string the first substring that matches a regular expression.
search
A file object's _________ method can be used to reposition the file-position pointer.
seek
Coverting objects to JSON text format is known as ________, and reconstructing the original Python object from the JSON text is known as ________.
serialization, deserialization
You can create a set from another collection of values by using the built-in _________ function.
set
A view is also known as a __________.
shallow copy
String method ________ tokenizes a string using the delimiter provided in the method's string argument.
split
An uncaught exception in a function causes ___________. The function's stack frame is removed from the function-call stack.
stack unwinding
The ______ property returns a list of tuples, each containing a word and a string representing its part-of-speech tag.
tags
%timeit magic command:
times the average duration of operations.
NumPy offers dozens of standalone functions, which it calls ________.
universal functions (ufacs)
NumPy functions ________ and ___________ calculate variance and standard deviation, respectively.
var, std
Objects that "see" the data in other objects, rather than having their own copies of the data are called ________ objects. ch 7
view
The _________ implicitly releases resources when its suite finishes executing.
with
union augmented assignment
|=
True or False: The character class [^0-9] matches any digit.
False - matches anything that is NOT a digit.
True or False: A view has its own copy of the corresponding data from the dictionary.
False
True or False: Formatted data in a text file can be updated in place because records and their fields are fixed in size.
False
True or False: the read method always returns the entire contents of the file.
False
True or False: Sets are collections of unique mutable and immutable objects.
False - only immutable objects.
True or False: The actual number of frames-per-second is affected only by the millisecond interval between animation frames.
False - can also be affected by amount of work performed in each frame and the speed of your computer's processor.
True or False: It is good practice to keep resources open until your program terminates.
False - close the resources
True or False: Generally, displaying fewer frames-per-second yields smoother animation.
False - displaying more frames-per-second is smoother.
True or False: Assigning to a nonexistent dictionary key causes an exception.
False - it inserts a new key--value pair
True or False: Dictionaries may contain duplicate keys.
False - keys must be unique.
Which of the following statements a), b) or c) is false? ch 12
All of the above statements are true.
Which of the following statements a), b) or c) is false? ch 7
All of the above statements are true.
intersection augmented assignment
&=
The raw string r'\\Hi!\\' represents the regular string:
'\\\\Hi!\\\\'
To display all numeric values with their sign, use a _______ in the format specifier; to display a space rather than a sign for positive values use a _________ instead.
+, space character
Which of the following statements about NumPy's linspace function is false? ch7
All of the above statements are true.
Which of the following statements a), b) or c) is false? ch 7
A 24-element one-dimensional array can be reshaped into a 2-by-12, 8-by-3 or 4-by-8 array, and vice versa.
Which of the following statements a), b) or c) is false? ch 6
A dictionary's keys must be mutable (such as strings, numbers or tuples) and unique (that is, no duplicates).
Which of the following statements a), b) or c) is false? ch 6
All of these are true
A(n) __________ specifies everything that should change during one plot update. Stringing together many of these over time creates the animation effect.
Animation frame
Preparing data for analysis is called ________. ch 8
Both
The following code creates and configures a WordCloud object:from wordcloud import WordCloud wordcloud = WordCloud(colormap='prism', mask=mask_image,background_color='white')Which of the following statements is false? ch 12
By default, the word is drawn on a white background.
Which of the following statements is false? ch 9
CSV files cannot contain spaces after commas.
The pickle module:
Can serialize objects into a Python-specific data format.
A pandas ________ is an enhanced two-dimensional array. ch 7
DataFrame
________ can be thought of as unordered collections in which each value is accessed through its corresponding keys.
Dictionaries
Which of the following statements is false? ch 9
If the finally suite raises a new exception that the suite does not catch, program execution terminates.
Which of the following statements is false? ch 9
In most cases, when you need to raise an exception, it's recommended that you customize the exception type with a meaningful exception name.
Which of the following statements are false? ch 9
JSON is a data-interchange format readable only by computers and used to represent objects (such as dictionaries, lists and more) as collections of name—value pairs.
TextBlob is an object-oriented NLP text-processing library built on the _________ and ________ NLP libraries, and simplifies accessing their capabilities.
NLTK, pattern
Which of the following statements are false? ch 9
The mode 'w' opens the file for writing, creating the file if it does not exist. If the file already exists, opening it for writing causes any new data to be appended to the end of the file.
_________ is the process of evaluating words based on their context to determine each word's part of speech.
Part-of-speech (POS) tagging
Which of the following statements a), b) or c) is false? ch 6
Sets are immutable, so sets can have other sets as elements.
Which of the following is not a TextBlob capability? ch 12
Similarity detection
Which of the following statements a), b) or c) is false? ch 6
String keys are case insensitive.
Which of the following statements a), b) or c) is false? ch 8
Strings support many of the same sequence operations as sets, lists and tuples.
_________ is the fundamental class for NLP with the textblob module.
TextBlob
Which of the following statements is false? ch 12
TextBlob, Sentences and Words cannot be compared with strings.
Which of the following statements is false? ch 8
The d presentation type in the following f-string formats strings as integer values: f'{10:d}'
True or False: Any string can be a regular expression.
True
True or False: By default, iterating through a file object with a for statement reads one line at a time from the file and returns it as a string.
True
True or False: JSON is both human-readable and computer-readable format that make it convenient to send and receive objects across the Internet.
True
True or False: TextBlobs support string methods and can be compared with string using the comparison operators.
True
True or False: When one of the operands of an array operator is a scalar, NumPy uses broadcasting to perform the calculation as if the scalar were an array of the same shape as the other operand, but containing the scalar value in all its elements.
True
Which of the following statements a), b) or c) is false? ch 9
Wrap a separate try statement around every individual statement that raises an exception.
the attribute shape contains:
a tuple specifying an array's dimension