Home / Snowflake SnowPro Advanced: Data Scientist / Mock exam
Snowflake SnowPro Advanced: Data Scientist Exam-style mock test

Snowflake SnowPro Advanced Data Scientist Practice Exams|Practice test

Full explanations Exam format Pass line 70%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at a B2B SaaS company is building a churn model in a Snowpark Python session. She needs to read the RAW_SUBSCRIPTION_EVENTS table into a DataFrame and compute a per-account event count without pulling all rows to the client. Which approach keeps the aggregation pushed down to Snowflake's compute?
✓Call session.table, then group_by('ACCOUNT_ID').agg(count('*')) and collect() only the small aggregated result
Correct. session.table returns a lazy DataFrame and group_by/agg generate SQL that Snowflake executes; only the small aggregated result is materialized by collect().
・Call session.table('RAW_SUBSCRIPTION_EVENTS').to_pandas() first and run a pandas groupby on ACCOUNT_ID locally to count events
Incorrect. to_pandas() pulls every raw row to the client before aggregating, defeating pushdown and risking memory exhaustion on large tables.
・Iterate over the DataFrame rows in a Python for-loop, keeping a dictionary keyed by ACCOUNT_ID and incrementing counters
Incorrect. A Python row-by-row loop forces full client-side iteration, which is the slowest option and does not leverage Snowflake compute at all.
・Export the table to a local CSV with COPY INTO and reload it using pandas.read_csv before grouping rows
Incorrect. Exporting to CSV and reloading with pandas moves all data off the warehouse and adds needless I/O instead of pushing the aggregation down.
Explanation
Snowpark DataFrames are lazy; group_by and agg compile to SQL that runs in the warehouse, so only the compact result returns to the client.
Example2 · ML Modeling, Training, and Cortex ML Functions
A data scientist at a B2B SaaS company that sells team collaboration software needs to project the next 90 days of daily active seats for each enterprise account directly in Snowflake, using only the historical seat-usage table. Which Cortex ML function should be used?
・SNOWFLAKE.ML.ANOMALY_DETECTION, which models seasonal baselines and only flags the unexpected outlier points
Incorrect. ANOMALY_DETECTION flags outliers against an expected baseline; it does not emit a multi-step forward forecast of future values.
✓SNOWFLAKE.ML.FORECASTING, trained on each account's historical seat-usage time series to generate per-account predictions for the upcoming 90-day horizon window
Correct. The FORECASTING function fits a time-series model on historical values (optionally per series) and produces predictions for a specified future horizon.
・SNOWFLAKE.ML.CLASSIFICATION, which assigns each enterprise account to a single projected usage bucket
Incorrect. CLASSIFICATION predicts a categorical label, not continuous future seat counts over a horizon.
・SNOWFLAKE.CORTEX.COMPLETE, prompting a general purpose LLM to describe the recent seat-usage trend
Incorrect. COMPLETE is a general LLM text function and is not a trained forecasting model for numeric time-series projection.
Explanation
Forecasting future numeric values over a horizon from historical time-series data is the exact purpose of SNOWFLAKE.ML.FORECASTING.
Example3 · Model Deployment, UDFs, and Inference
A data scientist at a B2B SaaS company has trained a scikit-learn churn model and pickled it to a stage. They want to score millions of account rows directly inside a Snowflake query with the best throughput. Which deployment approach should they choose?
✓Register a Python vectorized (batch) UDF that loads the pickled model once per partition and scores the account rows as pandas DataFrames
Correct. A vectorized Python UDF loads the pickled model once per partition and processes rows in pandas batches, giving high-throughput in-database inference.
・Call an external REST endpoint from a Snowflake external function once for each individual account row
Incorrect. Per-row external function calls add network latency and overhead, making them a poor fit for scoring millions of rows efficiently.
・Create a SQL scalar UDF that reimplements the model's decision logic with nested CASE expressions
Incorrect. Reimplementing a scikit-learn model in nested CASE logic is error-prone and cannot reproduce the trained estimator's behavior.
・Export all rows to a CSV, score them locally in a notebook, and reload the predictions afterward
Incorrect. Exporting to CSV and scoring outside Snowflake abandons in-database inference and adds data movement and manual steps.
Explanation
Vectorized Python UDFs are the idiomatic way to deploy Python models for high-throughput batch inference inside Snowflake.
Example4 · Data Pipelines, Streams, and Tasks for ML
A data scientist at a healthcare services firm builds a nightly feature pipeline that must process only patient encounters inserted or updated since the previous run on a large RAW_ENCOUNTERS table. Which Snowflake object is designed to track exactly those row-level changes for incremental consumption?
✓A standard stream on RAW_ENCOUNTERS that records every row-level change from DML since its last consumption offset
Correct. A standard stream records row-level CDC metadata (inserts, updates, deletes) since the last offset advance, which is exactly what an incremental feature pipeline needs to consume.
・A materialized view over RAW_ENCOUNTERS that automatically refreshes its stored result
Incorrect. A materialized view maintains a precomputed query result but does not expose consumable per-row change records for incremental downstream processing.
・A stream object simply defined on the parent source table
Incorrect. While a stream is the right category, this answer is too vague and omits that it tracks changes since the last consumption point.
・A transient scratch table fully rebuilt from the complete table history each night
Incorrect. Fully rebuilding from complete history is not incremental and wastes compute; it defeats the purpose of change tracking.
Explanation
Streams provide change data capture, letting a pipeline read only the rows changed since the last offset, which is ideal for incremental feature engineering.
Example5 · Governance, Security, and Performance for ML
A healthcare services firm stores patient feature tables used by its readmission-risk model in a schema that data scientists query directly. Compliance requires that only the ML engineering role can read raw features, while analysts see only a de-identified view. Which Snowflake access-control approach best enforces this separation?
✓Grant SELECT on raw feature tables only to the ML engineering role and analysts only on a masking secure view here
Correct. Granting raw access only to the ML engineering role and exposing analysts to a secure (de-identifying) view enforces least privilege through RBAC objects, not policy alone.
・Give both roles SELECT on the raw tables and tell analysts simply to avoid the identifier columns during work
Incorrect. Relying on a behavioral policy rather than a technical grant leaves identifiers readable, violating least-privilege enforcement.
・Grant schema OWNERSHIP individually to every single data scientist working on the team
Incorrect. Distributing OWNERSHIP broadly removes centralized control and lets individuals over-share, which weakens governance.
・Create one shared login that every analyst and engineer on the team uses together
Incorrect. A shared login destroys per-user attribution and does not restrict column access, so it fails the separation requirement.
Explanation
RBAC enforces separation by granting raw access to one role and a masked secure view to another, achieving least privilege technically rather than by convention.
Example6 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at NorthBay Health is building a Snowpark Python job to prepare a readmission feature from a 400-million-row ENCOUNTERS table. She writes transformations with the Snowpark DataFrame API and wants the row filtering, column derivation, and aggregation to run inside Snowflake rather than pulling data to her laptop. Which statement best describes how the Snowpark DataFrame executes her transformations?
・Snowpark immediately pulls all 400 million rows into the client as a pandas DataFrame and applies the transformations locally before writing the results back
Incorrect. Snowpark does not eagerly download the full table; that would defeat the purpose of server-side execution and overwhelm the client.
✓Snowpark lazily builds a logical plan and pushes the compiled SQL to the warehouse on an action
Correct. Snowpark DataFrame operations are lazy, building a logical plan that is translated to SQL and executed on the warehouse only when an action such as collect, show, or write is invoked.
・Snowpark converts each DataFrame method into a separate temporary table materialized to disk after every single chained operation
Incorrect. Intermediate operations are not materialized to disk after each call; they are composed into a single query plan.
・Snowpark requires the scientist to hand-write all underlying SQL because the DataFrame API only validates syntax and generates nothing
Incorrect. The DataFrame API generates and submits the SQL automatically rather than requiring the user to write it by hand.
Explanation
Snowpark DataFrames use lazy evaluation: transformations accumulate into a logical plan that is compiled to SQL and executed on the warehouse only when an action triggers it, keeping computation server-side.
Example7 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at UrbanThread, a retail apparel brand, is building a Snowpark Python job that reads 400 million order rows and derives a basket-size feature per customer. She wants the join and aggregation to run inside Snowflake rather than pulling rows to the client. Which approach keeps the computation pushed down to the warehouse?
・Call collect() to fetch all rows into a pandas DataFrame on the client, then group and aggregate locally before writing the result back.
Incorrect. Calling collect() materializes all 400 million rows on the client, defeating pushdown and likely exhausting client memory.
✓Chain Snowpark group_by and agg transformations, then call write.save_as_table so the warehouse runs the plan.
Correct. Snowpark DataFrame operations build a lazy plan that is compiled to SQL and executed by the warehouse; write.save_as_table triggers that server-side execution.
・Use a Python UDF that opens a Snowflake connector session inside the function body and issues one SELECT per customer to compute each basket size.
Incorrect. Issuing one SELECT per customer from inside a UDF creates a query storm and runs row-by-row, which is far slower than a single pushed-down aggregation.
・Iterate over a to_local_iterator cursor and accumulate per-customer counts in a Python dictionary on the client side.
Incorrect. to_local_iterator still streams rows to the client and does the counting locally, so the work is not pushed down to the warehouse.
Explanation
Snowpark's value is lazy, pushed-down execution: transformations compile to SQL and run in the warehouse, and only an action like save_as_table or collect triggers it. Keeping aggregation server-side avoids moving hundreds of millions of rows to the client.
Example8 · Data Preparation, Feature Engineering, and Snowpark
UrbanThread's customer table has a LIFETIME_SPEND column where roughly 8% of rows are NULL because those shoppers only browsed and never purchased. The data scientist wants these NULLs treated as genuine zero spend for a propensity model, computed directly in Snowflake. Which expression correctly implements this imputation?
・Drop every row where LIFETIME_SPEND IS NULL using a filter so the model trains only on customers who have at least one recorded purchase transaction.
Incorrect. Dropping the browse-only shoppers removes exactly the non-purchasers the propensity model needs and biases the training set.
✓Apply COALESCE(LIFETIME_SPEND, 0) so that every NULL lifetime spend is substituted with a literal zero while any genuine recorded purchase amount is left completely unchanged for the propensity model.
Correct. COALESCE returns the first non-NULL argument, so COALESCE(LIFETIME_SPEND, 0) yields 0 for every NULL and leaves actual spend untouched.
・Replace the NULLs with the column's overall AVG(LIFETIME_SPEND) so the imputed value reflects the typical spending level of the population.
Incorrect. Mean imputation misrepresents browse-only shoppers as average spenders, contradicting the stated business meaning that they spent zero.
・Use NULLIF(LIFETIME_SPEND, 0) to convert the existing missing entries into a numeric default value for the downstream model.
Incorrect. NULLIF returns NULL when the two arguments are equal; it does not replace existing NULLs and would not impute zero.
Explanation
When NULL has a known business meaning (no purchase), COALESCE to that meaningful constant is correct. Mean imputation or dropping rows would distort the non-purchaser signal, and NULLIF does the opposite of what is needed.
Example9 · Data Preparation, Feature Engineering, and Snowpark
UrbanThread stores a SIZE feature with ordered values XS, S, M, L, XL for a gradient-boosted sizing model. The data scientist wants an encoding that preserves the inherent order of the sizes so the model can exploit the monotonic relationship. Which encoding best fits this categorical feature?
・One-hot encoding that produces a separate binary indicator column for each of the five distinct size labels in the dataset.
Incorrect. One-hot encoding discards the natural order, treating XS and XL as equally distant, which wastes the monotonic structure the model could use.
✓Ordinal encoding that maps the sizes XS through XL onto increasing integers 1 to 5.
Correct. Ordinal encoding maps the ranked categories to increasing integers, preserving the XS-to-XL order that a tree model can split on monotonically.
・Hashing the raw size strings into a fixed number of buckets to compress the feature space for the downstream model.
Incorrect. Hashing destroys ordering and can collide labels, so it is inappropriate for a small, meaningfully ordered feature.
・Frequency encoding that replaces each size with its proportion of training rows.
Incorrect. Frequency encoding reflects prevalence, not rank, so it does not preserve the XS-to-XL ordering the model should exploit.
Explanation
Ordered categoricals like garment sizes should use ordinal encoding so the integer rank mirrors the real order. One-hot, hashing, and frequency encodings all lose that ordinal information.
Example10 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at a retail bank is preparing a transactions table in Snowpark Python to feed a fraud model. She needs to add a derived column that flags transactions above the 95th percentile of amount per account, without pulling data to the client. Which approach correctly keeps the computation pushed down to Snowflake?
・Call df.to_pandas(), compute the per-account percentile with NumPy, flag the rows locally, then write the whole result back using write_pandas
Incorrect. Calling to_pandas pulls the full dataset to the client, defeating pushdown and failing to scale on large transaction tables.
✓Use a Window partitioned by account with percentile_cont, then derive the flag via when/otherwise
Correct. A Window partitioned by account with percentile_cont plus when/otherwise is lazily translated to SQL and executed in Snowflake, so nothing is pulled locally.
・Iterate over each account id, run a separate SQL query per account for its percentile, and collect the flags into a Python list
Incorrect. Looping account by account issues many round-trip queries and collects to Python, which neither scales nor stays pushed down.
・Register a Python UDF that receives one amount value at a time and returns the flag based on a hardcoded global threshold
Incorrect. A scalar UDF with a hardcoded global threshold cannot compute per-account percentiles and ignores the required window logic.
Explanation
Snowpark DataFrame operations such as Window.partition_by combined with percentile_cont and when/otherwise are lazily compiled to SQL and executed server-side, which is the scalable, pushdown-preserving way to engineer per-group percentile features.
Example11 · Data Preparation, Feature Engineering, and Snowpark
In a loan-default dataset, the INCOME column is missing for about 8% of applicants, and the missingness is correlated with self-employment status. A data scientist wants a defensible imputation that preserves predictive signal rather than silently biasing the model. Which preparation step is most appropriate?
・Drop every row that has a null INCOME value before training the model
Incorrect. Dropping all null rows discards 8% of applicants and, because missingness correlates with self-employment, introduces selection bias.
・Replace all null INCOME values with the single global mean income across the dataset
Incorrect. A single global mean ignores the group structure and distorts the self-employed subgroup where missingness concentrates.
✓Impute INCOME using the median within each employment-status group and add a boolean was_imputed indicator column
Correct. Group-wise median imputation respects the employment structure and a was_imputed flag lets the model learn from the missingness pattern itself.
・Fill null INCOME values with zero so the model treats missing income as no income
Incorrect. Filling with zero fabricates a 'no income' value, which is factually wrong and skews scale-sensitive features.
Explanation
When missingness is informative and correlated with a group, group-conditional imputation plus a missing-indicator preserves signal and avoids the bias caused by row deletion or naive global fills.
Example12 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at a manufacturing distributor is building a demand model in a Snowpark Python session. They have a DataFrame of daily shipment lines and need a new column that is the running 7-day total of units shipped per warehouse, computed inside Snowflake without pulling data to the client. Which Snowpark approach should they use?
・Collect the entire DataFrame down to a local pandas object and apply a rolling(7).sum() before writing the computed result back to a Snowflake table
Incorrect. Collecting to pandas moves all data to the client, defeating the requirement to compute inside Snowflake and failing at scale.
✓Apply a sum over a window partitioned by warehouse, ordered by ship date, framed on the six preceding rows
Correct. A window partitioned by warehouse, ordered by ship date, with a frame of the six preceding rows plus the current row produces the 7-day running total pushed down to Snowflake.
・Add a Python UDF that opens a cursor, re-queries the table for every single row, and manually accumulates the last seven days of units
Incorrect. A UDF that re-queries per row is extremely inefficient and does not run as a set-based pushdown transformation.
・Group the DataFrame by warehouse and ship date, then join the grouped result back onto itself seven separate times to accumulate the units
Incorrect. Seven self-joins are convoluted, error-prone across date gaps, and far less efficient than a single window frame.
Explanation
Snowpark window functions (Window.partitionBy().orderBy().rowsBetween()) let you express running aggregations that are compiled to SQL and executed in Snowflake, avoiding client-side data movement.
Example13 · Data Preparation, Feature Engineering, and Snowpark
A distributor's supplier lead-time column has roughly 12% NULLs, and those NULLs occur mostly for new suppliers onboarded in the last quarter. The data scientist wants to preserve the signal that a value was missing while still producing a numeric feature the model can use. What is the most appropriate preparation step?
・Drop every row whose lead time is NULL so the training set keeps only fully observed suppliers
Incorrect. Dropping the NULL rows discards the systematically new-supplier population and biases the model toward established suppliers.
・Replace the NULL lead times with a large sentinel value such as 9999 so they stay distinguishable
Incorrect. A sentinel like 9999 distorts distances and splits for most algorithms and is not a sound numeric treatment.
✓Impute the NULL lead times with the column mean and add a boolean indicator flag column recording that the value was originally missing
Correct. Mean imputation yields a usable numeric value while the missingness-indicator flag retains the information that the value was absent, which is meaningful here.
・Leave the NULL lead times untouched and let the downstream algorithm handle them on its own
Incorrect. Most algorithms cannot silently ignore NULLs, and doing nothing loses the new-supplier signal entirely.
Explanation
When missingness carries signal (missing-not-at-random), pairing imputation with a missing-indicator column keeps the model numerically trainable while preserving the fact that the value was missing.
Example14 · Data Preparation, Feature Engineering, and Snowpark
A data scientist at a telecom operator is building churn features from a 2-billion-row call_detail_records table using Snowpark for Python. They chain several .with_column() and .filter() calls on a DataFrame, then call .show() during development and notice each .show() re-runs the full computation. For the production feature pipeline, which approach correctly reduces repeated recomputation of the same intermediate DataFrame?
・Convert the Snowpark DataFrame to a local pandas DataFrame with .to_pandas() so all subsequent transformations run client-side on the driver
Incorrect. Pulling 2 billion rows to the client with .to_pandas() is not feasible and abandons Snowflake's pushdown compute.
✓Persist the intermediate DataFrame with .cache_result() so later operations read the stored result
Correct. .cache_result() materializes the DataFrame into a temporary table, so downstream operations read the stored result instead of re-executing the lazy query plan.
・Wrap every transformation in a Python loop and call .collect() after each step so results land in local variables
Incorrect. Collecting after each step pulls data to the client repeatedly and does not materialize an intermediate server-side result for reuse.
・Add a .sort() before each action because sorting forces Snowflake to keep the DataFrame in its result cache for reuse
Incorrect. .sort() changes ordering and triggers extra work; it does not control result materialization or caching behavior.
Explanation
Snowpark DataFrames are lazily evaluated, so each action re-runs the plan; .cache_result() materializes an intermediate result into a temporary table to avoid recomputation while keeping compute in Snowflake.
Example15 · Data Preparation, Feature Engineering, and Snowpark
A telecom analytics team finds that the monthly_data_usage_gb column in a subscriber table has roughly 8% NULLs, concentrated among prepaid customers who never activated a data plan. Business context confirms a NULL here means genuinely zero usage, not a missing measurement. Before training a churn model, what is the most appropriate imputation decision for this column?
✓Replace the NULL values with the literal 0, because the business confirms a missing reading here means genuine zero usage for prepaid accounts
Correct. Because the business confirms NULL means genuine zero usage, replacing with the literal 0 encodes the true value rather than guessing a central tendency for these prepaid accounts.
・Impute with the overall column mean so prepaid customers resemble the average subscriber usage profile here
Incorrect. Mean imputation would inflate prepaid data usage above its true zero value and distort the churn signal.
・Drop every row that has a NULL value in this column to guarantee complete usage observations only
Incorrect. Dropping 8% of rows discards the very prepaid segment of interest and biases the training data.
・Impute with the median of monthly_data_usage_gb computed separately within each distinct subscriber plan-type segment
Incorrect. Segmented median imputation still substitutes a nonzero estimate even though the true value is known to be zero.
Explanation
Imputation strategy must follow the domain meaning of missingness; here NULL is confirmed to be true zero, so filling with 0 is correct, whereas statistical imputation would fabricate usage.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)