1. Home
  2. Explore
  3. Computer Science
  4. Data Analysis with Python

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Data Analysis with Python

  • 136Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Data Analysis Concepts

Which sequence best captures the core activities involved in data analysis?

136 questions

  1. 1

    Which sequence best captures the core activities involved in data analysis?

    1. A

      Sampling, labeling, publishing, and licensing data for public access

    2. B

      Designing, compiling, deploying, and maintaining software for data systems

    3. C

      Collecting, encrypting, compressing, and archiving data for long-term storage

    4. D

      Inspecting, cleansing, transforming, and modeling data to find useful information

    Correct answer
    D

    Inspecting, 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.

  2. 2

    Why is turning data into information a central objective of analysis?

    1. A

      Raw records become useful when they support meaningful conclusions or decisions

    2. B

      Raw records become conclusions once every value has been visualized

    3. C

      Raw records become information whenever they are sorted alphabetically

    4. D

      Raw records become more valuable when they are stored in additional formats

    Correct answer
    A

    Raw 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.

  3. 3

    A retailer has a year of purchase records. Which result is an example of information rather than raw data?

    1. A

      A list of every purchase recorded during the year

    2. B

      A finding that a particular product sells better on Tuesdays

    3. C

      A database containing customer and product identifiers

    4. D

      A table containing the time and price of each transaction

    Correct answer
    B

    A 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.

  4. 4

    Why might different departments need different reports from the same analysis?

    1. A

      They may need different views or levels of detail to use the findings

    2. B

      Each department needs a different dataset because analysis changes the facts

    3. C

      Reports for different departments cannot share underlying information

    4. D

      Each department must calculate its own unrelated version of the data

    Correct answer
    A

    They 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.

  5. 5

    What is the primary role of data modeling in the analysis process described?

    1. A

      Converting every text field into a numerical field before visualization

    2. B

      Arranging records alphabetically so that conclusions are easier to publish

    3. C

      Representing real-life situations in information systems and looking for patterns

    4. D

      Replacing source data with simulated records to simplify reporting

    Correct answer
    C

    Representing 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.

  6. 6

    Which pairing correctly matches common tools with their purposes in the tutorial's data-analysis stack?

    1. A

      Matplotlib for database connections; Seaborn for file-system management

    2. B

      NumPy for report writing; Matplotlib for data collection

    3. C

      Pandas for data analysis; Matplotlib and Seaborn for visualization

    4. D

      Seaborn for SQL queries; pandas for operating-system commands

    Correct answer
    C

    Pandas for data analysis; Matplotlib and Seaborn for visualization

    Explanation

    Pandas is used for data analysis, while Matplotlib and Seaborn are used to create visualizations.

  7. 7

    Why is statistical analysis useful after data has been cleaned and reshaped?

    1. A

      It converts every analysis into a machine-learning project

    2. B

      It helps reveal trends, patterns, and anomalies in prepared data

    3. C

      It guarantees that all collected values are accurate and complete

    4. D

      It removes the need to communicate findings to other users

    Correct answer
    B

    It 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.

  8. 8

    What should an analyst generally do after identifying meaningful findings?

    1. A

      Replace the original dataset with a chart and discard the analysis

    2. B

      Keep the findings within the analysis tool so the underlying data stays private

    3. C

      Provide evidence, communicate results in reports or dashboards, and support decisions

    4. D

      Avoid presenting conclusions until every possible model has been tested

    Correct answer
    C

    Provide 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.

  9. 9

    What does inferential statistics contribute to modeling data?

    1. A

      It assigns column names to files before they can be imported

    2. B

      It ensures that a dataset contains no invalid or missing values

    3. C

      It turns categorical variables into visual charts automatically

    4. D

      It helps assess whether patterns or models arise from observed data

    Correct answer
    D

    It 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.

  10. 10

    Which example best illustrates an anomaly-focused analysis?

    1. A

      Sorting customer records by name before importing them

    2. B

      Listing every column name in the dataset without examining its values

    3. C

      Investigating unusually negative profits or unexpectedly large values

    4. D

      Changing all numeric values into strings to prevent calculation errors

    Correct answer
    C

    Investigating 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.

  11. 11

    Why is evidence important when communicating analytical conclusions?

    1. A

      Evidence guarantees that every audience will need the same report

    2. B

      Evidence lets users assess the basis for the findings and decisions

    3. C

      Evidence makes it unnecessary to explain what the analysis means

    4. D

      Evidence allows analysts to omit data preparation from their work

    Correct answer
    B

    Evidence 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.

  12. 12

    Which statement best distinguishes data analysis from data science as described?

    1. A

      Data scientists typically emphasize programming, mathematics, and machine learning; analysts often emphasize communication and reporting

    2. B

      Data analysts require more advanced mathematics, while data scientists focus mainly on storytelling

    3. C

      Data science excludes data preparation, while data analysis includes only machine learning

    4. D

      Data scientists work only with visual tools; analysts work only with programming languages

    Correct answer
    A

    Data 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.

  13. 13

    What is the main advantage of managed, closed products such as Excel or Tableau?

    1. A

      They are generally easier to learn and come with vendor documentation and support

    2. B

      They can connect to every possible source without limits

    3. C

      They allow unrestricted customization of every part of their implementation

    4. D

      They eliminate the need to understand the data being analyzed

    Correct answer
    A

    They 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.

  14. 14

    What is a key limitation of a closed analysis tool?

    1. A

      It cannot produce visualizations or readable reports

    2. B

      It requires users to write every operation in a programming language

    3. C

      Its scope can be limited to the capabilities provided by the product

    4. D

      It cannot be supported by a company or vendor

    Correct answer
    C

    Its 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.

  15. 15

    What best describes the category called open or programming tools in the tutorial?

    1. A

      A group of database servers that cannot connect to external libraries

    2. B

      A set of vendor products that share a single subscription and interface

    3. C

      A combination of programming languages, open-source libraries, and related products

    4. D

      A collection of spreadsheet templates that do not use code

    Correct answer
    C

    A 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.

  16. 16

    Why can programming languages offer greater flexibility than a single closed product?

    1. A

      Programming languages avoid the need to learn any technical concepts

    2. B

      Programming languages restrict users to a fixed set of vendor-approved workflows

    3. C

      Libraries and code can address specialized sources and tasks beyond one product's built-in scope

    4. D

      Libraries prevent data from being combined across sources

    Correct answer
    C

    Libraries 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.

  17. 17

    How can programming skills provide career flexibility for a data analyst?

    1. A

      They limit the analyst to the software used in their first job

    2. B

      They teach transferable data-processing abilities that are not tied to one product

    3. C

      They remove the need to learn new tools throughout a career

    4. D

      They guarantee that a particular analysis product will remain in business

    Correct answer
    B

    They 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.

  18. 18

    What is the principal disadvantage of adopting a programming language for analysis?

    1. A

      It offers less flexibility than a packaged analysis product

    2. B

      It cannot process data from files or databases

    3. C

      It takes time to learn coding fundamentals before using it effectively

    4. D

      It requires every analysis to be performed by hand

    Correct answer
    C

    It 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.

  19. 19

    Which reason for choosing Python is explicitly supported by the content?

    1. A

      It is designed exclusively for statistical research and nothing else

    2. B

      It is a closed product with one vendor controlling all its libraries

    3. C

      It is described as intuitive to learn and has libraries for many kinds of tasks

    4. D

      It avoids the use of community-created tools

    Correct answer
    C

    It 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.

  20. 20

    What does Python being free and open source mean in the context of the tutorial?

    1. A

      Python programs can only be shared after purchasing a license

    2. B

      People can use it and inspect its internals and libraries rather than relying on a single proprietary vendor

    3. C

      Python users never need documentation or community support

    4. D

      Every Python library is automatically maintained by the same company

    Correct answer
    B

    People 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.

  21. 21

    Why does widespread institutional use contribute to confidence in Python's future?

    1. A

      Organizations guarantee that Python will replace every other language

    2. B

      Institutional use means Python's source code can no longer be changed

    3. C

      Widespread use removes the need for an active developer community

    4. D

      Its use by major organizations makes it less likely to disappear unexpectedly

    Correct answer
    D

    Its 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.

  22. 22

    How does the tutorial compare Python and R?

    1. A

      Python and R are described as identical in their libraries and learning curve

    2. B

      R is described as lacking statistical functions, while Python has no data libraries

    3. C

      Python is presented as limited to statistics, while R is more general-purpose

    4. D

      Python is presented as easier to start with and more general, while R is noted for statistical libraries

    Correct answer
    D

    Python 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.

  23. 23

    Which sequence most closely represents a typical data-analysis workflow?

    1. A

      Model data, publish it, collect it, then decide whether it needs cleaning

    2. B

      Collect data, clean it, reshape it, analyze it, then communicate or act on results

    3. C

      Clean data, report it, collect it, then combine it with unrelated sources

    4. D

      Visualize data, discard raw records, collect new data, then define a question

    Correct answer
    B

    Collect 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.

  24. 24

    Why might data cleaning be more tedious for scraped data than for data from an organization's own database?

    1. A

      Scraped sources are more likely to require substantial correction and preparation

    2. B

      Scraped data cannot be analyzed with statistical tools

    3. C

      A database cannot contain missing values or invalid entries

    4. D

      Data from a database must always be converted into images first

    Correct answer
    A

    Scraped 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.

  25. 25

    What is the purpose of reshaping data after it has been cleaned?

    1. A

      To replace all observations with summary statistics

    2. B

      To organize fields and combine sources into a form suitable for analysis

    3. C

      To prevent the dataset from being used by statistical methods

    4. D

      To make every row visually inspectable in a spreadsheet

    Correct answer
    B

    To 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.

  26. 26

    A team combines sales data from two systems and creates a calculated field. Which workflow stage is this?

    1. A

      Deploying a machine-learning model

    2. B

      Reshaping or transforming data for subsequent analysis

    3. C

      Collecting the original data from its source

    4. D

      Communicating conclusions to decision makers

    Correct answer
    B

    Reshaping or transforming data for subsequent analysis

    Explanation

    Combining sources and creating or transforming fields are examples of preparing and reshaping data.

  27. 27

    What is the role of analysis after data has been cleaned and put into shape?

    1. A

      Guarantee that every association is causal

    2. B

      Extract patterns and identify trends or anomalies

    3. C

      Convert the dataset into a different file format only

    4. D

      Determine which vendor should own the data

    Correct answer
    B

    Extract patterns and identify trends or anomalies

    Explanation

    Analysis uses prepared data to find patterns, trends, and anomalies, often with statistical methods.

  28. 28

    How might the final step differ between a data-analysis project and a broader data-science project?

    1. A

      Both must end with a database migration rather than an interpretation

    2. B

      Analysis may focus on reports and decisions, while data science may proceed to machine-learning implementation

    3. C

      Analysis always implements machine learning, while data science only creates spreadsheets

    4. D

      Analysis skips communication, while data science consists only of data cleaning

    Correct answer
    B

    Analysis 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.

  29. 29

    Why should the analysis workflow be understood as a cycle rather than a strict straight line?

    1. A

      Each stage permanently prevents any changes to earlier work

    2. B

      Cleaning and analysis cannot occur in the same project

    3. C

      Analysts often return to earlier stages as new questions or problems arise

    4. D

      Data collection can happen only after reporting is complete

    Correct answer
    C

    Analysts 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.

  30. 30

    What does checking a dataset's shape immediately after loading help an analyst understand?

    1. A

      Whether every value in the dataset is factually correct

    2. B

      Whether all plotted relationships are causal

    3. C

      How many rows and columns the dataset contains

    4. D

      Which statistical model will explain the data

    Correct answer
    C

    How 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.

  31. 31

    What does a dataframe's info-style summary add to a simple row-and-column count?

    1. A

      A chart of every record in the dataset

    2. B

      Column names, data types, and counts of non-missing values

    3. C

      A list of causal relationships between all variables

    4. D

      A guarantee that every column has the correct meaning

    Correct answer
    B

    Column 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.

  32. 32

    When an analyst calculates a new total cost as quantity multiplied by unit cost, what kind of operation is being performed?

    1. A

      Deriving a new field from existing columns

    2. B

      Removing missing rows from the original data

    3. C

      Importing a new table from a database

    4. D

      Creating a visualization from a categorical variable

    Correct answer
    A

    Deriving a new field from existing columns

    Explanation

    A calculated field such as total cost is derived by combining existing columns with a formula.

  33. 33

    Why might an analyst compare a calculated cost column with the dataset's supplied cost column?

    1. A

      To replace all source data with a visualization

    2. B

      To determine whether the two columns have different names

    3. C

      To prove that unit cost has no relationship to profit

    4. D

      To detect inconsistencies that could indicate source-system or data-entry errors

    Correct answer
    D

    To 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.

  34. 34

    What can a filter accomplish during data analysis?

    1. A

      It automatically removes the need to understand the data domain

    2. B

      It changes every record to satisfy the condition being tested

    3. C

      It isolates records meeting conditions so the analyst can examine a subset

    4. D

      It proves that a selected subset represents the whole population

    Correct answer
    C

    It 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.

  35. 35

    What is Jupyter described as in the tutorial?

    1. A

      A proprietary spreadsheet application made for one database

    2. B

      A free, open-source ecosystem that includes notebook and lab tools

    3. C

      A Python data type used to store columns

    4. D

      A visualization library that only produces static charts

    Correct answer
    B

    A 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.

  36. 36

    What is the main difference between Jupyter Notebook and JupyterLab described in the content?

    1. A

      JupyterLab is a programming language, while Notebook is a data structure

    2. B

      Notebook can run Python, while JupyterLab can only display Markdown

    3. C

      Notebook is cloud-only, while JupyterLab must run without a browser

    4. D

      JupyterLab provides an expanded interface with features such as file browsing and terminals

    Correct answer
    D

    JupyterLab 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.

  37. 37

    Why is a Jupyter Notebook useful for exploratory data analysis?

    1. A

      It stores all analysis only as a static image

    2. B

      It automatically inspects every record without user commands

    3. C

      It lets users run commands interactively and see responses immediately

    4. D

      It prevents users from mixing explanations with code

    Correct answer
    C

    It 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.

  38. 38

    What is the basic structural unit of a Jupyter Notebook?

    1. A

      A workbook, which can contain only numerical tables

    2. B

      A query, which must connect to a database

    3. C

      A package, which can contain only imported libraries

    4. D

      A cell, which can contain code or formatted text

    Correct answer
    D

    A cell, which can contain code or formatted text

    Explanation

    A notebook is a sequence of cells; cells can contain executable code or Markdown text.

  39. 39

    What is Markdown used for in a notebook?

    1. A

      Executing Python expressions against a dataframe

    2. B

      Writing formatted explanatory text that renders as a document

    3. C

      Assigning strict data types to dataframe columns

    4. D

      Connecting the notebook to a remote SQL server

    Correct answer
    B

    Writing 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.

  40. 40

    Why can notebooks be useful for sharing analysis results?

    1. A

      They automatically guarantee that recipients can reproduce every result

    2. B

      They can combine code, explanations, and outputs and can be exported as documents

    3. C

      They convert all data into a single uneditable chart

    4. D

      They prevent the analyst from documenting assumptions

    Correct answer
    B

    They 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.

  41. 41

    What does a cell's execution number indicate?

    1. A

      The order in which that cell's code was executed

    2. B

      The number of rows in the notebook's dataframe

    3. C

      The number of errors the cell has produced

    4. D

      The position of the cell in the current visual layout only

    Correct answer
    A

    The 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.

  42. 42

    What is the difference between command mode and edit mode in a notebook?

    1. A

      Command mode applies notebook actions to cells; edit mode changes a cell's contents

    2. B

      Command mode is available only in JupyterLab; edit mode only in Notebook

    3. C

      Command mode selects Markdown; edit mode selects SQL

    4. D

      Command mode runs Python; edit mode is only for viewing output

    Correct answer
    A

    Command 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.

  43. 43

    Which keyboard action switches from editing a cell to command mode?

    1. A

      Pressing Shift and Return

    2. B

      Pressing the M key

    3. C

      Pressing Return

    4. D

      Pressing Escape

    Correct answer
    D

    Pressing Escape

    Explanation

    Escape switches from edit mode to command mode; Return can enter edit mode for the selected cell.

  44. 44

    In command mode, which shortcuts add a cell above or below the selected cell?

    1. A

      B adds above; A adds below

    2. B

      M adds above; Y adds below

    3. C

      A adds above; B adds below

    4. D

      X adds above; V adds below

    Correct answer
    C

    A adds above; B adds below

    Explanation

    The tutorial gives A for adding a cell above and B for adding one below in command mode.

  45. 45

    How can a user change a cell between Markdown and Python code using keyboard shortcuts?

    1. A

      Use Y for Markdown and M for code

    2. B

      Use M for Markdown and Y for code

    3. C

      Use A for Markdown and B for code

    4. D

      Use X for Markdown and V for code

    Correct answer
    B

    Use M for Markdown and Y for code

    Explanation

    The cell-type shortcuts described are M for Markdown and Y for Python code.

  46. 46

    What is the difference between Ctrl+Return and Shift+Return when executing a notebook cell?

    1. A

      Ctrl+Return changes the cell to Markdown; Shift+Return changes it to code

    2. B

      Ctrl+Return advances to the next cell; Shift+Return keeps the current cell selected

    3. C

      Ctrl+Return runs the cell and keeps it selected; Shift+Return runs it and advances

    4. D

      Ctrl+Return deletes the cell; Shift+Return restores the previous cell

    Correct answer
    C

    Ctrl+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.

  47. 47

    Which statement best explains why Jupyter is often more suitable than a terminal for interactive analysis?

    1. A

      It combines immediate execution with cells and rich visual or written output

    2. B

      It prevents analysts from using a Python interpreter

    3. C

      It displays every row of a large dataset continuously

    4. D

      It requires all commands to be entered through menus

    Correct answer
    A

    It 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.

  48. 48

    Why is a continuously visible spreadsheet less useful as datasets grow very large?

    1. A

      Large datasets have no statistical properties

    2. B

      Spreadsheets cannot contain rows or columns

    3. C

      Visual tools cannot filter any records

    4. D

      Humans cannot reliably visually inspect millions of records, and processing can become slow

    Correct answer
    D

    Humans 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.

  49. 49

    What information can analysts use instead of continuously viewing every record?

    1. A

      A mental understanding of data structure plus summaries and statistical properties

    2. B

      The file's name and the date it was downloaded

    3. C

      A chart containing every row at the same time

    4. D

      A list of the programming languages used in the project

    Correct answer
    A

    A 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.

  50. 50

    What is NumPy's primary role in the Python ecosystem described?

    1. A

      Creating formatted notebook documents

    2. B

      Building interactive website interfaces

    3. C

      Efficient numerical computation and array processing

    4. D

      Managing database user accounts

    Correct answer
    C

    Efficient numerical computation and array processing

    Explanation

    NumPy is a numerical-computing library focused on processing numbers and arrays efficiently.

  51. 51

    Why can NumPy be important even if an analyst rarely calls it directly?

    1. A

      NumPy is required only when writing Python syntax

    2. B

      Pandas and Matplotlib are file formats created by NumPy

    3. C

      NumPy automatically replaces all other data-analysis libraries

    4. D

      Libraries such as pandas and Matplotlib rely on NumPy for numerical processing

    Correct answer
    D

    Libraries 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.

  52. 52

    Why can pure Python numerical processing be less efficient for large workloads than NumPy?

    1. A

      NumPy uses optimized low-level numerical operations and compact array representations

    2. B

      Python cannot represent integers or decimal values

    3. C

      Pure Python always uses a graphics processor for arithmetic

    4. D

      NumPy stores each array element as a separate text document

    Correct answer
    A

    NumPy 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.

  53. 53

    What is a key memory-related advantage of choosing an appropriate NumPy integer type?

    1. A

      The analyst can select a bit width suited to the values being stored

    2. B

      The array no longer needs to store its numerical values

    3. C

      Every integer is automatically compressed to one bit

    4. D

      The array can store any mixture of types without extra memory

    Correct answer
    A

    The 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.

  54. 54

    Why might age and net worth columns require different integer widths?

    1. A

      All numeric columns must use the same width regardless of range

    2. B

      Their plausible value ranges differ greatly, so they may need different storage capacities

    3. C

      Net worth has fewer possible values than age

    4. D

      Age is always a string, while net worth is always a Boolean

    Correct answer
    B

    Their 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.

  55. 55

    What is the important structural difference between a NumPy array and a general Python list?

    1. A

      A Python list supports indexing, while a NumPy array does not

    2. B

      A NumPy array permits arbitrary mixed objects but a list does not

    3. C

      A Python list must store all values contiguously, but a NumPy array cannot

    4. D

      A NumPy array stores elements in a uniform, typed structure suited to numerical operations

    Correct answer
    D

    A 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.

  56. 56

    How does indexing a NumPy array generally compare with indexing a Python list?

    1. A

      NumPy requires named keys, while lists require numeric positions

    2. B

      NumPy does not support slicing or negative indices

    3. C

      NumPy uses one-based indexing, while lists use zero-based indexing

    4. D

      Basic zero-based indexing, slicing, negative indices, and steps work similarly

    Correct answer
    D

    Basic 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.

  57. 57

    What does NumPy's multi-index selection allow an analyst to do?

    1. A

      Select only consecutive positions without using slices

    2. B

      Convert a two-dimensional array into a database query

    3. C

      Assign a separate data type to every element of one array

    4. D

      Select several positions at once and receive the selected values as an array

    Correct answer
    D

    Select 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.

  58. 58

    Why should the dimensions of a manually constructed multidimensional NumPy array be consistent?

    1. A

      Dimension consistency is required only for arrays of strings

    2. B

      Mismatched nested sequences may fail to form the intended regular numeric array

    3. C

      Inconsistent dimensions automatically make every value a floating-point number

    4. D

      Every matrix must have exactly three rows and three columns

    Correct answer
    B

    Mismatched 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.

  59. 59

    What does the shape of a two-dimensional NumPy array communicate?

    1. A

      The names of its row and column labels

    2. B

      The values of its mean and standard deviation

    3. C

      Its number of rows and columns

    4. D

      Its total processing time and memory use

    Correct answer
    C

    Its number of rows and columns

    Explanation

    For a matrix, shape describes its dimensions, such as the number of rows and columns.

  60. 60

    How does NumPy's axis argument help when calculating a sum on a matrix?

    1. A

      It determines whether the result is stored as text or a number

    2. B

      It changes the matrix into a one-dimensional list permanently

    3. C

      It specifies whether to aggregate along rows or columns

    4. D

      It chooses which values should be treated as missing

    Correct answer
    C

    It specifies whether to aggregate along rows or columns

    Explanation

    Axis selection lets an operation such as sum return results by row or by column.

  61. 61

    What does a vectorized operation such as adding a scalar to an array do?

    1. A

      Changes the array's shape without changing its values

    2. B

      Adds the scalar only to the first element and discards the rest

    3. C

      Converts the array into a scalar result

    4. D

      Applies the operation to each array element and returns an array of results

    Correct answer
    D

    Applies 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.

  62. 62

    What is broadcasting in the simple array-plus-scalar case?

    1. A

      Converting array values into a plotted image

    2. B

      Applying the scalar operation across every element of the array

    3. C

      Copying the array into a second computer

    4. D

      Changing each element to a different data type

    Correct answer
    B

    Applying 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.

  63. 63

    What happens to an array in a typical NumPy arithmetic operation?

    1. A

      The operation changes only the array's first element

    2. B

      The operation deletes the original array after computing the result

    3. C

      The operation returns a new array, while the original is unchanged unless an in-place form is used

    4. D

      The operation always changes the original array and returns nothing

    Correct answer
    C

    The 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.

  64. 64

    When can an elementwise operation between two arrays generally be performed as expected?

    1. A

      When one array has no elements

    2. B

      When their shapes are compatible for elementwise alignment

    3. C

      When their variable names are identical

    4. D

      When both arrays contain only strings

    Correct answer
    B

    When their shapes are compatible for elementwise alignment

    Explanation

    Elementwise array operations require compatible shapes so corresponding values can be aligned.

  65. 65

    How do Boolean arrays support data filtering in NumPy?

    1. A

      A Boolean mask changes every selected value to true

    2. B

      A Boolean mask sorts the array into ascending order

    3. C

      A Boolean mask stores the names of the array's columns

    4. D

      A Boolean mask selects elements whose corresponding entries are true

    Correct answer
    D

    A 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.

  66. 66

    What is the result of comparing every array element with a condition such as being at least a threshold?

    1. A

      A Boolean array indicating which elements satisfy the condition

    2. B

      A new array containing only the threshold

    3. C

      A single string describing the condition

    4. D

      A permanent modification of every element

    Correct answer
    A

    A 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.

  67. 67

    How can multiple Boolean conditions be combined for NumPy filtering?

    1. A

      Join the conditions into a text string and use it as an array index

    2. B

      Convert the conditions into floating-point numbers first

    3. C

      Apply one condition and permanently delete all remaining values

    4. D

      Combine elementwise conditions with Boolean operators such as AND or OR

    Correct answer
    D

    Combine 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.

  68. 68

    Why are NumPy arrays useful for linear algebra operations?

    1. A

      They guarantee that every matrix operation is statistically valid

    2. B

      They automatically determine the meaning of every variable

    3. C

      They replace the need for numerical values in calculations

    4. D

      They provide optimized operations for tasks such as matrix products and transposition

    Correct answer
    D

    They provide optimized operations for tasks such as matrix products and transposition

    Explanation

    NumPy includes efficient operations for linear algebra, including products and matrix transposition.

  69. 69

    What is the main distinction between a pandas Series and a pandas DataFrame?

    1. A

      A Series is a visualization; a DataFrame is a database connection

    2. B

      A Series stores only text; a DataFrame stores only numbers

    3. C

      A Series is a one-dimensional indexed sequence; a DataFrame is a two-dimensional table

    4. D

      A Series is unordered; a DataFrame cannot have an index

    Correct answer
    C

    A 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.

  70. 70

    What is the relationship between a DataFrame and its columns in pandas?

    1. A

      Columns exist only when the DataFrame is exported to Excel

    2. B

      Each column can be understood as a Series within the DataFrame

    3. C

      A DataFrame is a single Series with no column labels

    4. D

      Each column must be a separate DataFrame with no shared index

    Correct answer
    B

    Each 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.

  71. 71

    How does a pandas Series combine properties of a list and a dictionary?

    1. A

      It is ordered like a sequence and can also use meaningful index labels to access values

    2. B

      It is mutable like a list but has no way to retrieve values by labels

    3. C

      It is unordered like a dictionary and can contain only numeric positions

    4. D

      It stores key-value pairs but cannot preserve element order

    Correct answer
    A

    It 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.

  72. 72

    Why can meaningful Series index labels be more convenient than default integer positions?

    1. A

      They eliminate the need for the Series to have an order

    2. B

      They automatically correct invalid values in the Series

    3. C

      They allow values to be accessed using recognizable labels such as country names

    4. D

      They make every Series column accept mixed data types

    Correct answer
    C

    They 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.

  73. 73

    What is a typical use of a DataFrame info summary?

    1. A

      Converting all data into a single numeric type

    2. B

      Displaying each row as a separate chart

    3. C

      Inspecting columns, data types, and non-null counts

    4. D

      Calculating every correlation and determining causation

    Correct answer
    C

    Inspecting 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.

  74. 74

    What does a DataFrame describe-style summary generally provide?

    1. A

      The SQL statements used to create the DataFrame

    2. B

      A complete list of all text values in every column

    3. C

      A guarantee that numerical distributions are normal

    4. D

      Summary statistics for numeric columns, including measures such as mean and percentiles

    Correct answer
    D

    Summary 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.

  75. 75

    Which statement correctly describes pandas label and position selection for DataFrame rows?

    1. A

      loc and iloc both select only by numerical value

    2. B

      loc selects only columns, while iloc selects only missing values

    3. C

      loc selects by labels, while iloc selects by integer positions

    4. D

      loc selects by data type, while iloc selects by column name

    Correct answer
    C

    loc selects by labels, while iloc selects by integer positions

    Explanation

    The tutorial distinguishes label-based selection with loc from position-based selection with iloc.

  76. 76

    What does selecting a DataFrame column by its name typically return?

    1. A

      A Boolean mask for every row

    2. B

      A second DataFrame containing only the index

    3. C

      A Series containing that column's values

    4. D

      A scalar containing the column's mean

    Correct answer
    C

    A Series containing that column's values

    Explanation

    Selecting a single column from a DataFrame typically returns a Series.

  77. 77

    How does label-based slicing in pandas differ from ordinary Python slicing as described?

    1. A

      A label-slice's ending label is included, unlike the usual Python positional slice endpoint

    2. B

      A label-slice requires the index to contain only strings

    3. C

      A label-slice always excludes both its starting and ending labels

    4. D

      A label-slice can select only a single element

    Correct answer
    A

    A 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.

  78. 78

    How does positional slicing with iloc treat its upper bound?

    1. A

      It excludes the upper positional bound, consistent with ordinary Python slicing

    2. B

      It interprets the upper bound as a column name

    3. C

      It includes the upper position in every case

    4. D

      It selects no values unless the bound is negative

    Correct answer
    A

    It 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.

  79. 79

    How does Boolean selection filter a DataFrame by a condition on one column?

    1. A

      It creates a Boolean mask for rows and selects the rows marked true

    2. B

      It uses the mask to rename all columns automatically

    3. C

      It returns only the condition column's data type

    4. D

      It changes every value in the condition column to true or false

    Correct answer
    A

    It 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.

  80. 80

    Why can a Series be aligned with a DataFrame during arithmetic?

    1. A

      A Series is automatically converted into a SQL table before arithmetic

    2. B

      Pandas pairs values solely by their order and ignores all labels

    3. C

      Pandas matches labels such as column names or index values when combining them

    4. D

      A DataFrame can perform arithmetic only with scalars

    Correct answer
    C

    Pandas 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.

  81. 81

    What is the usual effect of a standard pandas operation such as dropping rows or renaming columns?

    1. A

      It changes only the displayed output, not the returned data

    2. B

      It returns a modified result while leaving the original object unchanged unless reassigned or made in-place

    3. C

      It always alters the original object without returning a result

    4. D

      It permanently deletes the original object and its source file

    Correct answer
    B

    It 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.

  82. 82

    What happens when a new Series is assigned as a DataFrame column and its index contains only some of the DataFrame's labels?

    1. A

      Pandas aligns by index labels and leaves unmatched rows missing

    2. B

      Pandas repeats the Series values until every row is filled

    3. C

      Pandas rejects the assignment because the lengths differ

    4. D

      Pandas discards the DataFrame's existing index

    Correct answer
    A

    Pandas 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.

  83. 83

    How can an analyst create a new DataFrame column from existing columns?

    1. A

      Use a plotting function to convert the chart into a column

    2. B

      Apply a vectorized operation to the source columns and assign the result

    3. C

      Change the DataFrame's index to the name of the formula

    4. D

      Write a separate value manually for every row regardless of size

    Correct answer
    B

    Apply 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.

  84. 84

    What is the first conceptual step in the data-cleaning process described?

    1. A

      Finding missing data

    2. B

      Removing every categorical column

    3. C

      Building a predictive model

    4. D

      Replacing every value with its mean

    Correct answer
    A

    Finding missing data

    Explanation

    The described four-step cleaning discussion begins by identifying missing data.

  85. 85

    Why can missing values require different remedies in different situations?

    1. A

      Every missing value must be replaced by zero

    2. B

      The right response depends on the field, the importance of the missing data, and the use case

    3. C

      Missing values can occur only in numerical columns

    4. D

      Every record with any missing field must always be retained

    Correct answer
    B

    The 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.

  86. 86

    What does a pandas missing-value test such as isna or isnull produce when applied to a Series?

    1. A

      A new column containing the source values as strings

    2. B

      A cleaned Series with every missing value removed

    3. C

      A Boolean result for each value indicating whether it is missing

    4. D

      A statistical summary of the Series' non-missing values

    Correct answer
    C

    A Boolean result for each value indicating whether it is missing

    Explanation

    Missing-value tests return Boolean indicators that identify which entries are null.

  87. 87

    How can an analyst count missing entries in a Boolean missing-value result?

    1. A

      Sum the Boolean indicators, since true values contribute to the count

    2. B

      Sort the Boolean indicators alphabetically

    3. C

      Multiply the index by the number of columns

    4. D

      Average the original text values in the Series

    Correct answer
    A

    Sum 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.

  88. 88

    What does dropna generally do to a Series?

    1. A

      Replaces missing entries with the mean

    2. B

      Deletes every non-missing value

    3. C

      Returns a Series with missing entries removed

    4. D

      Changes missing entries into empty strings

    Correct answer
    C

    Returns 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.

  89. 89

    What is the default behavior of dropna on a DataFrame when applied across rows?

    1. A

      It fills each missing value with the preceding value

    2. B

      It drops only columns containing text

    3. C

      It drops a row only when every value in it is missing

    4. D

      It drops a row if that row has at least one missing value

    Correct answer
    D

    It 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.

  90. 90

    What does the forward-fill method do to a missing entry?

    1. A

      Uses a preceding valid value to fill the missing position

    2. B

      Uses the next valid value to fill the missing position

    3. C

      Replaces the entry with a random value

    4. D

      Deletes every row before the missing entry

    Correct answer
    A

    Uses a preceding valid value to fill the missing position

    Explanation

    Forward filling propagates the previous valid value forward into subsequent missing positions.

  91. 91

    What is a potential limitation of forward filling at the beginning of a Series?

    1. A

      The Series becomes unordered

    2. B

      Every valid value after the first missing value is deleted

    3. C

      The method converts the entire Series to strings

    4. D

      A leading missing value may remain because there is no earlier value to propagate

    Correct answer
    D

    A 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.

  92. 92

    How does backward filling differ from forward filling?

    1. A

      It removes missing values without filling them

    2. B

      It propagates a later valid value backward into earlier missing positions

    3. C

      It fills missing values using only the Series' mean

    4. D

      It propagates earlier valid values forward through the Series

    Correct answer
    B

    It propagates a later valid value backward into earlier missing positions

    Explanation

    Backward fill uses a subsequent valid value to fill earlier missing positions.

  93. 93

    What is the difference between missing and invalid data?

    1. A

      Missing data is always numeric, while invalid data is always text

    2. B

      Missing data occurs only in databases, while invalid data occurs only in files

    3. C

      Missing data has no value, while invalid data contains a value that violates expected format or rules

    4. D

      Missing and invalid data are identical and require the same treatment

    Correct answer
    C

    Missing 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.

  94. 94

    Why can identifying an implausible but correctly formatted value require domain knowledge?

    1. A

      Statistical methods cannot detect any numerical outliers

    2. B

      Domain knowledge is needed to identify whether a value is a string

    3. C

      A value with the correct type is always plausible

    4. D

      A value can be technically valid yet unreasonable for the subject being measured

    Correct answer
    D

    A 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.

  95. 95

    Why may an analyst need to investigate the source rather than automatically fill a missing value?

    1. A

      Pandas cannot identify missing values in any dataset

    2. B

      The missing data may be important enough that its cause must be resolved with the data provider or team

    3. C

      Source investigations are required for every missing value, regardless of importance

    4. D

      Every missing value proves that the entire dataset is unusable

    Correct answer
    B

    The 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.

  96. 96

    What does a DataFrame's duplicated method help identify?

    1. A

      Rows containing missing values only

    2. B

      Columns that contain non-numeric values

    3. C

      Values that fall outside a statistical confidence interval

    4. D

      Rows or values that repeat according to a chosen comparison rule

    Correct answer
    D

    Rows 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.

  97. 97

    Why should an analyst define what counts as a duplicate before removing duplicates?

    1. A

      Duplicate rows are always errors and must all be removed

    2. B

      Pandas cannot compare rows unless every column is numeric

    3. C

      The first occurrence is necessarily the least accurate record

    4. D

      The correct comparison may depend on which fields identify the same real-world entity

    Correct answer
    D

    The 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.

  98. 98

    What does choosing a subset of columns for duplicate detection accomplish?

    1. A

      It defines which fields must match for records to count as duplicates

    2. B

      It limits the DataFrame to those columns permanently

    3. C

      It changes the order in which rows were collected

    4. D

      It fills missing values in every unselected column

    Correct answer
    A

    It 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.

  99. 99

    Why can plotting distributions help with data cleaning?

    1. A

      Visualizations automatically correct invalid source records

    2. B

      A plot guarantees that every unusual value is erroneous

    3. C

      Visual patterns and outliers can reveal values that deserve further inspection

    4. D

      A chart replaces the need to know the data's domain

    Correct answer
    C

    Visual 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.

  100. 100

    What is the usual purpose of pandas' specialized string accessor on a text column?

    1. A

      To connect each string to a database table

    2. B

      To calculate matrix products on each text value

    3. C

      To change every string column into a date column

    4. D

      To apply string operations such as splitting, searching, or replacing across values

    Correct answer
    D

    To 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.

  101. 101

    What is the purpose of the expand option when splitting strings in pandas?

    1. A

      It removes the original index and all labels

    2. B

      It places the split components into separate columns

    3. C

      It combines all split components back into one string

    4. D

      It converts each component into a plotted point

    Correct answer
    B

    It places the split components into separate columns

    Explanation

    With expansion enabled, split components are returned in separate columns, typically as a DataFrame.

  102. 102

    What is the difference between Matplotlib's global-style and object-oriented approaches?

    1. A

      The global approach uses SQL; the object-oriented approach uses Python

    2. B

      The global approach modifies a current plot through module-level calls; the object-oriented approach acts on explicit figure and axes objects

    3. C

      The global approach works only with pandas; the object-oriented approach works only with NumPy

    4. D

      The global approach creates interactive charts; the object-oriented approach creates only text

    Correct answer
    B

    The 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.

  103. 103

    Why can the object-oriented Matplotlib API be easier to manage for multiple subplots?

    1. A

      Each axes object explicitly identifies the plot being modified

    2. B

      It prevents a figure from containing more than one plot

    3. C

      It stores subplot contents in the dataframe index

    4. D

      It automatically removes the need to specify data

    Correct answer
    A

    Each axes object explicitly identifies the plot being modified

    Explanation

    Explicit axes references make it clearer which subplot receives each plot or formatting command.

  104. 104

    What is a key difference between a static Matplotlib chart and an interactive charting tool such as Bokeh?

    1. A

      An interactive chart can support actions such as zooming and panning during exploration

    2. B

      An interactive chart cannot display numerical data

    3. C

      A static chart always contains more records than an interactive chart

    4. D

      A static chart can only be created from a database

    Correct answer
    A

    An 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.

  105. 105

    When might a static chart be preferable to an interactive one?

    1. A

      When preparing a fixed report or export such as a PDF

    2. B

      When the chart must respond dynamically to user input

    3. C

      When the chart needs to replace the underlying dataset

    4. D

      When the analyst needs to zoom into points during exploration

    Correct answer
    A

    When 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.

  106. 106

    What can a scatter plot help an analyst examine?

    1. A

      The relationship or possible association between two numerical variables

    2. B

      The exact cause of one variable changing another

    3. C

      Which rows contain duplicate identifiers

    4. D

      Whether a file has a header row

    Correct answer
    A

    The 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.

  107. 107

    What does a correlation matrix summarize?

    1. A

      Pairwise correlations among numerical variables

    2. B

      The number of missing values in every text field

    3. C

      The order in which columns were imported

    4. D

      The exact causal effects between all variables

    Correct answer
    A

    Pairwise 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.

  108. 108

    In a correlation matrix, what does a variable's correlation with itself typically indicate?

    1. A

      A missing value

    2. B

      A negative correlation

    3. C

      A correlation of one

    4. D

      A correlation of zero

    Correct answer
    C

    A correlation of one

    Explanation

    The diagonal of a correlation matrix represents each variable's correlation with itself, which is one.

  109. 109

    What information does a box plot commonly show about a numerical distribution?

    1. A

      Only the maximum and minimum values

    2. B

      The exact causal relationship with another variable

    3. C

      The names and data types of every column

    4. D

      The median, quartiles, spread, and potential outliers

    Correct answer
    D

    The median, quartiles, spread, and potential outliers

    Explanation

    A box plot summarizes a distribution using the median, quartiles, whiskers, and points that may be outliers.

  110. 110

    What is the purpose of a histogram?

    1. A

      To show the exact value of every record without grouping

    2. B

      To compare text strings by character count only

    3. C

      To show how numerical observations are distributed across bins

    4. D

      To display the order of rows in a database query

    Correct answer
    C

    To show how numerical observations are distributed across bins

    Explanation

    A histogram groups numerical values into bins to show the distribution of the data.

  111. 111

    What does a kernel density estimate plot provide relative to a histogram?

    1. A

      A categorical count with no numerical scale

    2. B

      A guarantee that the data follows a normal distribution

    3. C

      A list of each observation's database key

    4. D

      A smoothed representation of the distribution

    Correct answer
    D

    A 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.

  112. 112

    What can a bubble scatter plot encode beyond the horizontal and vertical positions?

    1. A

      Missing values through the plot title alone

    2. B

      Additional variables through bubble size and color

    3. C

      Only the row number and column name

    4. D

      The original file format and its delimiter

    Correct answer
    B

    Additional 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.

  113. 113

    What is a key point about reading CSV data directly with pandas?

    1. A

      Pandas can read CSV files only when they use commas as separators

    2. B

      A read function can parse a local file or a remote file location into a DataFrame

    3. C

      Reading a CSV automatically verifies the correctness of every value

    4. D

      CSV data must first be typed into a spreadsheet by hand

    Correct answer
    B

    A 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.

  114. 114

    Why might a CSV reader need parameters beyond the file path?

    1. A

      Files differ in headers, separators, missing-value markers, types, and date formats

    2. B

      Every CSV uses the same structure but requires a different chart

    3. C

      The file path alone determines the meaning of every column

    4. D

      Parameters are needed only to choose a color palette

    Correct answer
    A

    Files 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.

  115. 115

    What is the purpose of specifying that a CSV has no header row?

    1. A

      It tells pandas to delete the first row

    2. B

      It makes every column a datetime column

    3. C

      It forces the CSV separator to be a comma

    4. D

      It prevents the first data row from being interpreted as column names

    Correct answer
    D

    It 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.

  116. 116

    How can pandas read data from a SQL database into a DataFrame?

    1. A

      Convert each database row into a Markdown cell

    2. B

      Execute a SQL query using a database connection and pass the results to a pandas SQL reader

    3. C

      Rename the database file with a CSV extension and open it as text

    4. D

      Plot the database table and infer its values from the image

    Correct answer
    B

    Execute 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.

  117. 117

    What is the practical difference between reading a SQL query and reading an entire SQL table?

    1. A

      A query always writes data; a table reader always deletes data

    2. B

      A query allows custom selection; a table reader can load a named table directly

    3. C

      A query reads only column names; a table reader reads only row values

    4. D

      A query requires no connection; a table reader cannot use one

    Correct answer
    B

    A 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.

  118. 118

    When writing a DataFrame to a SQL table, why should an analyst choose the existing-table behavior carefully?

    1. A

      The operation may fail, replace existing data, or append rows depending on the chosen setting

    2. B

      The setting automatically validates every database value

    3. C

      The behavior determines whether a DataFrame can contain columns

    4. D

      The behavior changes the DataFrame into a visualization

    Correct answer
    A

    The 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.

  119. 119

    What does pandas' HTML-reading function attempt to extract from a web page?

    1. A

      Every image and animation as a numerical array

    2. B

      Database connections embedded in the page

    3. C

      Only the page's title and URL

    4. D

      Tables that it can parse into DataFrames

    Correct answer
    D

    Tables that it can parse into DataFrames

    Explanation

    The HTML reader searches a page for tables and can convert them into DataFrames.

  120. 120

    Why can HTML table extraction still require cleaning?

    1. A

      HTML pages never contain tabular data

    2. B

      Web tables are often formatted for people and may use merged cells or repeated headers

    3. C

      Pandas treats every HTML table as a SQL query

    4. D

      A parsed table is guaranteed to contain only numerical data

    Correct answer
    B

    Web 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.

  121. 121

    How does reading an Excel workbook differ from reading a single worksheet?

    1. A

      A DataFrame created from Excel automatically combines every sheet

    2. B

      Excel sheets must be imported as images rather than tables

    3. C

      A workbook can contain multiple sheets, while each imported DataFrame represents a sheet's tabular data

    4. D

      A worksheet can contain multiple workbooks, while a workbook contains one row

    Correct answer
    C

    A 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.

  122. 122

    What general relationship exists between pandas' read and write methods for common formats?

    1. A

      Every read method permanently changes the original source

    2. B

      Write methods are available only for SQL and not for files

    3. C

      A read method exports data, while a to-format method imports it

    4. D

      A format often has a read method for importing and a corresponding to-format method for exporting

    Correct answer
    D

    A 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.

  123. 123

    What language feature makes Python code blocks visually distinct without braces?

    1. A

      Type annotations

    2. B

      Semicolons

    3. C

      Column labels

    4. D

      Indentation

    Correct answer
    D

    Indentation

    Explanation

    Python uses indentation to define code blocks, including the bodies of functions and conditional statements.

  124. 124

    Which Python version does the content recommend for current use?

    1. A

      Python 2, because Python 3 is only for notebooks

    2. B

      Either version, because both receive equal ongoing support

    3. C

      Neither version, because pandas requires a separate language

    4. D

      Python 3, because Python 2 was deprecated

    Correct answer
    D

    Python 3, because Python 2 was deprecated

    Explanation

    The tutorial states that Python 2 was deprecated and recommends using Python 3.

  125. 125

    Which description best characterizes Python as presented in the content?

    1. A

      A database query language used only for tables

    2. B

      A high-level, interpreted, general-purpose language with multiple programming styles

    3. C

      A markup language that cannot define functions

    4. D

      A low-level compiled language limited to numerical calculations

    Correct answer
    B

    A 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.

  126. 126

    How does Python typically handle a variable's type?

    1. A

      Variables have no types, so incompatible operations always succeed

    2. B

      A variable's type is determined only by its name

    3. C

      The variable can be assigned without a separate declaration, while values still have enforced types

    4. D

      Every variable must be declared with a fixed type before assignment

    Correct answer
    C

    The 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.

  127. 127

    What is the role of None in Python?

    1. A

      It represents the absence of a value

    2. B

      It marks the end of every function

    3. C

      It represents the integer zero in every calculation

    4. D

      It converts a value into a string

    Correct answer
    A

    It represents the absence of a value

    Explanation

    None is Python's special object used to represent the absence of a value.

  128. 128

    What happens when a Python function reaches its end without an explicit return statement?

    1. A

      It returns the last variable created

    2. B

      It returns zero

    3. C

      It returns None

    4. D

      It raises an error in every case

    Correct answer
    C

    It returns None

    Explanation

    A function without an explicit return value implicitly returns None.

  129. 129

    Which collection is the usual choice for an ordered, changeable sequence in Python?

    1. A

      A list

    2. B

      A dictionary key view

    3. C

      A tuple

    4. D

      A set

    Correct answer
    A

    A list

    Explanation

    Lists are ordered, mutable sequences that can contain multiple values.

  130. 130

    What is the defining difference between a tuple and a list?

    1. A

      A tuple accepts only numbers, while a list accepts only text

    2. B

      A tuple stores keys and values, while a list stores only keys

    3. C

      A tuple is immutable after creation, while a list can be changed

    4. D

      A tuple is unordered, while a list is always sorted

    Correct answer
    C

    A tuple is immutable after creation, while a list can be changed

    Explanation

    Tuples are immutable sequences; lists can be modified after they are created.

  131. 131

    Why is a dictionary useful for storing information about an entity such as a customer?

    1. A

      It guarantees that every value is numerically sorted

    2. B

      It associates meaningful keys such as email or age with their values

    3. C

      It stores only values with no relationships between them

    4. D

      It prevents fields from being accessed by name

    Correct answer
    B

    It 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.

  132. 132

    What is a set particularly useful for?

    1. A

      Mapping column names to data types

    2. B

      Preserving duplicate values in a fixed order

    3. C

      Storing unique values and testing membership efficiently

    4. D

      Replacing every sequence with a sorted list

    Correct answer
    C

    Storing unique values and testing membership efficiently

    Explanation

    Sets contain unique elements and are especially useful for efficient membership checks.

  133. 133

    What is the typical Python way to loop through items in a collection?

    1. A

      Use a while loop with manually updated positions in every case

    2. B

      Use a for loop to iterate over the collection's elements

    3. C

      Use a switch statement to select each element

    4. D

      Use a function declaration for every element

    Correct answer
    B

    Use 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.

  134. 134

    Why might a while loop be less suitable than a for loop when iterating over a known collection?

    1. A

      A for loop cannot visit collection elements

    2. B

      A while loop cannot execute Python code

    3. C

      A while loop always changes the collection's values

    4. D

      A while loop requires managing its stopping condition and can accidentally run forever

    Correct answer
    D

    A 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.

  135. 135

    What is the purpose of importing a Python module?

    1. A

      To convert a Python file into a database table

    2. B

      To automatically execute every function in the language

    3. C

      To make its reusable functions or other contents available to the program

    4. D

      To prevent other code from using its contents

    Correct answer
    C

    To make its reusable functions or other contents available to the program

    Explanation

    Modules provide reusable functionality that a program can access by importing them.

  136. 136

    How can a Python program handle an operation that may fail without immediately terminating?

    1. A

      Use a set to store the operation's result

    2. B

      Place the operation inside a tuple

    3. C

      Use a try-and-except structure to catch an exception

    4. D

      Convert the exception into a comment

    Correct answer
    C

    Use 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.

Question 1 of 136
Question 1 of 136

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent