The Internet of Things is made up of a growing number of devices that collect and
transfer data over the Internet without human involvement. - correct answer True
Which of the following is not a primary contributor to data science?
A)domain expertise
B)computer science
C)procurement
D)statistics - correct answer c)procurement
Which of the following is not a good description of the goal of data science?
A)Turn data into information, and information into knowledge.
B)Use data to answer real-world questions.
C)Protect data against invalid access.
D)Use data to gain insight, and use insight to take action. - correct answer c)Protect
data against invalid access.
What does "cleaning" data mean?
A)Truncating long floating-point values to a reasonable number of decimal places.
B)Removing data that does not support the desired conclusion.
C)Preparing data for analysis by improving its structure and organization.
D)Presenting data in clear graphs and diagrams. - correct answer c)Preparing data for
analysis by improving its structure and organization.
The data science process is linear. - correct answer False
Python is probably the most popular programming language for data science. - correct
answer True
Module - correct answer a single Python file that contains a group of related functions,
classes, and variables.
Example: the math module- contains many functions that perform basic mathematical
operations.
Package - correct answer a group of modules; a folder containing modules and even
other packages; a package is just a special kind of module that can contain other
modules.
,Example: the tkinter package contains several modules that all contribute to the
development of graphical user interfaces (guis).
Ex: Python Standard library
Import - correct answer you must import a module, or particular elements of a module,
in order to use them except for built-in
Script - correct answer main driver of the program; a program is not only composed of
the script code that drives it, but is also made up of the functions that are used from
imported modules
Module vs. Script - correct answer both contain Python code: file names that have a .py
extension.
Script- can be thought of as the main driver of a program
Module- is thought of as a library, containing functions and other elements that are
imported and used in a script. A module can import other modules as needed.
Namespace - correct answer items in the module allow two items to have the same
name as long as they are in different modules.
Functions of the math module do not have to be imported - correct answer False
The only functions that don't need to be imported is the built-ins
An import statement finds a module and binds it to a name you can use in a program -
correct answer True
Refer to the function in the module by using a dot operator
Ex: import package.module
Two functions can have the same name if they are in different modules - correct answer
True
Modules provide a unique namespace in which to define functions and classes
An entire module can be imported using one import statement - correct answer True
The from clause of an import statement lets you define an alias for a module or function
- correct answer False
If you use a 'from' clause on an import statement, you don't have to use the module
name to refer to a function from that module - correct answer True
,Constant - correct answer a variable, except that its value never changes; whose value
doe not vary at all.
Naming convention:
All uppercase w/ individual words separated by an underscore
Can hold any type of data
Why use constants? - correct answer -Constants convey more meaning than literals.
-They help prevent errors caused by inappropriate modifications.
-They make maintenance tasks easier and safer.
Is constant's value permanent? - correct answer Python does not prohibit changing a
constant's value; in Python the idea of a constant is itself a convention.
Ex: pi in the math module is a constant
Which of the following identifiers follows the naming convention for a Python constant?
A)MAXPENALTIES
B)maxpenalties
C)MAX_PENALTIES
D)Max_Penalties - correct answer c)MAX_PENALTIES
Python constants cannot be created for floating-point values - correct answer False
Constants automatically convert between units of measure - correct answer False
Which of the following is NOT a reason to use a constant?
A)Constants prevent inadvertent programming errors.
B)Constants minimize the need for input validation.
C)Constants make maintenance tasks easier and safer.
D)Constants convey more meaning than literals. - correct answer b)Constants minimize
the need for input validation
Which of the following is NOT a constant from the Python Standard Library?
A)conversions.KILOMETERS_PER_MILE
B)tkinter.NE
C)math.pi
D)math.e - correct answer a)conversions.KILOMETERS_PER_MILE
, Conditional expression - correct answer is an expression that produces one of two
possible values depending on a boolean condition.
Syntax:
Expr1 if boolean-expr else expr2
Conditional expression vs. If-else statement - correct answer An expression produces a
value that, to be useful, you must do something with (print it, assign it to a variable,
etc.).
A statement stands on its own. The behavior of an if statement depends on the
statements that are controlled by the condition.
If the value of weight is 7, what does the following statement print?
Print('The weight is ' + ('even' if weight % 2 == 0 else 'odd'))
A)The weight is even
B)The weight is odd
C)The weight is void
D)The weight is NAN - correct answer b)The weight is odd
Which assignment statement is functionally equivalent to the following if statement?
If num1 > total:
Num1 = total
Else:
Num1 = 0
A)num1 = total if num1 > total else 0
B)num1 = 0 if total > 0 else total
C)num1 = 0 if num1 > total else total
D)num1 = total if num1 > 0 else 0 - correct answer a)num1 = total if num1 > total else 0
If the value of num is 7 and the value of max is 10, what is the value of num after the
following statement is executed?
Num = max if max < num else max - num
A)3
B)4
C)7
D)10 - correct answer a)3
What does the following statement print?