Unit 1: Building Models with TensorFlow - Practice Quiz

INT422 — Deep Learning 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is TensorFlow primarily used for?

Introduction to TensorFlow Easy
A. Creating computer operating systems
B. Managing physical network devices
C. Building and training machine learning models
D. Designing relational database tables

2 Which organization originally developed TensorFlow?

Introduction to TensorFlow Easy
A. Google
B. Apple
C. IBM
D. Microsoft

3 Which command is commonly used to install TensorFlow with pip?

Installation of TensorFlow Easy
A. python install tensor
B. pip install tensorflow
C. pip create tensorflow
D. tensorflow setup package

4 Which Python statement commonly imports TensorFlow using the alias tf?

Installation of TensorFlow Easy
A. import tensorflow as tf
B. load tf from tensorflow and initialize every available machine learning component
C. from tensorflow run tf
D. include tensorflow as tf

5 What is the rank of a scalar tensor?

TensorFlow ranks and tensors Easy
A. 3
B. 0
C. 2
D. 1

6 Which description best matches a rank-2 tensor?

TensorFlow ranks and tensors Easy
A. A vector with one axis
B. A graph containing several connected mathematical operations and stored model parameters
C. A scalar with no axes
D. A matrix with rows and columns

7 What does a TensorFlow computation graph represent?

TensorFlow's computation graphs Easy
A. Users and their access permissions
B. Files and their storage locations
C. Operations and their data dependencies
D. Images and their color channels

8 Which TensorFlow decorator can convert a Python function into a callable TensorFlow graph?

TensorFlow's computation graphs Easy
A. @tf.tensor
B. @tf.variable
C. @tf.optimizer
D. @tf.function

9 Which TensorFlow object is designed to store model parameters that can change during training?

Variables in TensorFlow Easy
A. tf.rank
B. tf.Variable
C. tf.constant
D. tf.shape

10 Which method can directly update the value stored in a TensorFlow variable?

Variables in TensorFlow Easy
A. assign()
B. rank()
C. compile()
D. reshape()

11 What is the main purpose of an optimizer during model training?

TensorFlow optimizers Easy
A. Divide the dataset into folders and permanently save every training example
B. Update model parameters to reduce loss
C. Display tensors in a web browser
D. Convert labels into image files

12 Which of the following is a commonly used TensorFlow optimizer?

TensorFlow optimizers Easy
A. ReLU
B. Adam
C. TensorBoard
D. Softmax

13 Which TensorFlow operation changes a tensor's shape without changing its element values?

Transforming tensors as multidimensional data arrays Easy
A. tf.random.normal()
B. tf.reduce_sum()
C. tf.argmax()
D. tf.reshape()

14 A tensor has shape . How many elements does it contain?

Transforming tensors as multidimensional data arrays Easy
A. 6
B. 8
C. 5
D. 9

15 What is TensorBoard mainly used for?

Visualization with TensorBoard Easy
A. Visualizing model training information
B. Replacing the training dataset with automatically generated examples from every possible category
C. Writing operating system drivers
D. Creating relational database queries

16 Which training metric is commonly plotted in TensorBoard?

Visualization with TensorBoard Easy
A. File size
B. Keyboard speed
C. Loss
D. Screen width

17 What is deep learning?

Introduction to Deep Learning Easy
A. A method that stores every input exactly and avoids learning patterns from training data
B. Machine learning using multi-layer neural networks
C. Database management using linked tables
D. Web development using style sheets

18 What is the basic computational unit of an artificial neural network?

Introduction to Deep Learning Easy
A. Folder
B. Neuron
C. Router
D. Table

19 Which task is a common application of deep learning in computer vision?

Applications of Deep Learning Easy
A. Spreadsheet sorting
B. Disk formatting
C. File compression
D. Image classification

20 Which application commonly uses deep learning to understand human language?

Applications of Deep Learning Easy
A. Cable installation and detailed configuration of physical network connections
B. Machine translation
C. Memory allocation
D. Printer calibration

21 A developer wants TensorFlow to automatically compute gradients of a loss with respect to model parameters. Which TensorFlow feature should be used?

Introduction to TensorFlow Medium
A. tf.TensorArray
B. tf.saved_model
C. tf.data.Dataset
D. tf.GradientTape

22 Which TensorFlow component is most appropriate for creating an efficient input pipeline from a large collection of training samples?

Introduction to TensorFlow Medium
A. tf.math
B. tf.summary
C. tf.keras.layers
D. tf.data.Dataset

23 A project requires a TensorFlow version that conflicts with another project's dependencies. What is the most appropriate solution?

Installation of TensorFlow Medium
A. Use a separate virtual environment
B. Rename the TensorFlow package
C. Disable dependency checking
D. Install both versions globally

24 After installing TensorFlow, which command best verifies that the package can be imported and reports its installed version?

Installation of TensorFlow Medium
A. python -c "import tensorflow; print(tensorflow.shape)"
B. python -c "import tensorflow as tf; print(tf.__version__)"
C. pip build tensorflow --version
D. python tensorflow --check-version

25 An image batch has tensor shape (32, 28, 28, 1). What are its rank and batch size?

TensorFlow ranks and tensors Medium
A. Rank 5 and batch size 32
B. Rank 3 and batch size 28
C. Rank 4 and batch size 28
D. Rank 4 and batch size 32

26 Given tensor A with shape (4, 3) and tensor B with shape (3, 2), what is the shape of tf.matmul(A, B)?

TensorFlow ranks and tensors Medium
A. (3, 3)
B. (3, 2)
C. (4, 2)
D. (4, 3)

27 A training function is repeatedly executed with tensors of the same shape and type. What is a likely benefit of decorating it with @tf.function?

TensorFlow's computation graphs Medium
A. It traces operations into an optimized graph
B. It removes the need for input data
C. It converts tensors into NumPy arrays
D. It permanently stores all intermediate tensors

28 A function decorated with @tf.function is called using inputs with many different shapes, causing repeated tracing. Which approach can reduce this retracing?

TensorFlow's computation graphs Medium
A. Convert every input to a variable
B. Write event files after each call
C. Disable all TensorFlow optimizers
D. Provide a suitable input signature

29 A model weight must be updated during training and saved in checkpoints. Which TensorFlow object is most appropriate?

Variables in TensorFlow Medium
A. tf.TensorSpec
B. tf.Variable
C. tf.constant
D. tf.Operation

30 Suppose w is a trainable tf.Variable, g is its gradient, and is the learning rate. Which statement performs a basic gradient-descent update?

Variables in TensorFlow Medium
A. g.assign_sub(eta * w)
B. w = tf.constant(eta * g)
C. w.assign_add(eta * g)
D. w.assign_sub(eta * g)

31 For a parameter value , gradient , and SGD learning rate , what is the updated parameter value?

TensorFlow optimizers Medium
A.
B.
C.
D.

32 A model has noisy and differently scaled gradients across parameters. Which optimizer is commonly chosen because it adapts learning rates using gradient moments?

TensorFlow optimizers Medium
A. Mean squared error
B. Adam
C. Batch normalization
D. Plain SGD

33 A tensor has shape (2, 3, 4). Which target shape is valid for tf.reshape without adding or removing elements?

Transforming tensors as multidimensional data arrays Medium
A. (4, 6)
B. (3, 9)
C. (2, 4, 4)
D. (5, 5)

34 An image batch uses NHWC shape (batch, height, width, channels). Which permutation changes it to NCHW order?

Transforming tensors as multidimensional data arrays Medium
A. perm=[0, 3, 1, 2]
B. perm=[0, 2, 3, 1]
C. perm=[3, 0, 1, 2]
D. perm=[1, 2, 0, 3]

35 A researcher wants to compare training and validation loss over epochs in TensorBoard. What should be recorded?

Visualization with TensorBoard Medium
A. Image summaries with one shared tag
B. Histogram summaries containing labels
C. Text summaries containing model weights
D. Scalar summaries with separate tags

36 TensorBoard opens successfully but shows no experiment data. The model wrote summaries to /tmp/run1. What should be checked first?

Visualization with TensorBoard Medium
A. TensorBoard uses /tmp/run1 as its log directory
B. The input tensor has a batch dimension
C. The optimizer uses an adaptive learning rate
D. The model contains at least one convolutional layer

37 Why are nonlinear activation functions placed between layers of a deep neural network?

Introduction to Deep Learning Medium
A. They let the network learn nonlinear mappings
B. They guarantee that training reaches zero loss
C. They force every layer to have equal width
D. They replace the need for trainable parameters

38 A neural network performs well on training data but poorly on unseen data. Which change is most directly intended to reduce this problem?

Introduction to Deep Learning Medium
A. Remove the validation dataset
B. Use only linear activation functions
C. Add dropout or weight regularization
D. Increase the training set loss

39 A system must identify pedestrians and draw a bounding box around each one in an image. Which deep learning task best matches this requirement?

Applications of Deep Learning Medium
A. Object detection
B. Image classification
C. Text generation
D. Feature normalization

40 A company wants to translate customer messages from one language into another while accounting for relationships between distant words. Which model family is especially suitable?

Applications of Deep Learning Medium
A. Transformer network
B. Decision stump model
C. Linear regression model
D. K-means clustering model

41 A TensorFlow function receives a tensor x and computes y = x * 2 + 1. When x has shape (32, 10), which statement best explains TensorFlow's behavior?

Introduction to TensorFlow Hard
A. The operation applies independently to every element using broadcasting-compatible rules
B. The operation transposes the tensor before applying the arithmetic
C. The operation requires a separate graph for every batch element
D. The operation reduces each row to a single scalar before multiplication

42 A project requires TensorFlow with GPU acceleration, but another project requires a different CUDA-compatible configuration. Which installation strategy most reliably prevents dependency conflicts?

Installation of TensorFlow Hard
A. Install both projects into the system Python environment
B. Install the newest CUDA toolkit globally for both projects
C. Copy TensorFlow packages manually between project directories
D. Use separate isolated environments with project-specific TensorFlow dependencies

43 A tensor has shape (8, 28, 28, 3) and represents a batch of color images. Which interpretation is correct under the conventional channels-last layout?

TensorFlow ranks and tensors Hard
A. Rank 4, with dimensions for channels, batch, height, and width
B. Rank 3, with dimensions for height, width, and channels
C. Rank 4, with dimensions for batch, height, width, and channels
D. Rank 5, because each pixel contains three channel values

44 Given a with shape (2, 1, 4) and b with shape (3, 4), what is the shape of a + b if broadcasting succeeds?

TensorFlow ranks and tensors Hard
A. (2, 3, 4)
B. The addition is invalid because the ranks differ
C. (3, 2, 4)
D. (2, 1, 4)

45 A function decorated with @tf.function is called first with a tensor of shape (16, 10) and later with shape (32, 10). What is the most accurate consequence?

TensorFlow's computation graphs Hard
A. The second call permanently changes the first graph's tensor shapes
B. TensorFlow may trace additional concrete functions for the new input signature
C. The function automatically switches all tensors to NumPy arrays
D. The first graph is always reused without considering shape

46 Inside a @tf.function, a Python if depends on a tensor-valued condition. Which implementation is generally required for graph-compatible control flow?

TensorFlow's computation graphs Hard
A. Evaluate the condition only during model construction
B. Replace the condition with a random Boolean tensor
C. Use tf.cond or a tensor-aware control-flow construct
D. Convert the condition to a Python Boolean with bool

47 A trainable parameter is created as a tf.Variable, but its update is performed using assign_sub outside the gradient tape. Which statement is correct?

Variables in TensorFlow Hard
A. The variable changes, but the assignment is not itself differentiated as a model operation
B. The update is impossible because variables are immutable tensors
C. The assignment converts the variable into a constant tensor
D. The update automatically computes gradients for every earlier operation

48 Why should model weights generally be stored as tf.Variable objects rather than ordinary tensors?

Variables in TensorFlow Hard
A. Variables preserve mutable state and can be tracked as trainable parameters
B. Variables prevent all numerical overflow during training
C. Variables automatically select the optimal model architecture
D. Variables always require less memory than tensors

49 For a parameter with gradient , how does Adam differ fundamentally from vanilla stochastic gradient descent?

TensorFlow optimizers Hard
A. Adam maintains moving estimates of first and second gradient moments
B. Adam uses only the sign of the current gradient
C. Adam removes the need to compute gradients through backpropagation
D. Adam applies one fixed update to every parameter regardless of history

50 A training step computes gradients for a model, but one gradient is None. Which cause is most plausible?

TensorFlow optimizers Hard
A. The batch size is larger than one
B. The loss is represented by a scalar tensor
C. The variable is not connected to the computed loss
D. The optimizer learning rate is a positive value

51 A model is trained with a learning rate that is too large. Which pattern most strongly indicates unstable optimization rather than ordinary underfitting?

TensorFlow optimizers Hard
A. Training and validation losses decrease slowly
B. Training loss oscillates or becomes NaN after large updates
C. Training accuracy improves while validation accuracy remains lower
D. Both losses decrease and then plateau near their expected values

52 A tensor has shape (64, 28, 28, 1) and must be fed into a dense layer that expects one feature vector per example. Which transformation is appropriate?

Transforming tensors as multidimensional data arrays Hard
A. tf.reshape(x, [1, 64, 784])
B. tf.reshape(x, [64, 28, 28, 1, 1])
C. tf.reshape(x, [64, 28, 28])
D. tf.reshape(x, [64, 784])

53 For a tensor x with shape (2, 3, 4), which operation changes its shape to (2, 4, 3) while preserving the arrangement of values along the last two axes?

Transforming tensors as multidimensional data arrays Hard
A. tf.expand_dims(x, axis=2)
B. tf.squeeze(x, axis=1)
C. tf.reshape(x, [2, 4, 3])
D. tf.transpose(x, perm=[0, 2, 1])

54 A tensor has shape (5, 1, 7, 1). Which operation produces shape (5, 7) without changing the values in the remaining dimensions?

Transforming tensors as multidimensional data arrays Hard
A. tf.squeeze(x, axis=[1, 3])
B. tf.squeeze(x)
C. tf.reduce_sum(x, axis=1)
D. tf.reshape(x, [1, 35])

55 A TensorBoard scalar summary is written inside a training loop, but the dashboard shows only one point. Which issue is most likely?

Visualization with TensorBoard Hard
A. The writer was never flushed or closed
B. The loss was computed from a floating-point tensor
C. The scalar name contains a slash
D. The step value is constant for every recorded value

56 Two training runs use the same TensorBoard log directory and identical tag names. What is the main visualization risk?

Visualization with TensorBoard Hard
A. Events from separate runs may be mixed or become difficult to compare
B. TensorBoard converts all logged values into histograms
C. TensorBoard automatically averages all runs into one model
D. The second run cannot write any scalar summaries

57 Why can adding more layers increase a network's representational power while still making optimization harder?

Introduction to Deep Learning Hard
A. Additional layers force every parameter to use the same gradient
B. Composed transformations prevent the use of minibatch training
C. Additional layers eliminate all nonlinear behavior
D. Composed transformations can represent complex functions but may create vanishing or exploding gradients

58 A classifier achieves 99% training accuracy but performs poorly on unseen data. Which intervention most directly targets the underlying generalization problem?

Introduction to Deep Learning Hard
A. Increase model capacity while preserving the same training procedure
B. Use regularization, augmentation, or early stopping based on validation behavior
C. Increase the number of epochs without changing anything else
D. Remove the validation set to maximize training examples

59 In a medical image classifier, a rare disease is associated with much higher cost for false negatives than false positives. Which design choice best reflects this requirement?

Applications of Deep Learning Hard
A. Discard rare positive examples to reduce label noise
B. Use class-sensitive training or threshold selection emphasizing recall
C. Choose the threshold that maximizes the number of negative predictions
D. Optimize only raw accuracy at the default threshold

60 A vision model performs well on laboratory images but poorly on images captured by a different hospital. What is the most defensible first response?

Applications of Deep Learning Hard
A. Evaluate distribution shift and validate using representative target-domain data
B. Remove preprocessing so the model sees raw pixel values
C. Assume the model is unbiased because laboratory accuracy was high
D. Increase the classification threshold for every class automatically