TensorFlow Developer Certificate program Practice Exam, Exams of Technology

The TensorFlow Developer Certificate Practice Exam is designed for individuals looking to demonstrate their proficiency with TensorFlow in machine learning and AI projects. It includes topics like neural networks, deep learning models, data preprocessing, and TensorFlow libraries for real-world applications.

Typology: Exams

2025/2026

Available from 12/25/2025

shilpi-jain-1
shilpi-jain-1 🇮🇳

4.2

(5)

29K documents

1 / 92

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TensorFlow Developer Certificate program
Practice Exam
**Question 1. Which TensorFlow function creates an immutable tensor?**
A) tf.Variable()
B) tf.constant()
C) tf.placeholder()
D) tf.random.normal()
Answer: B
Explanation: tf.constant() creates a tensor whose value cannot be changed after creation, unlike
tf.Variable() which is mutable.
**Question 2. In TensorFlow, what does the “rank” of a tensor refer to?**
A) Number of elements in the tensor
B) Number of dimensions (axes) the tensor has
C) Data type of the tensor
D) Memory size of the tensor
Answer: B
Explanation: Rank is the count of axes; a scalar has rank 0, a vector rank 1, a matrix rank 2, etc.
**Question 3. Which of the following correctly reshapes a tensor `t` of shape (2, 3) into shape
(3, 2) without copying data?**
A) tf.reshape(t, (3, 2))
B) tf.squeeze(t)
C) tf.expand_dims(t, axis=0)
D) tf.transpose(t)
Answer: A
Explanation: tf.reshape changes the view of the tensor’s data to a new shape; no data copy
occurs if possible.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c

Partial preview of the text

Download TensorFlow Developer Certificate program Practice Exam and more Exams Technology in PDF only on Docsity!

Practice Exam

Question 1. Which TensorFlow function creates an immutable tensor? A) tf.Variable() B) tf.constant() C) tf.placeholder() D) tf.random.normal() Answer: B Explanation: tf.constant() creates a tensor whose value cannot be changed after creation, unlike tf.Variable() which is mutable. Question 2. In TensorFlow, what does the “rank” of a tensor refer to? A) Number of elements in the tensor B) Number of dimensions (axes) the tensor has C) Data type of the tensor D) Memory size of the tensor Answer: B Explanation: Rank is the count of axes; a scalar has rank 0, a vector rank 1, a matrix rank 2, etc. Question 3. Which of the following correctly reshapes a tensor t of shape (2, 3) into shape (3, 2) without copying data? A) tf.reshape(t, (3, 2)) B) tf.squeeze(t) C) tf.expand_dims(t, axis=0) D) tf.transpose(t) Answer: A Explanation: tf.reshape changes the view of the tensor’s data to a new shape; no data copy occurs if possible.

Practice Exam

Question 4. What is the primary difference between tf.constant and tf.Variable regarding gradient computation? A) Only tf.Variable can be used in gradient tape B) tf.constant automatically tracks gradients C) tf.Variable can be updated by optimizers; tf.constant cannot D) There is no difference; both behave the same Answer: C Explanation: Optimizers modify tf.Variable values during training; tf.constant remains fixed and is not updated. Question 5. Which operation extracts the sub‑tensor consisting of rows 1 to 3 (inclusive) and columns 0 to 2 (exclusive) from a 2‑D tensor x? A) x[1:4, 0:2] B) tf.slice(x, [1,0], [3,2]) C) tf.gather(x, [1,2,3]) D) Both A and B are correct Answer: D Explanation: Both Python slicing and tf.slice can achieve the same indexing result. Question 6. After installing TensorFlow, which command confirms that a GPU is visible to the runtime? A) tf.test.is_built_with_cuda() B) tf.config.list_physical_devices('GPU') C) tf.keras.backend.is_gpu_available() D) tf.version.GPU()

Practice Exam

B) width_shift_range=0. C) shear_range=0. D) zoom_range=0. Answer: A Explanation: rotation_range specifies the degree interval for random rotations. Question 10. In a CNN, what is the purpose of a MaxPooling2D layer? A) Increase the number of channels B) Reduce spatial dimensions while keeping the most salient features C) Apply a non‑linear activation function D) Convert 2‑D data to 1‑D vectors Answer: B Explanation: Max pooling selects the maximum value within each window, down‑sampling the feature map. Question 11. Which of the following correctly defines a Conv2D layer for a model that expects 64 ‑pixel‑wide RGB images? A) tf.keras.layers.Conv2D(32, (3,3), input_shape=(64,64,3)) B) tf.keras.layers.Conv2D(32, (3,3), input_shape=(3,64,64)) C) tf.keras.layers.Conv2D(32, (3,3), input_shape=(64,64)) D) tf.keras.layers.Conv2D(32, (3,3), input_shape=(None, None, 3)) Answer: A Explanation: TensorFlow expects channel‑last format (height, width, channels); (64,64,3) matches the input.

Practice Exam

Question 12. For a binary image classification problem, which activation should be used in the final Dense layer? A) softmax B) sigmoid C) relu D) linear Answer: B Explanation: Sigmoid outputs a probability between 0 and 1 for binary classification. Question 13. Which loss function is appropriate for multi‑class classification with integer labels (not one‑hot)? A) tf.keras.losses.CategoricalCrossentropy() B) tf.keras.losses.SparseCategoricalCrossentropy() C) tf.keras.losses.BinaryCrossentropy() D) tf.keras.losses.MeanSquaredError() Answer: B Explanation: SparseCategoricalCrossentropy expects integer class indices rather than one‑hot vectors. Question 14. Which optimizer adapts the learning rate for each parameter based on first‑ and second‑moment estimates? A) SGD B) RMSprop C) Adam D) Adagrad Answer: C

Practice Exam

C) weights='imagenet' D) pooling='avg' Answer: A Explanation: Setting trainable=False prevents weight updates in the loaded model’s layers. Question 18. In fine‑tuning, why do we typically unfreeze only the top few layers of a pre‑trained model? A) Top layers contain low‑level features that need adaptation B) Bottom layers are more task‑specific and should stay frozen C) Top layers capture high‑level, task‑specific representations that benefit from adaptation D) Unfreezing all layers always leads to worse performance Answer: C Explanation: Higher layers learn abstract concepts that may differ across tasks; fine‑tuning them helps adapt to the new dataset. Question 19. Which TensorFlow API is used to convert raw text into integer sequences based on a word index? A) tf.keras.layers.TextVectorization B) tf.keras.preprocessing.text.Tokenizer C) tf.data.TextLineDataset D) tf.io.decode_csv Answer: B Explanation: Tokenizer builds a vocabulary and transforms texts to sequences of integer indices. Question 20. After tokenizing sentences, which function pads sequences to the same length?

Practice Exam

A) tf.keras.preprocessing.sequence.pad_sequences B) tf.keras.layers.Padder C) tf.keras.preprocessing.text.one_hot D) tf.keras.utils.to_categorical Answer: A Explanation: pad_sequences adds padding (pre‑ or post‑) so all sequences share a uniform length. Question 21. When defining an Embedding layer, what does the input_dim argument represent? A) Length of each embedding vector B) Vocabulary size (number of distinct tokens) C) Maximum sequence length D) Number of output classes Answer: B Explanation: input_dim is the size of the token index space; each token is mapped to an embedding vector. Question 22. Which recurrent layer is best suited for learning long‑range dependencies in text? A) SimpleRNN B) LSTM C) GRU D) Conv1D Answer: B

Practice Exam

C) Size of the validation set D) Number of epochs for training Answer: B Explanation: The look‑back window determines how many previous observations are fed to the model to forecast the next value. Question 26. Which Keras layer should you set return_sequences=True when stacking two LSTM layers? A) The first LSTM layer B) The second LSTM layer C) Both LSTM layers D) Neither; you should use return_state instead Answer: A Explanation: The first LSTM must output the full sequence so the second LSTM can process it; the final LSTM can output only the last hidden state. Question 27. In the Functional API, how do you create a model with two inputs that are concatenated before a Dense layer? A) Use tf.keras.layers.Add on the inputs B) Use tf.keras.layers.Concatenate([input1, input2]) then connect to Dense C) Use tf.keras.Model(inputs=[input1, input2], outputs=dense) without concatenation D) Functional API cannot handle multiple inputs Answer: B Explanation: Concatenate merges tensors along a specified axis, allowing downstream layers to receive the combined representation.

Practice Exam

Question 28. Which argument in model.compile() specifies the metric used to monitor classification accuracy for integer labels? A) metrics=['accuracy'] B) metrics=['sparse_categorical_accuracy'] C) metrics=['binary_accuracy'] D) metrics=['categorical_accuracy'] Answer: B Explanation: sparse_categorical_accuracy works with integer class indices; accuracy expects one‑hot encoded targets. Question 29. How does increasing the batch size generally affect training speed and model generalization? A) Faster per‑epoch training, but may reduce generalization due to less noise B) Slower training and better generalization C) No effect on speed, only on memory usage D) Always improves both speed and generalization Answer: A Explanation: Larger batches make each step compute more data, reducing the number of steps per epoch, but may lead to poorer generalization because of reduced stochasticity. Question 30. Which learning‑rate schedule halves the learning rate every 10 epochs? A) tf.keras.optimizers.schedules.ExponentialDecay B) tf.keras.callbacks.LearningRateScheduler(lambda epoch: 0.001 * 0.5**(epoch//10)) C) tf.keras.optimizers.schedules.PiecewiseConstantDecay D) tf.keras.callbacks.ReduceLROnPlateau Answer: B

Practice Exam

D) Resize images to (32,32) Answer: B Explanation: The model expects a single‑channel (grayscale) image; adding the channel dimension satisfies the input shape. Question 34. Which TensorFlow function converts a NumPy array np_arr into a TensorFlow tensor? A) tf.convert_to_tensor(np_arr) B) tf.constant(np_arr) C) tf.Variable(np_arr) D) All of the above Answer: D Explanation: All three create a tensor from a NumPy array; tf.constant and tf.convert_to_tensor produce immutable tensors, while tf.Variable creates a mutable one. Question 35. In a Keras ImageDataGenerator, which argument controls random horizontal flips? A) horizontal_flip=True B) flip_horizontal=True C) rotation_range=0. D) shear_range=0. Answer: A Explanation: horizontal_flip=True enables random left‑right mirroring. Question 36. What does the tf.keras.layers.BatchNormalization layer do during training? A) Randomly drops connections

Practice Exam

B) Normalizes activations to zero mean and unit variance per batch C) Adds L2 regularization to weights D) Performs max pooling Answer: B Explanation: BatchNormalization stabilizes and accelerates training by normalizing activations across each mini‑batch. Question 37. Which of the following is a correct way to freeze only the first three layers of a Sequential model named model? A) for layer in model.layers[:3]: layer.trainable = False B) model.trainable = False C) model.layers[0:3].trainable = False D) model.freeze_layers(3) Answer: A Explanation: Setting trainable=False on selected layers prevents their weights from being updated. Question 38. In a text generation RNN, why might you set return_sequences=True on the final LSTM layer? A) To output a probability for each time step (useful for sequence‑to‑sequence) B) To reduce the number of parameters C) To enable dropout inside the LSTM D) To make the model faster Answer: A Explanation: Returning the full sequence allows the model to produce an output token at each time step, which is required for many generation tasks.

Practice Exam

Answer: A Explanation: MSE measures the average squared difference between predicted and true continuous values. Question 42. When using tf.data.Dataset to load CSV data, which method parses each line into tensors? A) dataset.map(tf.io.decode_csv) B) dataset.batch() c) dataset.shuffle() d) dataset.prefetch() Answer: A Explanation: tf.io.decode_csv converts a CSV‑formatted string tensor into a list of tensors. Question 43. Which argument in tf.keras.layers.Conv2D controls the stride of the convolution? A) strides B) padding C) dilation_rate D) kernel_initializer Answer: A Explanation: strides determines how many pixels the filter moves at each step. Question 44. In transfer learning with VGG16, why is include_top=False often used? A) To remove the fully‑connected classification head, allowing a new head for the target task B) To speed up training by removing convolutional layers C) To keep the original ImageNet classes

Practice Exam

D) To change the input image size to 224× Answer: A Explanation: Excluding the top layers lets you attach a custom classifier suited to your dataset. Question 45. Which metric is appropriate for evaluating a multi‑label classification problem? A) accuracy B) binary_accuracy C) categorical_accuracy D) mean_absolute_error Answer: B Explanation: binary_accuracy computes per‑label correctness, suitable when each sample can belong to multiple classes. Question 46. What does the tf.keras.layers.GlobalAveragePooling2D layer do? A) Flattens the feature map into a vector B) Computes the average of each feature map channel, reducing spatial dimensions to 1 C) Performs max pooling over the entire feature map D) Adds a dense layer automatically Answer: B Explanation: Global average pooling reduces each channel to its spatial mean, yielding a compact representation. Question 47. Which of the following is NOT a valid TensorFlow data type for tensors? A) tf.float B) tf.int

Practice Exam

A) (batch, timesteps, 64) B) (batch, 64) C) (batch, timesteps, 1) D) (batch, features, 64) Answer: B Explanation: Without returning sequences, the LSTM outputs only the last hidden state per sample. Question 51. Which function is used to convert a Python list of labels into a one‑hot encoded TensorFlow tensor? A) tf.one_hot() B) tf.keras.utils.to_categorical() C) tf.keras.layers.CategoryEncoding() D) All of the above Answer: D Explanation: All three can create one‑hot representations; tf.one_hot is low‑level, to_categorical is a convenience wrapper. Question 52. In a time‑series model, why might you use tf.keras.layers.Conv1D before an LSTM? A) To reduce the sequence length via stride > 1 B) To extract local temporal patterns that improve LSTM performance C) To replace the need for embeddings D) To increase the number of parameters dramatically Answer: B

Practice Exam

Explanation: Conv1D can capture short‑term trends, providing richer inputs for the subsequent recurrent layer. Question 53. Which argument in tf.keras.layers.Dense specifies the activation function? A) activation B) kernel_initializer C) use_bias D) name Answer: A Explanation: The activation parameter sets the non‑linear function applied to the layer’s output. Question 54. When using tf.keras.preprocessing.text.Tokenizer(num_words=5000), what does num_words control? A) Maximum length of each sequence B) Number of most frequent words to keep in the vocabulary C) Minimum frequency a word must have to be kept D) Size of the embedding vector Answer: B Explanation: num_words limits the vocabulary to the top‑N most common tokens. Question 55. Which of the following is a correct way to create a custom learning‑rate schedule that linearly decays from 0.01 to 0 over 1000 steps? A) tf.keras.optimizers.schedules.PolynomialDecay(initial_learning_rate=0.01, decay_steps=1000, end_learning_rate=0.0) B) tf.keras.optimizers.schedules.ExponentialDecay(0.01, 0.1, 1000)