




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The TensorFlow Developer Exam tests proficiency in using TensorFlow for implementing machine learning models. It covers the understanding of neural networks, model training, and optimization techniques using the TensorFlow framework, as well as hands-on problem-solving with real-world data.
Typology: Exams
1 / 113
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. What is eager execution in TensorFlow 2.x? A) Building static graphs before execution B) Immediate execution of operations as they are called, enabling dynamic programming C) Compiling models to optimized C++ code D) Running models only on GPU hardware Answer: B Explanation: Eager execution allows TensorFlow operations to run immediately and imperatively, making debugging and development more intuitive in TensorFlow 2.x. Question 2. Which TensorFlow function is used to create a constant tensor? A) tf.Variable() B) tf.constant() C) tf.tensor() D) tf.create() Answer: B Explanation: tf.constant() creates an immutable tensor with fixed values, useful for constants in models. Question 3. What is the main purpose of @tf.function decorator? A) To execute code eagerly for debugging
B) To convert Python functions into TensorFlow graphs for performance optimization C) To load saved models D) To define custom loss functions Answer: B Explanation: @tf.function compiles a Python function into a TensorFlow graph, improving execution speed during training or inference. Question 4. Which API in TensorFlow is primarily used for defining and training neural network models? A) tf.data B) tf.keras C) tf.train D) tf.io Answer: B Explanation: tf.keras provides high-level APIs for building, training, and evaluating neural networks efficiently. Question 5. When compiling a Keras model for binary classification, which loss function is most appropriate? A) categorical_crossentropy B) binary_crossentropy
Explanation: model.predict() generates output predictions based on new input data. Question 8. Which data pipeline component in TensorFlow is used to shuffle, batch, and prefetch data? A) tf.keras.Sequential B) tf.data.Dataset C) tf.io.read_file D) tf.train.Example Answer: B Explanation: tf.data.Dataset provides efficient data pipelines for preparing data during training. Question 9. What is the primary reason for saving a trained model in TensorFlow? A) To visualize the training process B) To reduce model size for deployment C) To reuse the trained weights for inference or further training D) To convert the model to a different framework Answer: C Explanation: Saving allows reusing the trained model without retraining, facilitating deployment and inference.
Question 10. In binary classification, which activation function should be used in the output layer? A) softmax B) sigmoid C) linear D) ReLU Answer: B Explanation: Sigmoid outputs probabilities between 0 and 1 suitable for binary classification. Question 11. For multi-class classification with labels as integers, which loss function is most appropriate? A) categorical_crossentropy B) sparse_categorical_crossentropy C) binary_crossentropy D) mean_squared_error Answer: B Explanation: sparse_categorical_crossentropy is used when labels are integers, not one-hot encoded. Question 12. Which loss function is typically used for regression tasks?
D) TensorBoard Answer: B Explanation: ModelCheckpoint saves the model at specified intervals or when performance improves, ensuring the best model is retained. Question 15. What does transfer learning involve? A) Training models from scratch on large datasets B) Using pre-trained models and fine-tuning them on new data C) Converting models to other frameworks D) Compressing models for deployment Answer: B Explanation: Transfer learning leverages pre-trained models as feature extractors or starting points, saving training time and improving performance. Question 16. Which pre-trained model can be used as a feature extractor for image classification? A) MobileNetV B) BERT C) GPT- 3 D) ResNet Answer: D
Explanation: ResNet50, a CNN pre-trained on ImageNet, is commonly used for feature extraction in image tasks. Question 17. What is the primary advantage of using CNNs in image classification? A) They handle sequential data well B) They automatically learn spatial hierarchies of features C) They are simpler than fully connected networks D) They require less data to train Answer: B Explanation: CNNs learn local patterns and spatial hierarchies through convolutional layers, making them effective for images. Question 18. Which layer is used to perform spatial reduction in CNNs? A) Conv2D B) Dense C) MaxPooling2D D) Dropout Answer: C Explanation: MaxPooling2D reduces spatial dimensions, helping to prevent overfitting and improve feature extraction.
C) To remove stop words from text D) To translate text into multiple languages Answer: A Explanation: Tokenization splits text into meaningful units, enabling numerical processing for models. Question 22. Which class in tf.keras.preprocessing.text is used to convert text into sequences of integers? A) TextVectorization B) Tokenizer C) SequenceGenerator D) TextTokenizer Answer: B Explanation: The Tokenizer class converts raw text into sequences of integers based on the vocabulary. Question 23. What type of layer is typically used to learn word embeddings in Keras? A) Dense B) Embedding C) Conv1D D) RNN
Answer: B Explanation: The Embedding layer maps integer-encoded words into dense vector representations. Question 24. When building a text classification model, which architecture is suited for capturing sequential dependencies? A) Fully connected layer only B) RNN, LSTM, or GRU layers C) Convolutional layers only D) Dropout layers only Answer: B Explanation: RNNs, LSTMs, and GRUs explicitly model sequential dependencies in text data. Question 25. What is a primary advantage of using LSTM over simple RNNs? A) Faster training times B) Better handling of long-term dependencies C) Less computational complexity D) Simpler architecture Answer: B
Question 28. Which metric is most suitable for evaluating time series forecasting models? A) Accuracy B) Precision C) Mean Absolute Error (MAE) D) F1 Score Answer: C Explanation: MAE measures the average magnitude of errors in continuous predictions, suitable for forecasting. Question 29. What is windowing in time series data preparation? A) Dividing data into training and testing sets B) Creating overlapping or non-overlapping segments of data for model input C) Normalizing data to a fixed scale D) Labeling data points with timestamps Answer: B Explanation: Windowing segments sequential data into fixed-length sequences for models to learn temporal patterns. Question 30. How can learning rate schedules benefit training time series models? A) They keep the learning rate constant throughout training
B) They dynamically adjust the learning rate to improve convergence C) They prevent the model from overfitting D) They increase the model size Answer: B Explanation: Learning rate schedules adapt the learning rate during training, helping models converge more effectively. Question 31. Which activation function is most commonly used in the output layer for multi-class classification? A) sigmoid B) softmax C) linear D) ReLU Answer: B Explanation: Softmax outputs probabilities for multiple classes, suitable for multi-class classification. Question 32. When using tf.keras.Sequential API, what is a key requirement? A) All layers must be dense layers B) The layers are stacked linearly, one after another C) The model must include a custom training loop D) It cannot be used for functional API models
Question 35. Which method is used to evaluate a trained model’s performance on unseen data? A) model.fit() B) model.evaluate() C) model.predict() D) model.compile() Answer: B Explanation: model.evaluate() computes loss and metrics on test or validation data to assess generalization. Question 36. What is the primary benefit of using the Functional API in Keras? A) Simpler for small models B) Allows building complex, multi-input/output models with shared layers C) Only supports sequential models D) Does not support custom layers Answer: B Explanation: The Functional API enables flexible model architectures, including models with multiple inputs, outputs, and shared layers.
Question 37. Which type of layer is suitable for capturing sequential dependencies in text? A) Conv2D B) Dense C) LSTM or GRU D) Dropout Answer: C Explanation: LSTM and GRU layers are designed to model sequence data and dependencies over time. Question 38. Which component in TensorFlow allows for real-time data augmentation during training? A) tf.data.Dataset.map() with augmentation functions B) tf.keras.losses C) tf.keras.metrics D) tf.io.read_file Answer: A Explanation: Using tf.data.Dataset with mapping functions enables on-the-fly data augmentation, improving model robustness. Question 39. For image classification, what is the purpose of normalization? A) To resize images to a fixed size
Answer: B Explanation: Padding ensures uniform sequence lengths for batch processing in models like RNNs or LSTMs. Question 42. Which layer is used to combine features extracted from convolutional layers in CNNs? A) Flatten B) MaxPooling2D C) Dense D) ReLU Answer: A Explanation: Flatten converts multi-dimensional feature maps into a 1D vector, suitable for dense layers. Question 43. Which technique can help a model generalize better on unseen data in image classification? A) Using only small datasets B) Data augmentation techniques like rotation, shifting, and flipping C) Removing dropout layers D) Increasing the number of epochs without validation checks Answer: B
Explanation: Data augmentation increases data diversity, reducing overfitting and improving generalization. Question 44. How does fine-tuning a pre-trained model differ from feature extraction? A) Fine-tuning involves retraining the entire model from scratch B) Fine-tuning updates the weights of some or all pre-trained layers on new data C) Feature extraction freezes all pre-trained layers and adds new ones D) Fine-tuning uses different loss functions than feature extraction Answer: B Explanation: Fine-tuning involves unfreezing some layers of the pre-trained model and updating their weights during training on new data. Question 45. What is the main goal of image augmentation? A) To increase the size of the model B) To improve model robustness by artificially expanding training data C) To decrease training time by simplifying images D) To convert images into text descriptions Answer: B Explanation: Augmentation introduces variability, helping models learn more robust features and prevent overfitting.