CompTIA DataX DY0-001 (V1) Practice Question

You have inherited a helper function named standardize_df() in a production feature-engineering library. The function must (1) subtract the mean and divide by the population standard deviation for every numeric column and (2) leave any column whose standard deviation is exactly zero unchanged to avoid division-by-zero problems. You are charged with adding a single PyTest unit test that delivers the strongest regression-catching power while still following unit-testing best practices (deterministic data, small scope, Arrange-Act-Assert structure, no unnecessary external libraries). Which test design best satisfies these requirements?

  • Generate 10 000 random rows, call standardize_df, and assert only that the output DataFrame has the same shape as the input.

  • Set numpy.random.seed(0) inside the test and simply check that standardize_df executes without raising an exception.

  • Apply scikit-learn's StandardScaler to a different DataFrame and assert that its output equals the output of standardize_df.

  • Construct a small DataFrame with one constant and one varying numeric column, run standardize_df, then assert with pytest.approx that the varying column now has mean 0 and std 1 and that the constant column is identical to the original.

CompTIA DataX DY0-001 (V1)
Operations and Processes
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

SAVE $64
$529.00 $465.00
Bash, the Crucial Exams Chat Bot
AI Bot