Data Analysis with Python
- 136Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
Which sequence best captures the core activities involved in data analysis?
Which sequence best captures the core activities involved in data analysis?
136 questions
- 1
Which sequence best captures the core activities involved in data analysis?
- A
Sampling, labeling, publishing, and licensing data for public access
- B
Designing, compiling, deploying, and maintaining software for data systems
- C
Collecting, encrypting, compressing, and archiving data for long-term storage
- D
Inspecting, cleansing, transforming, and modeling data to find useful information
Correct answer
DInspecting, cleansing, transforming, and modeling data to find useful information
Explanation
Data analysis involves inspecting, cleansing, transforming, and modeling data to discover useful information, draw conclusions, and support decisions.
- A
- 2
Why is turning data into information a central objective of analysis?
- A
Raw records become useful when they support meaningful conclusions or decisions
- B
Raw records become conclusions once every value has been visualized
- C
Raw records become information whenever they are sorted alphabetically
- D
Raw records become more valuable when they are stored in additional formats
Correct answer
ARaw records become useful when they support meaningful conclusions or decisions
Explanation
Analysis aims to interpret data in a way that reveals useful meaning, such as discovering a purchasing pattern that can guide decisions.
- A
- 3
A retailer has a year of purchase records. Which result is an example of information rather than raw data?
- A
A list of every purchase recorded during the year
- B
A finding that a particular product sells better on Tuesdays
- C
A database containing customer and product identifiers
- D
A table containing the time and price of each transaction
Correct answer
BA finding that a particular product sells better on Tuesdays
Explanation
The purchase records are raw data; a pattern such as a product selling better on Tuesdays is an interpreted finding.
- A
- 4
Why might different departments need different reports from the same analysis?
- A
They may need different views or levels of detail to use the findings
- B
Each department needs a different dataset because analysis changes the facts
- C
Reports for different departments cannot share underlying information
- D
Each department must calculate its own unrelated version of the data
Correct answer
AThey may need different views or levels of detail to use the findings
Explanation
Marketing, sales, accounting, and executives may use the same findings but need different presentations or levels of detail.
- A
- 5
What is the primary role of data modeling in the analysis process described?
- A
Converting every text field into a numerical field before visualization
- B
Arranging records alphabetically so that conclusions are easier to publish
- C
Representing real-life situations in information systems and looking for patterns
- D
Replacing source data with simulated records to simplify reporting
Correct answer
CRepresenting real-life situations in information systems and looking for patterns
Explanation
Modeling adapts real-life scenarios to information systems and can use inferential statistics to identify patterns or models.
- A
- 6
Which pairing correctly matches common tools with their purposes in the tutorial's data-analysis stack?
- A
Matplotlib for database connections; Seaborn for file-system management
- B
NumPy for report writing; Matplotlib for data collection
- C
Pandas for data analysis; Matplotlib and Seaborn for visualization
- D
Seaborn for SQL queries; pandas for operating-system commands
Correct answer
CPandas for data analysis; Matplotlib and Seaborn for visualization
Explanation
Pandas is used for data analysis, while Matplotlib and Seaborn are used to create visualizations.
- A
- 7
Why is statistical analysis useful after data has been cleaned and reshaped?
- A
It converts every analysis into a machine-learning project
- B
It helps reveal trends, patterns, and anomalies in prepared data
- C
It guarantees that all collected values are accurate and complete
- D
It removes the need to communicate findings to other users
Correct answer
BIt helps reveal trends, patterns, and anomalies in prepared data
Explanation
Once data is prepared, analysis—including statistical analysis—helps extract patterns and identify trends or anomalies.
- A
- 8
What should an analyst generally do after identifying meaningful findings?
- A
Replace the original dataset with a chart and discard the analysis
- B
Keep the findings within the analysis tool so the underlying data stays private
- C
Provide evidence, communicate results in reports or dashboards, and support decisions
- D
Avoid presenting conclusions until every possible model has been tested
Correct answer
CProvide evidence, communicate results in reports or dashboards, and support decisions
Explanation
The final objective includes providing evidence, creating readable reports or dashboards, and helping others make decisions.
- A
- 9
What does inferential statistics contribute to modeling data?
- A
It assigns column names to files before they can be imported
- B
It ensures that a dataset contains no invalid or missing values
- C
It turns categorical variables into visual charts automatically
- D
It helps assess whether patterns or models arise from observed data
Correct answer
DIt helps assess whether patterns or models arise from observed data
Explanation
The tutorial associates inferential statistics with modeling and examining whether patterns or models arise.
- A
- 10
Which example best illustrates an anomaly-focused analysis?
- A
Sorting customer records by name before importing them
- B
Listing every column name in the dataset without examining its values
- C
Investigating unusually negative profits or unexpectedly large values
- D
Changing all numeric values into strings to prevent calculation errors
Correct answer
CInvestigating unusually negative profits or unexpectedly large values
Explanation
A quick statistical overview can reveal unusual values, such as negative profit or very large amounts, that warrant investigation.
- A
- 11
Why is evidence important when communicating analytical conclusions?
- A
Evidence guarantees that every audience will need the same report
- B
Evidence lets users assess the basis for the findings and decisions
- C
Evidence makes it unnecessary to explain what the analysis means
- D
Evidence allows analysts to omit data preparation from their work
Correct answer
BEvidence lets users assess the basis for the findings and decisions
Explanation
The analysis should provide evidence for findings so that reports and decisions are grounded in the processed data.
- A
- 12
Which statement best distinguishes data analysis from data science as described?
- A
Data scientists typically emphasize programming, mathematics, and machine learning; analysts often emphasize communication and reporting
- B
Data analysts require more advanced mathematics, while data scientists focus mainly on storytelling
- C
Data science excludes data preparation, while data analysis includes only machine learning
- D
Data scientists work only with visual tools; analysts work only with programming languages
Correct answer
AData scientists typically emphasize programming, mathematics, and machine learning; analysts often emphasize communication and reporting
Explanation
The boundaries are not clear-cut, but data scientists are described as typically having stronger programming and math skills, while analysts often excel in communication and storytelling.
- A
- 13
What is the main advantage of managed, closed products such as Excel or Tableau?
- A
They are generally easier to learn and come with vendor documentation and support
- B
They can connect to every possible source without limits
- C
They allow unrestricted customization of every part of their implementation
- D
They eliminate the need to understand the data being analyzed
Correct answer
AThey are generally easier to learn and come with vendor documentation and support
Explanation
Closed tools are often easier to learn and are supported by a company that provides documentation and product support.
- A
- 14
What is a key limitation of a closed analysis tool?
- A
It cannot produce visualizations or readable reports
- B
It requires users to write every operation in a programming language
- C
Its scope can be limited to the capabilities provided by the product
- D
It cannot be supported by a company or vendor
Correct answer
CIts scope can be limited to the capabilities provided by the product
Explanation
The tutorial contrasts closed tools' ease of use with their limited scope: users may be unable to go beyond the product's boundaries.
- A
- 15
What best describes the category called open or programming tools in the tutorial?
- A
A group of database servers that cannot connect to external libraries
- B
A set of vendor products that share a single subscription and interface
- C
A combination of programming languages, open-source libraries, and related products
- D
A collection of spreadsheet templates that do not use code
Correct answer
CA combination of programming languages, open-source libraries, and related products
Explanation
Open tools are described as combinations of languages, open-source libraries, and products rather than one vendor's packaged tool.
- A
- 16
Why can programming languages offer greater flexibility than a single closed product?
- A
Programming languages avoid the need to learn any technical concepts
- B
Programming languages restrict users to a fixed set of vendor-approved workflows
- C
Libraries and code can address specialized sources and tasks beyond one product's built-in scope
- D
Libraries prevent data from being combined across sources
Correct answer
CLibraries and code can address specialized sources and tasks beyond one product's built-in scope
Explanation
The programming ecosystem can handle specialized needs, such as authenticated APIs or cloud data streams, giving it broader flexibility.
- A
- 17
How can programming skills provide career flexibility for a data analyst?
- A
They limit the analyst to the software used in their first job
- B
They teach transferable data-processing abilities that are not tied to one product
- C
They remove the need to learn new tools throughout a career
- D
They guarantee that a particular analysis product will remain in business
Correct answer
BThey teach transferable data-processing abilities that are not tied to one product
Explanation
Learning to process data with a programming language can provide freedom to change tools or roles instead of relying on one product.
- A
- 18
What is the principal disadvantage of adopting a programming language for analysis?
- A
It offers less flexibility than a packaged analysis product
- B
It cannot process data from files or databases
- C
It takes time to learn coding fundamentals before using it effectively
- D
It requires every analysis to be performed by hand
Correct answer
CIt takes time to learn coding fundamentals before using it effectively
Explanation
Programming languages are not as simple to learn as point-and-click tools because users must first learn coding basics.
- A
- 19
Which reason for choosing Python is explicitly supported by the content?
- A
It is designed exclusively for statistical research and nothing else
- B
It is a closed product with one vendor controlling all its libraries
- C
It is described as intuitive to learn and has libraries for many kinds of tasks
- D
It avoids the use of community-created tools
Correct answer
CIt is described as intuitive to learn and has libraries for many kinds of tasks
Explanation
The tutorial highlights Python's approachable syntax and broad library ecosystem, which supports tasks from data analysis to other applications.
- A
- 20
What does Python being free and open source mean in the context of the tutorial?
- A
Python programs can only be shared after purchasing a license
- B
People can use it and inspect its internals and libraries rather than relying on a single proprietary vendor
- C
Python users never need documentation or community support
- D
Every Python library is automatically maintained by the same company
Correct answer
BPeople can use it and inspect its internals and libraries rather than relying on a single proprietary vendor
Explanation
The content describes Python as free and open source, with many people able to inspect the language and its libraries.
- A
- 21
Why does widespread institutional use contribute to confidence in Python's future?
- A
Organizations guarantee that Python will replace every other language
- B
Institutional use means Python's source code can no longer be changed
- C
Widespread use removes the need for an active developer community
- D
Its use by major organizations makes it less likely to disappear unexpectedly
Correct answer
DIts use by major organizations makes it less likely to disappear unexpectedly
Explanation
The tutorial argues that major organizations' reliance on Python makes it unlikely to simply go away.
- A
- 22
How does the tutorial compare Python and R?
- A
Python and R are described as identical in their libraries and learning curve
- B
R is described as lacking statistical functions, while Python has no data libraries
- C
Python is presented as limited to statistics, while R is more general-purpose
- D
Python is presented as easier to start with and more general, while R is noted for statistical libraries
Correct answer
DPython is presented as easier to start with and more general, while R is noted for statistical libraries
Explanation
The tutorial prefers Python for ease of entry and breadth, while recognizing R's large collection of statistical functions and its value in technical disciplines.
- A
- 23
Which sequence most closely represents a typical data-analysis workflow?
- A
Model data, publish it, collect it, then decide whether it needs cleaning
- B
Collect data, clean it, reshape it, analyze it, then communicate or act on results
- C
Clean data, report it, collect it, then combine it with unrelated sources
- D
Visualize data, discard raw records, collect new data, then define a question
Correct answer
BCollect data, clean it, reshape it, analyze it, then communicate or act on results
Explanation
The workflow described proceeds from gathering data through cleaning and reshaping to analysis and reporting or action.
- A
- 24
Why might data cleaning be more tedious for scraped data than for data from an organization's own database?
- A
Scraped sources are more likely to require substantial correction and preparation
- B
Scraped data cannot be analyzed with statistical tools
- C
A database cannot contain missing values or invalid entries
- D
Data from a database must always be converted into images first
Correct answer
AScraped sources are more likely to require substantial correction and preparation
Explanation
The tutorial notes that data from an organization's own database may already be in good shape, while more irregular sources such as web scraping can require more cleaning.
- A
- 25
What is the purpose of reshaping data after it has been cleaned?
- A
To replace all observations with summary statistics
- B
To organize fields and combine sources into a form suitable for analysis
- C
To prevent the dataset from being used by statistical methods
- D
To make every row visually inspectable in a spreadsheet
Correct answer
BTo organize fields and combine sources into a form suitable for analysis
Explanation
Reshaping can involve transforming fields, merging tables, and combining sources so that the data is ready for analysis.
- A
- 26
A team combines sales data from two systems and creates a calculated field. Which workflow stage is this?
- A
Deploying a machine-learning model
- B
Reshaping or transforming data for subsequent analysis
- C
Collecting the original data from its source
- D
Communicating conclusions to decision makers
Correct answer
BReshaping or transforming data for subsequent analysis
Explanation
Combining sources and creating or transforming fields are examples of preparing and reshaping data.
- A
- 27
What is the role of analysis after data has been cleaned and put into shape?
- A
Guarantee that every association is causal
- B
Extract patterns and identify trends or anomalies
- C
Convert the dataset into a different file format only
- D
Determine which vendor should own the data
Correct answer
BExtract patterns and identify trends or anomalies
Explanation
Analysis uses prepared data to find patterns, trends, and anomalies, often with statistical methods.
- A
- 28
How might the final step differ between a data-analysis project and a broader data-science project?
- A
Both must end with a database migration rather than an interpretation
- B
Analysis may focus on reports and decisions, while data science may proceed to machine-learning implementation
- C
Analysis always implements machine learning, while data science only creates spreadsheets
- D
Analysis skips communication, while data science consists only of data cleaning
Correct answer
BAnalysis may focus on reports and decisions, while data science may proceed to machine-learning implementation
Explanation
The content contrasts reporting and decision support in analysis with the possibility of implementing machine-learning models in a data-science project.
- A
- 29
Why should the analysis workflow be understood as a cycle rather than a strict straight line?
- A
Each stage permanently prevents any changes to earlier work
- B
Cleaning and analysis cannot occur in the same project
- C
Analysts often return to earlier stages as new questions or problems arise
- D
Data collection can happen only after reporting is complete
Correct answer
CAnalysts often return to earlier stages as new questions or problems arise
Explanation
In practice, analysts move back and forth between stages, so the process behaves more like a cycle than a fixed linear sequence.
- A
- 30
What does checking a dataset's shape immediately after loading help an analyst understand?
- A
Whether every value in the dataset is factually correct
- B
Whether all plotted relationships are causal
- C
How many rows and columns the dataset contains
- D
Which statistical model will explain the data
Correct answer
CHow many rows and columns the dataset contains
Explanation
A dataset's shape provides a quick reference to its number of rows and columns and therefore its overall size.
- A
- 31
What does a dataframe's info-style summary add to a simple row-and-column count?
- A
A chart of every record in the dataset
- B
Column names, data types, and counts of non-missing values
- C
A list of causal relationships between all variables
- D
A guarantee that every column has the correct meaning
Correct answer
BColumn names, data types, and counts of non-missing values
Explanation
An info summary helps reveal the columns, their types, and how many non-null values are present.
- A
- 32
When an analyst calculates a new total cost as quantity multiplied by unit cost, what kind of operation is being performed?
- A
Deriving a new field from existing columns
- B
Removing missing rows from the original data
- C
Importing a new table from a database
- D
Creating a visualization from a categorical variable
Correct answer
ADeriving a new field from existing columns
Explanation
A calculated field such as total cost is derived by combining existing columns with a formula.
- A
- 33
Why might an analyst compare a calculated cost column with the dataset's supplied cost column?
- A
To replace all source data with a visualization
- B
To determine whether the two columns have different names
- C
To prove that unit cost has no relationship to profit
- D
To detect inconsistencies that could indicate source-system or data-entry errors
Correct answer
DTo detect inconsistencies that could indicate source-system or data-entry errors
Explanation
Comparing an independently calculated value with the supplied value can expose discrepancies in the original data.
- A
- 34
What can a filter accomplish during data analysis?
- A
It automatically removes the need to understand the data domain
- B
It changes every record to satisfy the condition being tested
- C
It isolates records meeting conditions so the analyst can examine a subset
- D
It proves that a selected subset represents the whole population
Correct answer
CIt isolates records meeting conditions so the analyst can examine a subset
Explanation
Filtering lets an analyst zoom in on records such as sales from a particular region or customer group.
- A
- 35
What is Jupyter described as in the tutorial?
- A
A proprietary spreadsheet application made for one database
- B
A free, open-source ecosystem that includes notebook and lab tools
- C
A Python data type used to store columns
- D
A visualization library that only produces static charts
Correct answer
BA free, open-source ecosystem that includes notebook and lab tools
Explanation
Jupyter is presented as a free and open-source ecosystem of tools, including Jupyter Notebook and JupyterLab.
- A
- 36
What is the main difference between Jupyter Notebook and JupyterLab described in the content?
- A
JupyterLab is a programming language, while Notebook is a data structure
- B
Notebook can run Python, while JupyterLab can only display Markdown
- C
Notebook is cloud-only, while JupyterLab must run without a browser
- D
JupyterLab provides an expanded interface with features such as file browsing and terminals
Correct answer
DJupyterLab provides an expanded interface with features such as file browsing and terminals
Explanation
JupyterLab is described as an evolution of the notebook interface, adding features such as a tree view, terminal, and file previews.
- A
- 37
Why is a Jupyter Notebook useful for exploratory data analysis?
- A
It stores all analysis only as a static image
- B
It automatically inspects every record without user commands
- C
It lets users run commands interactively and see responses immediately
- D
It prevents users from mixing explanations with code
Correct answer
CIt lets users run commands interactively and see responses immediately
Explanation
A notebook is an interactive environment in which commands can be executed and their results seen immediately.
- A
- 38
What is the basic structural unit of a Jupyter Notebook?
- A
A workbook, which can contain only numerical tables
- B
A query, which must connect to a database
- C
A package, which can contain only imported libraries
- D
A cell, which can contain code or formatted text
Correct answer
DA cell, which can contain code or formatted text
Explanation
A notebook is a sequence of cells; cells can contain executable code or Markdown text.
- A
- 39
What is Markdown used for in a notebook?
- A
Executing Python expressions against a dataframe
- B
Writing formatted explanatory text that renders as a document
- C
Assigning strict data types to dataframe columns
- D
Connecting the notebook to a remote SQL server
Correct answer
BWriting formatted explanatory text that renders as a document
Explanation
Markdown is a text-formatting syntax used for titles, links, emphasis, and other readable documentation in notebooks.
- A
- 40
Why can notebooks be useful for sharing analysis results?
- A
They automatically guarantee that recipients can reproduce every result
- B
They can combine code, explanations, and outputs and can be exported as documents
- C
They convert all data into a single uneditable chart
- D
They prevent the analyst from documenting assumptions
Correct answer
BThey can combine code, explanations, and outputs and can be exported as documents
Explanation
Notebooks combine code and documentation, and the content notes that they can be exported to formats such as PDF or HTML.
- A
- 41
What does a cell's execution number indicate?
- A
The order in which that cell's code was executed
- B
The number of rows in the notebook's dataframe
- C
The number of errors the cell has produced
- D
The position of the cell in the current visual layout only
Correct answer
AThe order in which that cell's code was executed
Explanation
Execution counts preserve the order in which code was run, even if cells are later moved within the notebook.
- A
- 42
What is the difference between command mode and edit mode in a notebook?
- A
Command mode applies notebook actions to cells; edit mode changes a cell's contents
- B
Command mode is available only in JupyterLab; edit mode only in Notebook
- C
Command mode selects Markdown; edit mode selects SQL
- D
Command mode runs Python; edit mode is only for viewing output
Correct answer
ACommand mode applies notebook actions to cells; edit mode changes a cell's contents
Explanation
In command mode, keystrokes trigger cell-level actions; in edit mode, typed characters are entered into the selected cell.
- A
- 43
Which keyboard action switches from editing a cell to command mode?
- A
Pressing Shift and Return
- B
Pressing the M key
- C
Pressing Return
- D
Pressing Escape
Correct answer
DPressing Escape
Explanation
Escape switches from edit mode to command mode; Return can enter edit mode for the selected cell.
- A
- 44
In command mode, which shortcuts add a cell above or below the selected cell?
- A
B adds above; A adds below
- B
M adds above; Y adds below
- C
A adds above; B adds below
- D
X adds above; V adds below
Correct answer
CA adds above; B adds below
Explanation
The tutorial gives A for adding a cell above and B for adding one below in command mode.
- A
- 45
How can a user change a cell between Markdown and Python code using keyboard shortcuts?
- A
Use Y for Markdown and M for code
- B
Use M for Markdown and Y for code
- C
Use A for Markdown and B for code
- D
Use X for Markdown and V for code
Correct answer
BUse M for Markdown and Y for code
Explanation
The cell-type shortcuts described are M for Markdown and Y for Python code.
- A
- 46
What is the difference between Ctrl+Return and Shift+Return when executing a notebook cell?
- A
Ctrl+Return changes the cell to Markdown; Shift+Return changes it to code
- B
Ctrl+Return advances to the next cell; Shift+Return keeps the current cell selected
- C
Ctrl+Return runs the cell and keeps it selected; Shift+Return runs it and advances
- D
Ctrl+Return deletes the cell; Shift+Return restores the previous cell
Correct answer
CCtrl+Return runs the cell and keeps it selected; Shift+Return runs it and advances
Explanation
Ctrl+Return executes while remaining on the current cell; Shift+Return executes and moves the selection onward.
- A
- 47
Which statement best explains why Jupyter is often more suitable than a terminal for interactive analysis?
- A
It combines immediate execution with cells and rich visual or written output
- B
It prevents analysts from using a Python interpreter
- C
It displays every row of a large dataset continuously
- D
It requires all commands to be entered through menus
Correct answer
AIt combines immediate execution with cells and rich visual or written output
Explanation
A notebook offers an interactive Python environment organized into cells and can display visualizations and documentation alongside results.
- A
- 48
Why is a continuously visible spreadsheet less useful as datasets grow very large?
- A
Large datasets have no statistical properties
- B
Spreadsheets cannot contain rows or columns
- C
Visual tools cannot filter any records
- D
Humans cannot reliably visually inspect millions of records, and processing can become slow
Correct answer
DHumans cannot reliably visually inspect millions of records, and processing can become slow
Explanation
The content explains that visual inspection does not scale well: people cannot keep huge datasets in mind, and processing may slow down.
- A
- 49
What information can analysts use instead of continuously viewing every record?
- A
A mental understanding of data structure plus summaries and statistical properties
- B
The file's name and the date it was downloaded
- C
A chart containing every row at the same time
- D
A list of the programming languages used in the project
Correct answer
AA mental understanding of data structure plus summaries and statistical properties
Explanation
The tutorial describes using knowledge of the data's shape and structure along with summary statistics rather than constantly looking at every row.
- A
- 50
What is NumPy's primary role in the Python ecosystem described?
- A
Creating formatted notebook documents
- B
Building interactive website interfaces
- C
Efficient numerical computation and array processing
- D
Managing database user accounts
Correct answer
CEfficient numerical computation and array processing
Explanation
NumPy is a numerical-computing library focused on processing numbers and arrays efficiently.
- A
- 51
Why can NumPy be important even if an analyst rarely calls it directly?
- A
NumPy is required only when writing Python syntax
- B
Pandas and Matplotlib are file formats created by NumPy
- C
NumPy automatically replaces all other data-analysis libraries
- D
Libraries such as pandas and Matplotlib rely on NumPy for numerical processing
Correct answer
DLibraries such as pandas and Matplotlib rely on NumPy for numerical processing
Explanation
The tutorial emphasizes NumPy's foundational role because other libraries, including pandas and Matplotlib, build on it.
- A
- 52
Why can pure Python numerical processing be less efficient for large workloads than NumPy?
- A
NumPy uses optimized low-level numerical operations and compact array representations
- B
Python cannot represent integers or decimal values
- C
Pure Python always uses a graphics processor for arithmetic
- D
NumPy stores each array element as a separate text document
Correct answer
ANumPy uses optimized low-level numerical operations and compact array representations
Explanation
NumPy provides efficient representations and takes advantage of optimized low-level operations for numerical arrays.
- A
- 53
What is a key memory-related advantage of choosing an appropriate NumPy integer type?
- A
The analyst can select a bit width suited to the values being stored
- B
The array no longer needs to store its numerical values
- C
Every integer is automatically compressed to one bit
- D
The array can store any mixture of types without extra memory
Correct answer
AThe analyst can select a bit width suited to the values being stored
Explanation
NumPy lets users choose integer widths such as 8-, 16-, 32-, or 64-bit types, which can avoid using more memory than needed.
- A
- 54
Why might age and net worth columns require different integer widths?
- A
All numeric columns must use the same width regardless of range
- B
Their plausible value ranges differ greatly, so they may need different storage capacities
- C
Net worth has fewer possible values than age
- D
Age is always a string, while net worth is always a Boolean
Correct answer
BTheir plausible value ranges differ greatly, so they may need different storage capacities
Explanation
Age has a relatively limited range, while net worth can be much larger; appropriate widths depend on the ranges that must be represented.
- A
- 55
What is the important structural difference between a NumPy array and a general Python list?
- A
A Python list supports indexing, while a NumPy array does not
- B
A NumPy array permits arbitrary mixed objects but a list does not
- C
A Python list must store all values contiguously, but a NumPy array cannot
- D
A NumPy array stores elements in a uniform, typed structure suited to numerical operations
Correct answer
DA NumPy array stores elements in a uniform, typed structure suited to numerical operations
Explanation
NumPy arrays have an associated type and a regular memory layout, enabling more efficient numerical computation than general-purpose lists.
- A
- 56
How does indexing a NumPy array generally compare with indexing a Python list?
- A
NumPy requires named keys, while lists require numeric positions
- B
NumPy does not support slicing or negative indices
- C
NumPy uses one-based indexing, while lists use zero-based indexing
- D
Basic zero-based indexing, slicing, negative indices, and steps work similarly
Correct answer
DBasic zero-based indexing, slicing, negative indices, and steps work similarly
Explanation
The tutorial notes that ordinary element access, slicing, negative indexing, and steps work similarly to Python lists.
- A
- 57
What does NumPy's multi-index selection allow an analyst to do?
- A
Select only consecutive positions without using slices
- B
Convert a two-dimensional array into a database query
- C
Assign a separate data type to every element of one array
- D
Select several positions at once and receive the selected values as an array
Correct answer
DSelect several positions at once and receive the selected values as an array
Explanation
Passing a collection of index positions selects multiple elements and returns them together as another NumPy array.
- A
- 58
Why should the dimensions of a manually constructed multidimensional NumPy array be consistent?
- A
Dimension consistency is required only for arrays of strings
- B
Mismatched nested sequences may fail to form the intended regular numeric array
- C
Inconsistent dimensions automatically make every value a floating-point number
- D
Every matrix must have exactly three rows and three columns
Correct answer
BMismatched nested sequences may fail to form the intended regular numeric array
Explanation
Regular multidimensional arrays require compatible shapes; inconsistent nested sequences may instead be treated as object data rather than the intended numeric array.
- A
- 59
What does the shape of a two-dimensional NumPy array communicate?
- A
The names of its row and column labels
- B
The values of its mean and standard deviation
- C
Its number of rows and columns
- D
Its total processing time and memory use
Correct answer
CIts number of rows and columns
Explanation
For a matrix, shape describes its dimensions, such as the number of rows and columns.
- A
- 60
How does NumPy's axis argument help when calculating a sum on a matrix?
- A
It determines whether the result is stored as text or a number
- B
It changes the matrix into a one-dimensional list permanently
- C
It specifies whether to aggregate along rows or columns
- D
It chooses which values should be treated as missing
Correct answer
CIt specifies whether to aggregate along rows or columns
Explanation
Axis selection lets an operation such as sum return results by row or by column.
- A
- 61
What does a vectorized operation such as adding a scalar to an array do?
- A
Changes the array's shape without changing its values
- B
Adds the scalar only to the first element and discards the rest
- C
Converts the array into a scalar result
- D
Applies the operation to each array element and returns an array of results
Correct answer
DApplies the operation to each array element and returns an array of results
Explanation
Vectorized operations apply an operation element by element across the array, producing a resulting array.
- A
- 62
What is broadcasting in the simple array-plus-scalar case?
- A
Converting array values into a plotted image
- B
Applying the scalar operation across every element of the array
- C
Copying the array into a second computer
- D
Changing each element to a different data type
Correct answer
BApplying the scalar operation across every element of the array
Explanation
Broadcasting allows an operation between an array and a scalar to be applied to each element of the array.
- A
- 63
What happens to an array in a typical NumPy arithmetic operation?
- A
The operation changes only the array's first element
- B
The operation deletes the original array after computing the result
- C
The operation returns a new array, while the original is unchanged unless an in-place form is used
- D
The operation always changes the original array and returns nothing
Correct answer
CThe operation returns a new array, while the original is unchanged unless an in-place form is used
Explanation
NumPy operations are generally non-mutating and return a new array; in-place operators such as an augmented assignment can modify the original.
- A
- 64
When can an elementwise operation between two arrays generally be performed as expected?
- A
When one array has no elements
- B
When their shapes are compatible for elementwise alignment
- C
When their variable names are identical
- D
When both arrays contain only strings
Correct answer
BWhen their shapes are compatible for elementwise alignment
Explanation
Elementwise array operations require compatible shapes so corresponding values can be aligned.
- A
- 65
How do Boolean arrays support data filtering in NumPy?
- A
A Boolean mask changes every selected value to true
- B
A Boolean mask sorts the array into ascending order
- C
A Boolean mask stores the names of the array's columns
- D
A Boolean mask selects elements whose corresponding entries are true
Correct answer
DA Boolean mask selects elements whose corresponding entries are true
Explanation
A Boolean array can be used as a mask: elements corresponding to true entries are selected.
- A
- 66
What is the result of comparing every array element with a condition such as being at least a threshold?
- A
A Boolean array indicating which elements satisfy the condition
- B
A new array containing only the threshold
- C
A single string describing the condition
- D
A permanent modification of every element
Correct answer
AA Boolean array indicating which elements satisfy the condition
Explanation
A vectorized comparison produces true or false for each element, which can then be used as a filter.
- A
- 67
How can multiple Boolean conditions be combined for NumPy filtering?
- A
Join the conditions into a text string and use it as an array index
- B
Convert the conditions into floating-point numbers first
- C
Apply one condition and permanently delete all remaining values
- D
Combine elementwise conditions with Boolean operators such as AND or OR
Correct answer
DCombine elementwise conditions with Boolean operators such as AND or OR
Explanation
Boolean conditions can be combined to construct more specific filters, such as requiring both conditions or either condition.
- A
- 68
Why are NumPy arrays useful for linear algebra operations?
- A
They guarantee that every matrix operation is statistically valid
- B
They automatically determine the meaning of every variable
- C
They replace the need for numerical values in calculations
- D
They provide optimized operations for tasks such as matrix products and transposition
Correct answer
DThey provide optimized operations for tasks such as matrix products and transposition
Explanation
NumPy includes efficient operations for linear algebra, including products and matrix transposition.
- A
- 69
What is the main distinction between a pandas Series and a pandas DataFrame?
- A
A Series is a visualization; a DataFrame is a database connection
- B
A Series stores only text; a DataFrame stores only numbers
- C
A Series is a one-dimensional indexed sequence; a DataFrame is a two-dimensional table
- D
A Series is unordered; a DataFrame cannot have an index
Correct answer
CA Series is a one-dimensional indexed sequence; a DataFrame is a two-dimensional table
Explanation
Pandas uses Series for one-dimensional indexed data and DataFrames for tabular data with rows and columns.
- A
- 70
What is the relationship between a DataFrame and its columns in pandas?
- A
Columns exist only when the DataFrame is exported to Excel
- B
Each column can be understood as a Series within the DataFrame
- C
A DataFrame is a single Series with no column labels
- D
Each column must be a separate DataFrame with no shared index
Correct answer
BEach column can be understood as a Series within the DataFrame
Explanation
A DataFrame can be viewed as multiple Series, typically one for each column, aligned by an index.
- A
- 71
How does a pandas Series combine properties of a list and a dictionary?
- A
It is ordered like a sequence and can also use meaningful index labels to access values
- B
It is mutable like a list but has no way to retrieve values by labels
- C
It is unordered like a dictionary and can contain only numeric positions
- D
It stores key-value pairs but cannot preserve element order
Correct answer
AIt is ordered like a sequence and can also use meaningful index labels to access values
Explanation
A Series maintains an order while also supporting labels in its index, allowing access by position or label.
- A
- 72
Why can meaningful Series index labels be more convenient than default integer positions?
- A
They eliminate the need for the Series to have an order
- B
They automatically correct invalid values in the Series
- C
They allow values to be accessed using recognizable labels such as country names
- D
They make every Series column accept mixed data types
Correct answer
CThey allow values to be accessed using recognizable labels such as country names
Explanation
Labels such as country names make it possible to retrieve values by meaningful identifiers rather than remembering their positions.
- A
- 73
What is a typical use of a DataFrame info summary?
- A
Converting all data into a single numeric type
- B
Displaying each row as a separate chart
- C
Inspecting columns, data types, and non-null counts
- D
Calculating every correlation and determining causation
Correct answer
CInspecting columns, data types, and non-null counts
Explanation
The info summary gives a quick view of the DataFrame's structure, types, and counts of non-null values.
- A
- 74
What does a DataFrame describe-style summary generally provide?
- A
The SQL statements used to create the DataFrame
- B
A complete list of all text values in every column
- C
A guarantee that numerical distributions are normal
- D
Summary statistics for numeric columns, including measures such as mean and percentiles
Correct answer
DSummary statistics for numeric columns, including measures such as mean and percentiles
Explanation
A describe-style summary reports numeric statistics such as count, mean, standard deviation, minimum, maximum, and selected percentiles.
- A
- 75
Which statement correctly describes pandas label and position selection for DataFrame rows?
- A
loc and iloc both select only by numerical value
- B
loc selects only columns, while iloc selects only missing values
- C
loc selects by labels, while iloc selects by integer positions
- D
loc selects by data type, while iloc selects by column name
Correct answer
Cloc selects by labels, while iloc selects by integer positions
Explanation
The tutorial distinguishes label-based selection with loc from position-based selection with iloc.
- A
- 76
What does selecting a DataFrame column by its name typically return?
- A
A Boolean mask for every row
- B
A second DataFrame containing only the index
- C
A Series containing that column's values
- D
A scalar containing the column's mean
Correct answer
CA Series containing that column's values
Explanation
Selecting a single column from a DataFrame typically returns a Series.
- A
- 77
How does label-based slicing in pandas differ from ordinary Python slicing as described?
- A
A label-slice's ending label is included, unlike the usual Python positional slice endpoint
- B
A label-slice requires the index to contain only strings
- C
A label-slice always excludes both its starting and ending labels
- D
A label-slice can select only a single element
Correct answer
AA label-slice's ending label is included, unlike the usual Python positional slice endpoint
Explanation
The content highlights that pandas label-based slices include the ending label, whereas ordinary Python slices exclude their upper positional bound.
- A
- 78
How does positional slicing with iloc treat its upper bound?
- A
It excludes the upper positional bound, consistent with ordinary Python slicing
- B
It interprets the upper bound as a column name
- C
It includes the upper position in every case
- D
It selects no values unless the bound is negative
Correct answer
AIt excludes the upper positional bound, consistent with ordinary Python slicing
Explanation
Position-based iloc slicing follows Python's usual convention of excluding the upper bound.
- A
- 79
How does Boolean selection filter a DataFrame by a condition on one column?
- A
It creates a Boolean mask for rows and selects the rows marked true
- B
It uses the mask to rename all columns automatically
- C
It returns only the condition column's data type
- D
It changes every value in the condition column to true or false
Correct answer
AIt creates a Boolean mask for rows and selects the rows marked true
Explanation
A condition such as population exceeding a threshold creates a Boolean Series that can select matching DataFrame rows.
- A
- 80
Why can a Series be aligned with a DataFrame during arithmetic?
- A
A Series is automatically converted into a SQL table before arithmetic
- B
Pandas pairs values solely by their order and ignores all labels
- C
Pandas matches labels such as column names or index values when combining them
- D
A DataFrame can perform arithmetic only with scalars
Correct answer
CPandas matches labels such as column names or index values when combining them
Explanation
Pandas aligns data by labels, so a Series can be matched to corresponding DataFrame columns or indices during an operation.
- A
- 81
What is the usual effect of a standard pandas operation such as dropping rows or renaming columns?
- A
It changes only the displayed output, not the returned data
- B
It returns a modified result while leaving the original object unchanged unless reassigned or made in-place
- C
It always alters the original object without returning a result
- D
It permanently deletes the original object and its source file
Correct answer
BIt returns a modified result while leaving the original object unchanged unless reassigned or made in-place
Explanation
Most pandas operations are immutable by default: they return a new object rather than changing the original.
- A
- 82
What happens when a new Series is assigned as a DataFrame column and its index contains only some of the DataFrame's labels?
- A
Pandas aligns by index labels and leaves unmatched rows missing
- B
Pandas repeats the Series values until every row is filled
- C
Pandas rejects the assignment because the lengths differ
- D
Pandas discards the DataFrame's existing index
Correct answer
APandas aligns by index labels and leaves unmatched rows missing
Explanation
Pandas aligns Series values by index labels during column assignment; rows without a matching label receive a missing value.
- A
- 83
How can an analyst create a new DataFrame column from existing columns?
- A
Use a plotting function to convert the chart into a column
- B
Apply a vectorized operation to the source columns and assign the result
- C
Change the DataFrame's index to the name of the formula
- D
Write a separate value manually for every row regardless of size
Correct answer
BApply a vectorized operation to the source columns and assign the result
Explanation
Pandas supports vectorized operations between columns, and the resulting Series can be assigned as a new column.
- A
- 84
What is the first conceptual step in the data-cleaning process described?
- A
Finding missing data
- B
Removing every categorical column
- C
Building a predictive model
- D
Replacing every value with its mean
Correct answer
AFinding missing data
Explanation
The described four-step cleaning discussion begins by identifying missing data.
- A
- 85
Why can missing values require different remedies in different situations?
- A
Every missing value must be replaced by zero
- B
The right response depends on the field, the importance of the missing data, and the use case
- C
Missing values can occur only in numerical columns
- D
Every record with any missing field must always be retained
Correct answer
BThe right response depends on the field, the importance of the missing data, and the use case
Explanation
Missing data may be dropped, filled, or investigated further depending on its significance and the context.
- A
- 86
What does a pandas missing-value test such as isna or isnull produce when applied to a Series?
- A
A new column containing the source values as strings
- B
A cleaned Series with every missing value removed
- C
A Boolean result for each value indicating whether it is missing
- D
A statistical summary of the Series' non-missing values
Correct answer
CA Boolean result for each value indicating whether it is missing
Explanation
Missing-value tests return Boolean indicators that identify which entries are null.
- A
- 87
How can an analyst count missing entries in a Boolean missing-value result?
- A
Sum the Boolean indicators, since true values contribute to the count
- B
Sort the Boolean indicators alphabetically
- C
Multiply the index by the number of columns
- D
Average the original text values in the Series
Correct answer
ASum the Boolean indicators, since true values contribute to the count
Explanation
Boolean true values behave like ones in a sum, so summing a missing-value mask counts missing entries.
- A
- 88
What does dropna generally do to a Series?
- A
Replaces missing entries with the mean
- B
Deletes every non-missing value
- C
Returns a Series with missing entries removed
- D
Changes missing entries into empty strings
Correct answer
CReturns a Series with missing entries removed
Explanation
dropna returns a version of the Series without its missing values; the original is unchanged unless the result is used to update it.
- A
- 89
What is the default behavior of dropna on a DataFrame when applied across rows?
- A
It fills each missing value with the preceding value
- B
It drops only columns containing text
- C
It drops a row only when every value in it is missing
- D
It drops a row if that row has at least one missing value
Correct answer
DIt drops a row if that row has at least one missing value
Explanation
By default, DataFrame dropna removes rows with any missing value; the behavior can be adjusted with parameters.
- A
- 90
What does the forward-fill method do to a missing entry?
- A
Uses a preceding valid value to fill the missing position
- B
Uses the next valid value to fill the missing position
- C
Replaces the entry with a random value
- D
Deletes every row before the missing entry
Correct answer
AUses a preceding valid value to fill the missing position
Explanation
Forward filling propagates the previous valid value forward into subsequent missing positions.
- A
- 91
What is a potential limitation of forward filling at the beginning of a Series?
- A
The Series becomes unordered
- B
Every valid value after the first missing value is deleted
- C
The method converts the entire Series to strings
- D
A leading missing value may remain because there is no earlier value to propagate
Correct answer
DA leading missing value may remain because there is no earlier value to propagate
Explanation
Forward fill needs a preceding valid value; a missing value before any valid entry may therefore remain missing.
- A
- 92
How does backward filling differ from forward filling?
- A
It removes missing values without filling them
- B
It propagates a later valid value backward into earlier missing positions
- C
It fills missing values using only the Series' mean
- D
It propagates earlier valid values forward through the Series
Correct answer
BIt propagates a later valid value backward into earlier missing positions
Explanation
Backward fill uses a subsequent valid value to fill earlier missing positions.
- A
- 93
What is the difference between missing and invalid data?
- A
Missing data is always numeric, while invalid data is always text
- B
Missing data occurs only in databases, while invalid data occurs only in files
- C
Missing data has no value, while invalid data contains a value that violates expected format or rules
- D
Missing and invalid data are identical and require the same treatment
Correct answer
CMissing data has no value, while invalid data contains a value that violates expected format or rules
Explanation
A missing entry is absent, while an invalid entry is present but does not meet expectations, such as text in a numeric price column.
- A
- 94
Why can identifying an implausible but correctly formatted value require domain knowledge?
- A
Statistical methods cannot detect any numerical outliers
- B
Domain knowledge is needed to identify whether a value is a string
- C
A value with the correct type is always plausible
- D
A value can be technically valid yet unreasonable for the subject being measured
Correct answer
DA value can be technically valid yet unreasonable for the subject being measured
Explanation
An age of 170 is a valid integer but is implausible for a human customer; deciding this depends on understanding the domain.
- A
- 95
Why may an analyst need to investigate the source rather than automatically fill a missing value?
- A
Pandas cannot identify missing values in any dataset
- B
The missing data may be important enough that its cause must be resolved with the data provider or team
- C
Source investigations are required for every missing value, regardless of importance
- D
Every missing value proves that the entire dataset is unusable
Correct answer
BThe missing data may be important enough that its cause must be resolved with the data provider or team
Explanation
If the missing value is important, an analyst may need to contact an ETL team or vendor instead of making an unsupported guess.
- A
- 96
What does a DataFrame's duplicated method help identify?
- A
Rows containing missing values only
- B
Columns that contain non-numeric values
- C
Values that fall outside a statistical confidence interval
- D
Rows or values that repeat according to a chosen comparison rule
Correct answer
DRows or values that repeat according to a chosen comparison rule
Explanation
The duplicated method marks repeated entries based on the values and subset being compared.
- A
- 97
Why should an analyst define what counts as a duplicate before removing duplicates?
- A
Duplicate rows are always errors and must all be removed
- B
Pandas cannot compare rows unless every column is numeric
- C
The first occurrence is necessarily the least accurate record
- D
The correct comparison may depend on which fields identify the same real-world entity
Correct answer
DThe correct comparison may depend on which fields identify the same real-world entity
Explanation
Whether records are duplicates depends on the analysis and the fields used to identify an entity; for example, a player in a different position may represent a distinct record.
- A
- 98
What does choosing a subset of columns for duplicate detection accomplish?
- A
It defines which fields must match for records to count as duplicates
- B
It limits the DataFrame to those columns permanently
- C
It changes the order in which rows were collected
- D
It fills missing values in every unselected column
Correct answer
AIt defines which fields must match for records to count as duplicates
Explanation
A duplicate-check subset specifies the columns that determine whether two records should be treated as duplicates.
- A
- 99
Why can plotting distributions help with data cleaning?
- A
Visualizations automatically correct invalid source records
- B
A plot guarantees that every unusual value is erroneous
- C
Visual patterns and outliers can reveal values that deserve further inspection
- D
A chart replaces the need to know the data's domain
Correct answer
CVisual patterns and outliers can reveal values that deserve further inspection
Explanation
Plots such as histograms and box plots can expose unusual distributions or outliers, but judging whether they are invalid still requires context.
- A
- 100
What is the usual purpose of pandas' specialized string accessor on a text column?
- A
To connect each string to a database table
- B
To calculate matrix products on each text value
- C
To change every string column into a date column
- D
To apply string operations such as splitting, searching, or replacing across values
Correct answer
DTo apply string operations such as splitting, searching, or replacing across values
Explanation
The string accessor provides vectorized text operations, including splitting, containment checks, and replacement.
- A
- 101
What is the purpose of the expand option when splitting strings in pandas?
- A
It removes the original index and all labels
- B
It places the split components into separate columns
- C
It combines all split components back into one string
- D
It converts each component into a plotted point
Correct answer
BIt places the split components into separate columns
Explanation
With expansion enabled, split components are returned in separate columns, typically as a DataFrame.
- A
- 102
What is the difference between Matplotlib's global-style and object-oriented approaches?
- A
The global approach uses SQL; the object-oriented approach uses Python
- B
The global approach modifies a current plot through module-level calls; the object-oriented approach acts on explicit figure and axes objects
- C
The global approach works only with pandas; the object-oriented approach works only with NumPy
- D
The global approach creates interactive charts; the object-oriented approach creates only text
Correct answer
BThe global approach modifies a current plot through module-level calls; the object-oriented approach acts on explicit figure and axes objects
Explanation
The global API relies on the currently active plotting state, while the object-oriented API keeps explicit references to figures and axes.
- A
- 103
Why can the object-oriented Matplotlib API be easier to manage for multiple subplots?
- A
Each axes object explicitly identifies the plot being modified
- B
It prevents a figure from containing more than one plot
- C
It stores subplot contents in the dataframe index
- D
It automatically removes the need to specify data
Correct answer
AEach axes object explicitly identifies the plot being modified
Explanation
Explicit axes references make it clearer which subplot receives each plot or formatting command.
- A
- 104
What is a key difference between a static Matplotlib chart and an interactive charting tool such as Bokeh?
- A
An interactive chart can support actions such as zooming and panning during exploration
- B
An interactive chart cannot display numerical data
- C
A static chart always contains more records than an interactive chart
- D
A static chart can only be created from a database
Correct answer
AAn interactive chart can support actions such as zooming and panning during exploration
Explanation
The content contrasts static images with interactive charts that allow users to zoom, pan, and inspect data dynamically.
- A
- 105
When might a static chart be preferable to an interactive one?
- A
When preparing a fixed report or export such as a PDF
- B
When the chart must respond dynamically to user input
- C
When the chart needs to replace the underlying dataset
- D
When the analyst needs to zoom into points during exploration
Correct answer
AWhen preparing a fixed report or export such as a PDF
Explanation
Static images are often more suitable for fixed reports or exports, while interactive charts are useful for exploration.
- A
- 106
What can a scatter plot help an analyst examine?
- A
The relationship or possible association between two numerical variables
- B
The exact cause of one variable changing another
- C
Which rows contain duplicate identifiers
- D
Whether a file has a header row
Correct answer
AThe relationship or possible association between two numerical variables
Explanation
A scatter plot displays paired numerical values and can help reveal a relationship, though it does not by itself establish causation.
- A
- 107
What does a correlation matrix summarize?
- A
Pairwise correlations among numerical variables
- B
The number of missing values in every text field
- C
The order in which columns were imported
- D
The exact causal effects between all variables
Correct answer
APairwise correlations among numerical variables
Explanation
A correlation matrix summarizes pairwise associations among variables; the content cautions that correlation patterns are a starting point for investigation.
- A
- 108
In a correlation matrix, what does a variable's correlation with itself typically indicate?
- A
A missing value
- B
A negative correlation
- C
A correlation of one
- D
A correlation of zero
Correct answer
CA correlation of one
Explanation
The diagonal of a correlation matrix represents each variable's correlation with itself, which is one.
- A
- 109
What information does a box plot commonly show about a numerical distribution?
- A
Only the maximum and minimum values
- B
The exact causal relationship with another variable
- C
The names and data types of every column
- D
The median, quartiles, spread, and potential outliers
Correct answer
DThe median, quartiles, spread, and potential outliers
Explanation
A box plot summarizes a distribution using the median, quartiles, whiskers, and points that may be outliers.
- A
- 110
What is the purpose of a histogram?
- A
To show the exact value of every record without grouping
- B
To compare text strings by character count only
- C
To show how numerical observations are distributed across bins
- D
To display the order of rows in a database query
Correct answer
CTo show how numerical observations are distributed across bins
Explanation
A histogram groups numerical values into bins to show the distribution of the data.
- A
- 111
What does a kernel density estimate plot provide relative to a histogram?
- A
A categorical count with no numerical scale
- B
A guarantee that the data follows a normal distribution
- C
A list of each observation's database key
- D
A smoothed representation of the distribution
Correct answer
DA smoothed representation of the distribution
Explanation
A density plot provides a smooth view of a distribution rather than showing only counts in discrete histogram bins.
- A
- 112
What can a bubble scatter plot encode beyond the horizontal and vertical positions?
- A
Missing values through the plot title alone
- B
Additional variables through bubble size and color
- C
Only the row number and column name
- D
The original file format and its delimiter
Correct answer
BAdditional variables through bubble size and color
Explanation
A bubble plot can encode extra dimensions through marker size and color in addition to x and y positions.
- A
- 113
What is a key point about reading CSV data directly with pandas?
- A
Pandas can read CSV files only when they use commas as separators
- B
A read function can parse a local file or a remote file location into a DataFrame
- C
Reading a CSV automatically verifies the correctness of every value
- D
CSV data must first be typed into a spreadsheet by hand
Correct answer
BA read function can parse a local file or a remote file location into a DataFrame
Explanation
Pandas can read CSV data from local or remote sources, while parsing options handle details such as headers and separators.
- A
- 114
Why might a CSV reader need parameters beyond the file path?
- A
Files differ in headers, separators, missing-value markers, types, and date formats
- B
Every CSV uses the same structure but requires a different chart
- C
The file path alone determines the meaning of every column
- D
Parameters are needed only to choose a color palette
Correct answer
AFiles differ in headers, separators, missing-value markers, types, and date formats
Explanation
CSV files vary in structure, so options may be needed to specify headers, delimiters, names, missing values, types, or date parsing.
- A
- 115
What is the purpose of specifying that a CSV has no header row?
- A
It tells pandas to delete the first row
- B
It makes every column a datetime column
- C
It forces the CSV separator to be a comma
- D
It prevents the first data row from being interpreted as column names
Correct answer
DIt prevents the first data row from being interpreted as column names
Explanation
If a file has no header, the reader should be told not to infer column names from its first row.
- A
- 116
How can pandas read data from a SQL database into a DataFrame?
- A
Convert each database row into a Markdown cell
- B
Execute a SQL query using a database connection and pass the results to a pandas SQL reader
- C
Rename the database file with a CSV extension and open it as text
- D
Plot the database table and infer its values from the image
Correct answer
BExecute a SQL query using a database connection and pass the results to a pandas SQL reader
Explanation
A SQL-reading function accepts a query and a connection, then returns the query results as a DataFrame.
- A
- 117
What is the practical difference between reading a SQL query and reading an entire SQL table?
- A
A query always writes data; a table reader always deletes data
- B
A query allows custom selection; a table reader can load a named table directly
- C
A query reads only column names; a table reader reads only row values
- D
A query requires no connection; a table reader cannot use one
Correct answer
BA query allows custom selection; a table reader can load a named table directly
Explanation
A query-based read executes supplied SQL, while a table-based read can load a named table directly, subject to the required database tooling.
- A
- 118
When writing a DataFrame to a SQL table, why should an analyst choose the existing-table behavior carefully?
- A
The operation may fail, replace existing data, or append rows depending on the chosen setting
- B
The setting automatically validates every database value
- C
The behavior determines whether a DataFrame can contain columns
- D
The behavior changes the DataFrame into a visualization
Correct answer
AThe operation may fail, replace existing data, or append rows depending on the chosen setting
Explanation
The write operation can be configured to fail, replace a table, or append data, so the setting affects existing database contents.
- A
- 119
What does pandas' HTML-reading function attempt to extract from a web page?
- A
Every image and animation as a numerical array
- B
Database connections embedded in the page
- C
Only the page's title and URL
- D
Tables that it can parse into DataFrames
Correct answer
DTables that it can parse into DataFrames
Explanation
The HTML reader searches a page for tables and can convert them into DataFrames.
- A
- 120
Why can HTML table extraction still require cleaning?
- A
HTML pages never contain tabular data
- B
Web tables are often formatted for people and may use merged cells or repeated headers
- C
Pandas treats every HTML table as a SQL query
- D
A parsed table is guaranteed to contain only numerical data
Correct answer
BWeb tables are often formatted for people and may use merged cells or repeated headers
Explanation
HTML layouts designed for human readers may include spans, repeated headers, and other structures that need extra cleaning after parsing.
- A
- 121
How does reading an Excel workbook differ from reading a single worksheet?
- A
A DataFrame created from Excel automatically combines every sheet
- B
Excel sheets must be imported as images rather than tables
- C
A workbook can contain multiple sheets, while each imported DataFrame represents a sheet's tabular data
- D
A worksheet can contain multiple workbooks, while a workbook contains one row
Correct answer
CA workbook can contain multiple sheets, while each imported DataFrame represents a sheet's tabular data
Explanation
An Excel file may contain several sheets; the reader can select a sheet, and a DataFrame represents the selected tabular content.
- A
- 122
What general relationship exists between pandas' read and write methods for common formats?
- A
Every read method permanently changes the original source
- B
Write methods are available only for SQL and not for files
- C
A read method exports data, while a to-format method imports it
- D
A format often has a read method for importing and a corresponding to-format method for exporting
Correct answer
DA format often has a read method for importing and a corresponding to-format method for exporting
Explanation
Pandas commonly pairs import methods such as read_csv with export methods such as to_csv, with corresponding options for output behavior.
- A
- 123
What language feature makes Python code blocks visually distinct without braces?
- A
Type annotations
- B
Semicolons
- C
Column labels
- D
Indentation
Correct answer
DIndentation
Explanation
Python uses indentation to define code blocks, including the bodies of functions and conditional statements.
- A
- 124
Which Python version does the content recommend for current use?
- A
Python 2, because Python 3 is only for notebooks
- B
Either version, because both receive equal ongoing support
- C
Neither version, because pandas requires a separate language
- D
Python 3, because Python 2 was deprecated
Correct answer
DPython 3, because Python 2 was deprecated
Explanation
The tutorial states that Python 2 was deprecated and recommends using Python 3.
- A
- 125
Which description best characterizes Python as presented in the content?
- A
A database query language used only for tables
- B
A high-level, interpreted, general-purpose language with multiple programming styles
- C
A markup language that cannot define functions
- D
A low-level compiled language limited to numerical calculations
Correct answer
BA high-level, interpreted, general-purpose language with multiple programming styles
Explanation
Python is described as high-level, interpreted, and general-purpose, supporting object-oriented, functional, and imperative programming features.
- A
- 126
How does Python typically handle a variable's type?
- A
Variables have no types, so incompatible operations always succeed
- B
A variable's type is determined only by its name
- C
The variable can be assigned without a separate declaration, while values still have enforced types
- D
Every variable must be declared with a fixed type before assignment
Correct answer
CThe variable can be assigned without a separate declaration, while values still have enforced types
Explanation
Python is dynamically typed, so a separate type declaration is not required, but types still matter and incompatible operations can raise errors.
- A
- 127
What is the role of None in Python?
- A
It represents the absence of a value
- B
It marks the end of every function
- C
It represents the integer zero in every calculation
- D
It converts a value into a string
Correct answer
AIt represents the absence of a value
Explanation
None is Python's special object used to represent the absence of a value.
- A
- 128
What happens when a Python function reaches its end without an explicit return statement?
- A
It returns the last variable created
- B
It returns zero
- C
It returns None
- D
It raises an error in every case
Correct answer
CIt returns None
Explanation
A function without an explicit return value implicitly returns None.
- A
- 129
Which collection is the usual choice for an ordered, changeable sequence in Python?
- A
A list
- B
A dictionary key view
- C
A tuple
- D
A set
Correct answer
AA list
Explanation
Lists are ordered, mutable sequences that can contain multiple values.
- A
- 130
What is the defining difference between a tuple and a list?
- A
A tuple accepts only numbers, while a list accepts only text
- B
A tuple stores keys and values, while a list stores only keys
- C
A tuple is immutable after creation, while a list can be changed
- D
A tuple is unordered, while a list is always sorted
Correct answer
CA tuple is immutable after creation, while a list can be changed
Explanation
Tuples are immutable sequences; lists can be modified after they are created.
- A
- 131
Why is a dictionary useful for storing information about an entity such as a customer?
- A
It guarantees that every value is numerically sorted
- B
It associates meaningful keys such as email or age with their values
- C
It stores only values with no relationships between them
- D
It prevents fields from being accessed by name
Correct answer
BIt associates meaningful keys such as email or age with their values
Explanation
Dictionaries map keys to values, making fields accessible by meaningful names rather than remembered sequence positions.
- A
- 132
What is a set particularly useful for?
- A
Mapping column names to data types
- B
Preserving duplicate values in a fixed order
- C
Storing unique values and testing membership efficiently
- D
Replacing every sequence with a sorted list
Correct answer
CStoring unique values and testing membership efficiently
Explanation
Sets contain unique elements and are especially useful for efficient membership checks.
- A
- 133
What is the typical Python way to loop through items in a collection?
- A
Use a while loop with manually updated positions in every case
- B
Use a for loop to iterate over the collection's elements
- C
Use a switch statement to select each element
- D
Use a function declaration for every element
Correct answer
BUse a for loop to iterate over the collection's elements
Explanation
Python commonly uses for-each style iteration, such as iterating directly over a list or dictionary.
- A
- 134
Why might a while loop be less suitable than a for loop when iterating over a known collection?
- A
A for loop cannot visit collection elements
- B
A while loop cannot execute Python code
- C
A while loop always changes the collection's values
- D
A while loop requires managing its stopping condition and can accidentally run forever
Correct answer
DA while loop requires managing its stopping condition and can accidentally run forever
Explanation
The tutorial favors for loops when iterating over collections and notes that incorrect while-loop conditions can cause infinite loops.
- A
- 135
What is the purpose of importing a Python module?
- A
To convert a Python file into a database table
- B
To automatically execute every function in the language
- C
To make its reusable functions or other contents available to the program
- D
To prevent other code from using its contents
Correct answer
CTo make its reusable functions or other contents available to the program
Explanation
Modules provide reusable functionality that a program can access by importing them.
- A
- 136
How can a Python program handle an operation that may fail without immediately terminating?
- A
Use a set to store the operation's result
- B
Place the operation inside a tuple
- C
Use a try-and-except structure to catch an exception
- D
Convert the exception into a comment
Correct answer
CUse a try-and-except structure to catch an exception
Explanation
A try-and-except block allows a program to catch and handle exceptions raised by operations that fail.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.