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. Building and training machine learning models
B. Designing relational database tables
C. Creating computer operating systems
D. Managing physical network devices

2 Which organization originally developed TensorFlow?

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

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

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

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

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

5 What is the rank of a scalar tensor?

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

6 Which description best matches a rank-2 tensor?

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

7 What does a TensorFlow computation graph represent?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

15 What is TensorBoard mainly used for?

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

16 Which training metric is commonly plotted in TensorBoard?

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

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. Web development using style sheets
D. Database management using linked tables

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. File compression
B. Image classification
C. Disk formatting
D. Spreadsheet sorting

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

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

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.data.Dataset
C. tf.saved_model
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.summary
B. tf.math
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. Install both versions globally
B. Rename the TensorFlow package
C. Disable dependency checking
D. Use a separate virtual environment

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. pip build tensorflow --version
C. python -c "import tensorflow as tf; print(tf.__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 4 and batch size 28
B. Rank 5 and batch size 32
C. Rank 4 and batch size 32
D. Rank 3 and batch size 28

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, 2)
B. (4, 3)
C. (4, 2)
D. (3, 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 converts tensors into NumPy arrays
B. It traces operations into an optimized graph
C. It removes the need for input data
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. Provide a suitable input signature
D. Disable all TensorFlow optimizers

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.Variable
B. tf.Operation
C. tf.TensorSpec
D. tf.constant

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. w.assign_add(eta * g)
B. w.assign_sub(eta * g)
C. w = tf.constant(eta * g)
D. g.assign_sub(eta * w)

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. Batch normalization
B. Mean squared error
C. Adam
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. (2, 4, 4)
B. (5, 5)
C. (3, 9)
D. (4, 6)

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, 2, 3, 1]
B. perm=[1, 2, 0, 3]
C. perm=[0, 3, 1, 2]
D. perm=[3, 0, 1, 2]

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

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

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. The input tensor has a batch dimension
B. The optimizer uses an adaptive learning rate
C. The model contains at least one convolutional layer
D. TensorBoard uses /tmp/run1 as its log directory

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 replace the need for trainable parameters
D. They force every layer to have equal width

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. Increase the training set loss
B. Remove the validation dataset
C. Add dropout or weight regularization
D. Use only linear activation functions

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. Image classification
B. Feature normalization
C. Text generation
D. Object detection

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 reduces each row to a single scalar before multiplication
C. The operation requires a separate graph for every batch element
D. The operation transposes the tensor before applying the arithmetic

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. Use separate isolated environments with project-specific TensorFlow dependencies
B. Copy TensorFlow packages manually between project directories
C. Install both projects into the system Python environment
D. Install the newest CUDA toolkit globally for both projects

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 5, because each pixel contains three channel values
D. Rank 4, with dimensions for batch, height, width, and channels

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. (3, 2, 4)
B. (2, 1, 4)
C. (2, 3, 4)
D. The addition is invalid because the ranks differ

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 first graph is always reused without considering shape
B. TensorFlow may trace additional concrete functions for the new input signature
C. The function automatically switches all tensors to NumPy arrays
D. The second call permanently changes the first graph's tensor shapes

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. Use tf.cond or a tensor-aware control-flow construct
B. Replace the condition with a random Boolean tensor
C. Evaluate the condition only during model construction
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 update automatically computes gradients for every earlier operation
B. The assignment converts the variable into a constant tensor
C. The update is impossible because variables are immutable tensors
D. The variable changes, but the assignment is not itself differentiated as a model operation

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

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

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

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

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

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

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 accuracy improves while validation accuracy remains lower
B. Training loss oscillates or becomes NaN after large updates
C. Training and validation losses decrease slowly
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, [64, 784])
B. tf.reshape(x, [1, 64, 784])
C. tf.reshape(x, [64, 28, 28])
D. tf.reshape(x, [64, 28, 28, 1, 1])

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.reshape(x, [2, 4, 3])
B. tf.squeeze(x, axis=1)
C. tf.expand_dims(x, axis=2)
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.reshape(x, [1, 35])
B. tf.squeeze(x, axis=[1, 3])
C. tf.squeeze(x)
D. tf.reduce_sum(x, axis=1)

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 step value is constant for every recorded value
B. The writer was never flushed or closed
C. The scalar name contains a slash
D. The loss was computed from a floating-point tensor

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. TensorBoard automatically averages all runs into one model
B. TensorBoard converts all logged values into histograms
C. Events from separate runs may be mixed or become difficult to compare
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. Composed transformations can represent complex functions but may create vanishing or exploding gradients
B. Additional layers eliminate all nonlinear behavior
C. Additional layers force every parameter to use the same gradient
D. Composed transformations prevent the use of minibatch training

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. Use regularization, augmentation, or early stopping based on validation behavior
B. Remove the validation set to maximize training examples
C. Increase model capacity while preserving the same training procedure
D. Increase the number of epochs without changing anything else

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. Optimize only raw accuracy at the default threshold
B. Choose the threshold that maximizes the number of negative predictions
C. Discard rare positive examples to reduce label noise
D. Use class-sensitive training or threshold selection emphasizing recall

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. Increase the classification threshold for every class automatically
D. Assume the model is unbiased because laboratory accuracy was high