TensorFlow · Interview questions · Updated November 2026
TensorFlow interview questions for developer roles in 2026 test TensorFlow 2 with Keras 3: tf.data input pipelines, building and training models, regularisation and evaluation, computer vision with transfer learning, natural language processing and time series forecasting. The latest stable release is TensorFlow 2.21, and since TensorFlow 2.16 a plain install brings Keras 3, so Keras 2 habits such as ImageDataGenerator, now deprecated, look dated. The TensorFlow Developer Certificate exam has closed, so interviews and your own projects are how you show these skills. This guide covers the topics by area and level, a 2–3 week plan and 10 free TensorFlow practice questions with answers.
At a glance
| Free in this guide | 10 practice questions with answers |
| Latest stable release | TensorFlow 2.21 (March 2026) |
| Levels covered | Junior, mid-level and senior |
| Core topics | Keras 3, tf.data, training, vision, NLP, time series |
| Official certificate | TensorFlow Developer Certificate exam closed |
| Exametics set | 6 practice tests, 330 questions |
- Existing TensorFlow Developer Certificates stay valid for 3 years from the date the holder passed.
Source: TensorFlow Developer Certificate page and TensorFlow 2.21.0 release notes. Checked on 9 November 2026.
What interviewers test in TensorFlow
TensorFlow interview questions check whether you can feed data efficiently, train a model that generalises and explain each choice. Most are about the Keras 3 API, plus lower-level tools such as tf.function.
There is no official interview syllabus, so the groups below follow the official TensorFlow and Keras guides. The Keras getting started page notes that Keras 3 also runs on JAX and PyTorch.
tf.data input pipelines
Pipeline questions are common because a slow input pipeline leaves the GPU idle. The tf.data performance guide lists the core habits you should be able to explain.
- prefetch: overlaps preparing the next batch with training on the current one;
tf.data.AUTOTUNElets the runtime pick the buffer size. - Parallel work:
map(..., num_parallel_calls=tf.data.AUTOTUNE)for preprocessing andinterleavefor reading many files. - cache: place it after an expensive
mapif the result fits in memory or on local disk; steps before it run only in the first epoch. - Vectorising: write the mapped function to work on whole batches and batch before
map, so it runs once per batch, not once per element.
The tf.data guide shows that a shuffle before a repeat finishes each epoch before the next starts, while a repeat before a shuffle mixes the epoch boundaries together. Know the Keras dataset utilities too, such as image_dataset_from_directory, which infers labels from folder names.
Building and training models
Expect questions on the Sequential and Functional APIs, compile() and fit(), and on matching the output layer to the loss. The Keras probabilistic losses page says sparse categorical cross-entropy expects integer labels, categorical cross-entropy expects one-hot labels, and both assume probabilities unless you set from_logits=True.
Senior roles add custom training. The TensorFlow autodiff guide explains that tf.GradientTape watches trainable variables automatically, needs tape.watch() for plain tensors, and returns None when the target is not connected to a source. The tf.function guide explains tracing: a Python print runs only while tracing, tf.print runs on every call, and new Python argument values cause retracing.
Regularisation and evaluation
Interviewers want to hear how you spot and fix overfitting. The Keras Dropout page says dropout only applies when training=True, and fit() sets that for you. The Keras FAQ explains why training loss can sit above validation loss.
Callbacks are a favourite detail question. The EarlyStopping reference shows that, by default, the model keeps its last weights, not its best ones.
Computer vision and transfer learning
The TensorFlow API docs mark ImageDataGenerator as deprecated; use dataset utilities and preprocessing layers such as Rescaling, RandomFlip and RandomRotation instead. The TensorFlow data augmentation tutorial notes that augmentation is inactive at test time.
The Keras transfer learning guide sets out the standard workflow. Load a pretrained base, freeze it, train a new head, then optionally unfreeze and fine-tune with a very low learning rate. Be ready to explain why you recompile after changing trainable, and why you call the base model with training=False when it contains BatchNormalization.
NLP and time series
Text questions centre on the TextVectorization layer: adapt() builds the vocabulary, index 0 is padding and index 1 is the out-of-vocabulary token. Pair it with an Embedding layer, where mask_zero=True treats 0 as padding. An LSTM returns only its last output unless return_sequences=True, which stacked recurrent layers need.
Time series questions test windowing and leakage. The TensorFlow time series tutorial splits the data 70/20/10 without random shuffling, and computes the mean and standard deviation from the training split only. The timeseries_dataset_from_array utility builds the input windows and their targets for you.
Saving and deployment
Senior candidates are often asked how a model leaves the notebook. The Keras saving guide says the only supported format in Keras 3 is the .keras file, which stores the architecture, weights, compile information and optimizer state. Weights alone go in a file ending .weights.h5, and custom layers need to be registered so they load again.
Keras defaults interviewers ask about
Many short interview questions simply check a default, as listed on the official Keras API pages linked above.
| API | Default or rule |
|---|---|
| EarlyStopping | monitor="val_loss", patience=0, restore_best_weights=False |
| Cross-entropy losses | from_logits=False; sparse expects integer labels, categorical expects one-hot |
| Dropout | Active only when training=True; fit() sets it |
| image_dataset_from_directory | label_mode="int", batch_size=32, image_size=(256, 256), shuffle=True |
| timeseries_dataset_from_array | batch_size=128, shuffle=False |
| TextVectorization | output_mode="int"; index 0 is padding, index 1 is [UNK] |
| LSTM | return_sequences=False |
| Saving | Full model in .keras; weights file ends in .weights.h5 |
Exametics practice tests
TensorFlow Developer Interview Practice Tests
- 6 practice tests with 55 questions each: 330 questions in total
- Every answer explained, with a hint, plus a timed Exam Mode test
- Rebuilt in 2026 for TensorFlow 2.21 and Keras 3; each question tagged with one of seven topic areas
- Lifetime access
30-day refund. Instant access after payment.
TensorFlow interview questions by level: junior, mid and senior
The level of a TensorFlow interview changes the depth of the questions more than the topics. Juniors explain what a layer or loss does; seniors explain trade-offs and what breaks in production.
| Level | What interviewers expect |
|---|---|
| Junior | Build and train a Sequential or Functional model, choose the right loss and output activation, read training curves, load images or text with Keras utilities. |
| Mid-level | Write a fast tf.data pipeline, use callbacks, apply transfer learning and fine-tuning, handle text with TextVectorization and embeddings, window a time series without leakage. |
| Senior | Custom training loops with GradientTape, tf.function tracing, saving and serving models, backend choices in Keras 3, debugging slow pipelines and unstable training. |
Senior interviews often start from a problem, such as a model that scores well offline but badly in production. Good answers check the data first: preprocessing that differs between training and serving, or a leaky split.
Next on your machine learning path
- Google Professional Machine Learning Engineer practice tests: a current Google certification for people who build and run ML systems on Google Cloud.
- Natural Language Processing (NLP) practice tests: go deeper on the text topics that TensorFlow interviews touch.
- Python programming practice tests: firm up the Python that every TensorFlow answer relies on.
How to prepare for a TensorFlow interview in 2–3 weeks
Two to three weeks is enough to prepare for a TensorFlow interview if you already know Python and basic machine learning. Write code every day on a current TensorFlow install.
- Days 1–3: Set up and refresh the basics Install TensorFlow 2.21, confirm you are on Keras 3, and rebuild a small classifier with the Functional API. Revise losses and shapes. If NumPy feels rusty, read our NumPy interview questions guide first.
- Days 4–6: tf.data and training Build an image pipeline with image_dataset_from_directory, then add cache, shuffle, batch and prefetch in a sensible order. Train with EarlyStopping and explain each setting out loud.
- Days 7–9: Vision and transfer learning Swap ImageDataGenerator code for preprocessing layers. Train a head on a frozen pretrained base, then fine-tune with a low learning rate.
- Days 10–12: NLP and time series Build a text classifier with TextVectorization and an Embedding layer. Then window a time series, split it by time and beat a “no change” baseline.
- Days 13–15: Custom training and saving Write one training step with GradientTape and tf.function, then save and reload a model in the .keras format, including a custom layer.
- Days 16–18: Timed practice Take the TensorFlow developer interview practice tests in Exam Mode, read every explanation and revise your weakest topic areas.
Tip
For each topic, prepare one short example from your own work: the problem, what you changed and how you measured the result.
Planning more than one exam?
If you are preparing for several interviews or certifications, the All-Access Pass covers every practice test on Exametics, including the 58 interview-question sets and new exams as they are added, with lifetime access. It costs less than buying about six single practice tests.
Free TensorFlow interview questions (10 with answers)
Try these 10 free TensorFlow sample questions, written for TensorFlow 2.21 and Keras 3 and labelled by topic area. The full Exametics TensorFlow practice tests have 330 more questions like these, each with a hint and an explanation.
Practice question 1 · tf.data input pipelines
A training pipeline ends with .batch(32).prefetch(tf.data.AUTOTUNE). What does the prefetch step add?
- A. It caches the whole dataset in memory after the first epoch
- B. It shuffles the batches with a buffer size chosen at runtime
- C. It prepares later batches in the background while the model trains on the current one
- D. It spreads the preprocessing function across several CPU cores
Show answer
Answer: C. Prefetching overlaps producing data with consuming it: while the model runs training step s, the pipeline is already preparing the data for step s+1. With tf.data.AUTOTUNE, the runtime tunes how many elements to prefetch.
A is wrong because that is what cache() does. B is wrong because prefetch does not change the order of elements; that is shuffle(). D is wrong because parallel preprocessing comes from map(..., num_parallel_calls=...), not from prefetch.
Practice question 2 · tf.data input pipelines
An image pipeline runs map(decode_and_resize), which is slow, then map(random_augment), then batch and prefetch. The decoded images fit in memory. Where should you add cache()?
- A. Straight after
map(decode_and_resize), beforemap(random_augment) - B. Straight after
map(random_augment), beforebatch - C. After
prefetch, at the very end of the pipeline - D. Before
map(decode_and_resize), on the file paths
Show answer
Answer: A. Steps before cache() run only in the first epoch, so caching after the slow decode saves that work every later epoch. Augmentation still runs after it, so each epoch sees new variations.
B is wrong because the augmented images would be cached, and every epoch would replay the same “random” changes. C is wrong for the same reason. D is wrong because caching file paths saves almost nothing; the slow decode would still run every epoch.
Practice question 3 · Building and training models
A classifier for 10 classes ends with Dense(10) and no activation. The labels are integers from 0 to 9. Which loss should you pass to compile()?
- A.
keras.losses.CategoricalCrossentropy() - B.
keras.losses.SparseCategoricalCrossentropy() - C.
keras.losses.BinaryCrossentropy(from_logits=True) - D.
keras.losses.SparseCategoricalCrossentropy(from_logits=True)
Show answer
Answer: D. Integer labels call for the sparse version of categorical cross-entropy. Because the last layer has no softmax, its outputs are logits, so you must set from_logits=True.
A is wrong because categorical cross-entropy expects one-hot labels and, by default, probabilities. B uses the right label format, but from_logits defaults to False, so the loss would treat raw logits as probabilities. C is wrong because binary cross-entropy is for two classes or independent multi-label outputs, not one-of-10 classification.
Practice question 4 · Building and training models
A @tf.function called run_batches(n_batches) loops with for i in tf.range(n_batches). Calls such as run_batches(50), run_batches(80) and run_batches(120) are all slow because each one traces again. What is the simplest fix?
- A. Replace
tf.rangewith Pythonrange - B. Pass the count as a tensor, for example
run_batches(tf.constant(50)) - C. Add a Python
printinside the function to check each call - D. Remove
@tf.functionand run the loop eagerly
Show answer
Answer: B. A tf.function retraces when it gets a new Python argument value, because Python values are treated as part of the graph’s signature. Tensor arguments of the same type and shape reuse the existing trace.
A is wrong because a Python range is unrolled while tracing, which makes the graph bigger and still retraces for each new value. C is wrong because a Python print only runs while tracing; it can show the problem but does not fix it. D avoids retracing but loses graph speed, so it is not the best fix.
Practice question 5 · Regularisation and evaluation
You train with EarlyStopping(monitor="val_loss", patience=3) and no other options. Validation loss is lowest at epoch 9, and training stops after epoch 12. Which weights does the model hold when fit() returns?
- A. The weights from epoch 9, restored automatically
- B. The weights from epoch 9, but only because a baseline was set
- C. An average of the weights from epochs 9 to 12
- D. The weights from epoch 12, because
restore_best_weightsdefaults toFalse
Show answer
Answer: D. With the defaults, EarlyStopping only stops training. Because restore_best_weights is False by default, the model keeps the weights from the last epoch it ran.
A is wrong because restoring the best epoch only happens when you set restore_best_weights=True. B is wrong because no baseline was set, and a baseline does not turn on restoring by itself. C is wrong because EarlyStopping never averages weights.
Practice question 6 · Regularisation and evaluation
A model with Dropout(0.5) layers shows a training loss of 0.45 and a validation loss of 0.38 in the same epoch. What is the most likely explanation?
- A. Dropout is active only during training, and the training loss is an average over the epoch while validation uses the end-of-epoch model
- B. The validation data must have leaked into the training data
- C. The model is underfitting, so you should raise the dropout rate
- D. Keras computes validation loss without using the labels
Show answer
Answer: A. Dropout and weight penalties apply only in training mode, so they push the training loss up. The training loss is also averaged over every batch in the epoch, while the validation loss is measured with the model as it stands at the end of the epoch.
B is wrong because a small gap like this is fully explained by the normal behaviour above. C is wrong because more dropout would make the model fit even less. D is wrong because validation loss is computed against the validation labels.
Practice question 7 · Computer vision and transfer learning
You trained a new head on a frozen pretrained base that contains BatchNormalization layers. The base is called as base_model(x, training=False). You now want to fine-tune. What should you do?
- A. Set
base_model.trainable = Trueand keep callingfit()with the same optimizer and learning rate - B. Set
base_model.trainable = Trueand rebuild the model calling the base withtraining=True - C. Set
base_model.trainable = True, callcompile()again with a very low learning rate, and keeptraining=False - D. Unfreeze the base before training the new head, so both train together from the start
Show answer
Answer: C. The Keras transfer learning guide says to recompile after changing trainable so the change takes effect, and to fine-tune with a very low learning rate. Keeping training=False leaves BatchNormalization in inference mode, so its statistics are not overwritten.
A is wrong because the change needs a recompile, and a normal learning rate can wreck the pretrained features. B is wrong because running BatchNormalization in training mode on a small dataset can destroy what the model learned. D is wrong because the guide says to fine-tune only after the head has converged; large gradients from a random head would damage the base.
Practice question 8 · Computer vision and transfer learning
Your model starts with RandomFlip("horizontal") and RandomRotation(0.1) layers instead of ImageDataGenerator. What happens to these layers when you call model.predict() on test images?
- A. Each test image is randomly flipped and rotated, so predictions change between runs
- B. The layers pass images through unchanged, because augmentation is inactive at inference
- C.
predict()raises an error until you remove the augmentation layers - D. The layers apply one fixed flip and rotation to every test image
Show answer
Answer: B. Random augmentation layers only act in training mode. They change images during fit() and do nothing during evaluate() or predict(), so the same model can be saved and served as it is.
A is wrong because the layers are inactive at inference. C is wrong because these layers are valid parts of a model and are saved with it. D is wrong because there is no fixed transform at inference; the layers simply pass the input through.
Practice question 9 · Natural language processing
A TextVectorization(max_tokens=10000, output_mode="int", output_sequence_length=50) layer has been adapted on training text. You pass it a short sentence that contains a word it never saw. Which statement is true?
- A. The unseen word is dropped and the output is shorter than 50
- B. The output length depends on how many words the sentence has
- C. The unseen word is mapped to index 0
- D. The unseen word is mapped to index 1, and the output is padded with 0 up to 50 values
Show answer
Answer: D. In "int" mode, index 1 is the out-of-vocabulary token [UNK], and index 0 is reserved for padding. Setting output_sequence_length pads or truncates every output to exactly 50 values.
A is wrong because unknown words are mapped to the OOV index, not removed. B is wrong because output_sequence_length fixes the length. C is wrong because 0 is the padding index, which an Embedding layer with mask_zero=True will mask out.
Practice question 10 · Time series forecasting
A colleague forecasts daily sales from three years of data. They shuffle all rows, split them randomly 80/20, and normalise with the mean and standard deviation of the whole dataset. Which change fixes both problems?
- A. Keep the random split but use a larger shuffle buffer
- B. Keep the random split and set
shuffle=Trueintimeseries_dataset_from_array - C. Split by time without shuffling (earliest data for training, later data for validation and test) and compute the mean and standard deviation from the training split only
- D. Compute the mean and standard deviation from the test split, because it is the most recent data
Show answer
Answer: C. A time-ordered split keeps windows of consecutive days intact and tests the model on data from after the training period, which is how it will be used. Normalising with training statistics only stops information from the validation and test periods leaking into training.
A and B are wrong because any random split still mixes future days into training, and shuffling windows does not undo that. D is wrong because using test statistics is another form of leakage.
How did you score?
8–10 correct: you are ready for a full timed test, so try Exam Mode next. Under 8: revise the topic areas you missed in the official guides. The TensorFlow developer interview practice tests have 330 more questions like these, each with a hint and a full explanation.
Common mistakes in TensorFlow interviews
The most common mistake in a TensorFlow interview is answering with Keras 2 or TensorFlow 1 habits. Most others come from not checking data, shapes and modes first.
- Using deprecated APIs: ImageDataGenerator, sessions or placeholders instead of dataset utilities, preprocessing layers and eager code.
- Mixing up logits and probabilities: putting a softmax in the model and also setting
from_logits=True, or neither. - Confusing training and trainable: the Keras FAQ treats them as separate ideas, with BatchNormalization as the one exception.
- Leaking data: random splits for time series, or normalising with statistics from the whole dataset.
- Ignoring the input pipeline: blaming the model when the GPU is waiting for data.
For general Python rounds, read our Python interview preparation guide. For the machine learning theory behind these answers, see our machine learning certification prep guide.
TensorFlow interview questions: FAQs
Are there free TensorFlow practice questions?
Yes. This guide includes 10 free practice questions for TensorFlow interviews, with answers and explanations, labelled by topic area. For full timed practice, the Exametics TensorFlow developer interview practice tests have 6 tests with 55 questions each, 330 questions in total, with every answer explained.
What topics do TensorFlow interview questions cover?
TensorFlow developer interview questions usually cover tf.data input pipelines, building and training Keras models, regularisation and evaluation, computer vision with transfer learning, text processing and time series forecasting. Senior roles add GradientTape, tf.function and saving models.
Is the TensorFlow Developer Certificate exam still available?
No. The official TensorFlow certificate page says the TensorFlow Certificate exam has closed while the TensorFlow team evaluates the next step in its certificate program. Certificates already earned stay valid for 3 years from the date the holder passed. Exametics TensorFlow practice tests are interview preparation and do not replace the certificate.
Which TensorFlow version should I prepare for?
Prepare for TensorFlow 2.21, the latest stable release on the TensorFlow GitHub releases page, released in March 2026. TensorFlow 2.22 is still a release candidate, so most interview answers should match 2.21 and Keras 3.
Do TensorFlow interviews use Keras 3?
Usually, yes. The Keras getting started page says that from TensorFlow 2.16, installing TensorFlow installs Keras 3 and tf.keras points to Keras 3 by default. Keras 2 is still available as the separate tf_keras package for older code.
How long does it take to prepare for a TensorFlow interview?
If you already know Python and basic machine learning, two to three weeks of daily coding plus timed practice tests is a realistic plan. Spend most of it on tf.data, transfer learning, text and time series, which need hands-on practice.
Is ImageDataGenerator still used in TensorFlow?
The TensorFlow API reference marks ImageDataGenerator as deprecated. Use utilities such as image_dataset_from_directory together with Keras preprocessing layers like RandomFlip and RandomRotation, which the official data augmentation tutorial demonstrates.
Official documentation: TensorFlow guide. Checked on 9 November 2026.
Practise for your TensorFlow interview
Practise with 6 tests and 330 TensorFlow interview questions, rebuilt for TensorFlow 2.21 and Keras 3, with every answer explained.
✓ Every answer explained · ✓ Timed exam mode · ✓ 30-day refund