PDE Preparing and Using Data for Analysis Practice Question
A data engineer needs to split time-series data for training a forecasting model. The data is sorted by timestamp. The engineer wants to avoid leakage where future data influences training. Which data splitting approach should they use?
⚠ Common exam trap
The trap here is that candidates reflexively choose k-fold cross-validation because it is the default best practice for i.i.d. data, forgetting that temporal ordering invalidates random shuffling.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use a time-series aware split: first 80% of data by timestamp for training, last 20% for testing
Time-series data has a temporal order, so training must only use data that precedes the test data to prevent future information from leaking into the model. Option D holds out the last 20% of records by timestamp for testing and trains on the earlier 80%, which mirrors real forecasting conditions where the model predicts unseen future values. This preserves causality and gives a realistic estimate of out-of-sample performance.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use k-fold cross-validation with random assignment
Why it's wrong here
K-fold with random assignment shuffles timestamps, so training folds contain observations later than validation folds, directly leaking future information. It is tempting because k-fold gives robust performance estimates on i.i.d. data, and would be correct if rows were independent rather than time-ordered.
- ✗
Use stratified splitting on the target variable
Why it's wrong here
Stratified splitting preserves class proportions but still assigns rows randomly, so future timestamps can land in the training set and leak information. It is the right choice for imbalanced classification where each class must appear in every fold, not for chronological forecasting data.
- ✗
Perform a random 80/20 split on the entire dataset
Why it's wrong here
A random 80/20 split ignores timestamp order, placing later observations into training and earlier ones into test, which leaks future data. It is tempting because random splitting is the default for independent samples and would be correct for non-temporal tabular data without chronological dependence.
- ✓
Use a time-series aware split: first 80% of data by timestamp for training, last 20% for testing
Why this is correct
Splitting chronologically by timestamp keeps all training observations earlier than every test observation, so the model never learns from future values. Random splitting would leak future information backwards into training, violating the no-leakage constraint for forecasting time-series data.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PDE question from scratch — 747 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Google Cloud exam blueprint
This PDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PDE exam.