Prepstellar

Data Analysis Fundamentals · Practice set 6 of 6

File and Object I/O: 10 practice questions

10 questions · Untimed · Free

10 free Data Analysis Fundamentals practice questions on File and Object I/O, with an explanation for every answer. Untimed. The full mock exam and the timed version are in the app.

Set 6 · File and Object I/O · 10 questions Read the lesson
  1. Question 1 of 10

    Which pair reads and writes CSV data with pandas?

    1. A`read_excel()` and `DataFrame.to_excel()`
    2. B`read_parquet()` and `DataFrame.to_parquet()`
    3. C`read_json()` and `DataFrame.to_json()`
    4. Dpandas `read_csv()` and `DataFrame.to_csv()`
    Show the answer

    CSV uses the top-level text reader and the corresponding DataFrame writer; the other pairs target different formats.

    Next → 1 / 10
  2. Question 2 of 10

    What structure does JSON `orient="records"` produce for a DataFrame?

    1. AA nested array containing values without either labeled axis
    2. BSeparate arrays for columns, index labels, and data
    3. CA list of column-to-value objects without index labels
    4. DA mapping from each column to a mapping of index labels
    Show the answer

    Records orientation models rows as objects and omits the DataFrame index; the distractors describe columns, split, and values orientations.

    Next → 2 / 10
  3. Question 3 of 10

    Which worksheet does `read_excel()` read when `sheet_name` is not supplied?

    1. AEvery sheet in the workbook
    2. BThe first sheet at position zero
    3. CNo sheet until a name is supplied
    4. DThe last sheet in the workbook
    Show the answer

    The default sheet position is zero; all sheets require `None`, while a name is optional.

    Next → 3 / 10
  4. Question 4 of 10

    Which `read_csv()` settings directly restrict parsed columns and request their representations?

    1. A`index_col` for selection and `skiprows` for requested types
    2. B`usecols` for column selection and `dtype` for requested types
    3. C`na_values` for column selection and `encoding` for requested types
    4. D`header` for selection and `quotechar` for requested types
    Show the answer

    Column projection and dtype declaration are separate reader controls; the other arguments govern labels, layout, missing markers, or decoding.

    Next → 4 / 10
  5. Question 5 of 10

    Which JSON orientation keeps `columns`, `index`, and `data` in separate entries?

    1. AThe `split` orientation
    2. BThe `values` orientation
    3. CThe `columns` orientation
    4. DThe `records` orientation
    Show the answer

    Split orientation explicitly separates the two labeled axes from the value matrix.

    Next → 5 / 10
  6. Keep the ones you got wrong

    In the app, every question you miss comes back exactly when you’re about to forget it.

  7. Question 6 of 10

    What does `read_excel(..., sheet_name=["North", 3])` return?

    1. AA dictionary containing the named sheet and sheet at position three
    2. BOnly the first sheet because lists are ignored by `sheet_name`
    3. COne DataFrame formed by vertically appending every workbook sheet
    4. DA list of cell values with all sheet labels removed
    Show the answer

    A list of sheet names or positions requests multiple sheets and returns their DataFrames in a dictionary.

    Next → 6 / 10
  8. Question 7 of 10

    How can a Parquet reader avoid materializing unneeded columns?

    1. APass the required names through `columns`
    2. BPass the required names through `partition_cols`
    3. CPass the required names through `compression`
    4. DPass the required names through `index`
    Show the answer

    The read-side `columns` projection selects the fields to materialize; the neighboring arguments concern index writing, compression, or partitioned output.

    Next → 7 / 10
  9. Question 8 of 10

    A pipe-delimited file has no header, `NA?` is its sole missing marker, and `account_id` must remain text. Only three named columns are needed. Which ingestion design satisfies all constraints?

    1. ASet `sep="|"`, explicit `names`, `header=None`, `usecols`, text dtype for `account_id`, `na_values=["NA?"]`, and `keep_default_na=False`
    2. BUse `read_json(orient="records")` and treat each pipe-delimited line as a JSON object
    3. CSet `header=0`, keep every column, and rely on the default missing-marker set
    4. DUse default `read_csv()` inference, then rename columns and convert all values to floats
    Show the answer

    The reader settings jointly declare delimiter, absent header, projection, identifier type, and the exact missing-marker policy.

    Next → 8 / 10
  10. Question 9 of 10

    A DataFrame must round-trip through JSON while preserving dtypes and the index name, and the reader must reconstruct the same orientation. Which approach is supported?

    1. AWrite `values` and read with the default orientation
    2. BWrite with `orient="columns"` and read with `orient="split"`
    3. CUse `orient="table"` for both the write and the read
    4. DWrite with `orient="records"` and infer the omitted index name later
    Show the answer

    Table orientation carries JSON Table Schema metadata, and matching the non-default orientation lets the reader interpret it correctly.

    Next → 9 / 10
  11. Question 10 of 10

    A DataFrame with a custom index will be shared with a non-pandas consumer that expects exactly the named data columns. The file must use Parquet and the consumer rejects unexpected index fields. What should the writer do?

    1. ACall `to_parquet(..., index=False)` and accept that the custom index will not round-trip
    2. BCall `to_parquet(..., index=True)` so the consumer receives no index column
    3. CRely on each engine's default index behavior and promise an identical schema
    4. DRename the index to a non-string label because Parquet requires such names
    Show the answer

    An explicit false index policy removes the extra serialized field, with the documented tradeoff that the custom index is not recovered.

    Next → 10 / 10
  12. You’ve finished this set

    That’s 10 questions on File and Object I/O. In the app the ones you miss come back exactly when you’re about to forget them.

The whole course, on your phone

Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.