Unit 2: Building Models with Keras - Practice Quiz
1 What is Keras mainly used for?
2
Which command is commonly used to install Keras with pip?
pip install keras
python add keras
install keras
pip get keras
3 Which Keras class is often used to build a model layer by layer?
Dataset
Pipeline
Sequential
Cluster
4 What does a dense layer do in a neural network?
5 What type of output is usually produced by a regression model?
6 Which loss function is commonly used for regression in Keras?
7 What does MLP stand for?
8 For a binary classification task, what activation is often used in the output layer?
9 What kind of data is image classification designed to predict?
10 Which layer is commonly used to work with image data in Keras models?
11 What is a common first step in text classification?
12 Which Keras layer is often used to turn word indices into dense vectors?
13 What does overfitting mean?
14 What is a common method to reduce overfitting?
15 Why do we save a trained Keras model?
16 Which function is used to load a saved Keras model?
load_model()
read_model()
get_model()
open_model()
17 What is a hyperparameter?
18 Which of the following is a hyperparameter?
19 What is NVIDIA DGX Station A100 primarily designed for?
20 Which component is a key part of the DGX Station A100 hardware architecture?
21 A developer wants to train, validate, and generate predictions from a neural network without manually writing the complete training loop. Which Keras feature most directly supports this requirement?
Device, Graph, and Session utilities
GradientTape, Variable, and Module classes
Dataset, Iterator, and TensorSpec classes
fit(), evaluate(), and predict() methods
22 A student wants to use TensorFlow-backed Keras in a new Python virtual environment. Which installation and import combination is most appropriate?
pip install cuda, followed by from cuda import keras
pip install pytorch, followed by from pytorch import keras
pip install tensorflow, followed by from tensorflow import keras
pip install numpy, followed by import numpy.keras
23 A neural network must accept an image and a metadata vector as separate inputs before combining them. Which Keras model-building approach is most suitable?
Dense layer with no input declaration
Sequential model with only one input tensor
24
A Dense layer has 32 input features and 64 output units, with one bias per output unit. How many trainable parameters does it contain?
25 A Keras model predicts unrestricted real-valued house prices. Which output layer and loss function are most appropriate?
Dense(1, activation="sigmoid") with binary cross-entropy
Dense(2, activation="relu") with sparse cross-entropy
Dense(1, activation="softmax") with categorical cross-entropy
Dense(1, activation="linear") with mean squared error
26
Before training a regression model, a normalization layer must learn the mean and variance of each feature. Which data should be passed to the layer's adapt() method?
27 An MLP classifies samples into five mutually exclusive classes, and the labels are integers from 0 to 4. Which configuration is appropriate for the output layer and loss?
28
A Conv2D layer receives an RGB image represented as a single sample using Keras's default channels-last format. Which input shape should be specified for a image?
(3, 128, 128)
(128, 3, 128)
(128, 128, 3)
(1, 128, 128)
29 A small image dataset causes a CNN to memorize training images. Which Keras strategy can increase input diversity without permanently creating additional image files?
30 Text sequences in a batch are padded with zeros to obtain equal lengths. Which configuration helps an embedding-based model ignore those padding positions?
Embedding(..., mask_zero=True)
Dense(..., use_bias=False)
Flatten(..., data_format="channels_last")
Dropout(..., noise_shape=None)
31 A text classifier assigns each document to exactly one of four categories, and the targets are one-hot encoded. Which final layer and loss should be used?
32 During training, the training loss keeps decreasing, but the validation loss begins increasing after epoch 12. What does this pattern most strongly indicate?
33 A developer wants to save a trained Keras model so that its architecture, weights, and optimizer state can later be restored together. Which approach is most appropriate?
numpy.save()
model.save("model.keras")
model.get_config()
model.summary()
34 A tuner is comparing learning rates of , , and . Which evaluation procedure best avoids optimistic bias?
35 Which workload is the strongest match for an NVIDIA DGX Station A100 rather than a conventional office workstation?
36 A research team needs data-center-class AI computing in a local office without installing a full server rack. Why is DGX Station A100 suitable?
37 A model is distributed across the multiple A100 GPUs in a DGX Station A100 and frequently transfers tensors between GPUs. Which hardware feature primarily accelerates these transfers?
38 A team wants a tested container containing a deep learning framework and GPU-optimized dependencies for DGX Station A100. Which NVIDIA resource is most appropriate?
39 A developer needs to compile a custom CUDA kernel for use in a deep learning operation. Which CUDA Toolkit component performs the CUDA source compilation?
nvidia-smi monitor
git version controller
pip package manager
nvcc compiler
40 A company prototypes models locally on DGX Station A100 and later moves them to larger NVIDIA-based infrastructure. Which practice best supports this scaling path?
41 A Keras Functional model applies the same encoder instance to two different inputs and then combines the resulting embeddings. Which statement correctly describes training behavior?
42 A developer installs Keras 3 in a fresh environment and wants to run it with the JAX backend rather than TensorFlow. Which setup is correct?
keras package because it contains complete copies of TensorFlow, JAX, and PyTorch together with their GPU runtimes.
keras.backend = "jax".
KERAS_BACKEND=jax before importing Keras.
43 A two-output Keras model is compiled with losses and , loss weights and , and several layer regularizers producing penalties . Ignoring metric values, what objective is minimized?
44
A subclassed Keras layer creates a new trainable matrix inside call() every time it receives an input. This causes state-creation and tracing errors. What is the most appropriate redesign?
compile() because compilation owns all trainable state.
call() and manually differentiate it.
add_weight() in build() using the input shape.
call(), but assign a globally unique name on every invocation so that Keras can distinguish all copies.
45 Regression targets are standardized as , where . A model achieves an MSE of in standardized target space. What is its MSE after predictions are converted back to the original units?
46 A regression network models heteroscedastic Gaussian noise by outputting a mean and . Ignoring constants, which per-example loss is the Gaussian negative log-likelihood?
47 An MLP performs three-class classification with integer labels in . Its output layer returns three unrestricted values with no activation. Which loss configuration is mathematically consistent and numerically stable?
BinaryCrossentropy(from_logits=True)
MeanSquaredError() after converting labels to integers
SparseCategoricalCrossentropy(from_logits=True)
CategoricalCrossentropy(from_logits=False)
48 A pretrained image backbone is frozen, but validation accuracy is unexpectedly poor. The new dataset is supplied in , whereas the backbone was trained with a different normalization convention. What is the best correction?
49
An input pipeline is ordered as dataset.map(random_augment).cache().shuffle(...).batch(...). After the first epoch, each image receives the same augmentation repeatedly. Which change preserves caching while generating fresh stochastic augmentations?
dataset.map(random_augment).batch(...).cache().shuffle(...).
dataset.map(random_augment).cache().repeat().batch(...).
dataset.shuffle(...).map(random_augment).cache().batch(...).
dataset.cache().shuffle(...).map(random_augment).batch(...).
50
Sequences are padded with token ID 0, and Embedding(mask_zero=True) is used. Which architecture can automatically exclude padding positions when aggregating sequence features?
Embedding(mask_zero=True) → GlobalAveragePooling1D → Dense
Embedding(mask_zero=True) → Flatten → Dense
Embedding(mask_zero=True) → Lambda(simple_mean) → Dense
Embedding(mask_zero=True) → Conv1D → GlobalMaxPooling1D
51
A TextVectorization layer is adapted on the entire corpus before the data is split. Why can this make the reported validation result optimistic, and what is the correct procedure?
52
During fit(), training loss is consistently higher than validation loss. The model uses strong data augmentation and dropout. Which diagnostic best determines whether this is an artifact of different execution conditions rather than underfitting?
training=False and compare it with validation evaluation.
53
A model containing a custom layer must be saved in the native Keras format and loaded without passing a custom_objects dictionary. Which implementation is most appropriate?
get_config() for its constructor arguments.
call() to return the constructor arguments together with the output tensor.
54 Hundreds of hyperparameter configurations are compared on the same validation set, and the best one is reported using that validation score. What is the strongest evaluation design for reducing selection bias?
55 A DGX Station A100 has its GPUs partitioned into Multi-Instance GPU instances for several independent users. A new job requires the maximum resources of complete GPUs and high-bandwidth multi-GPU communication. What should the administrator do?
56 Which use case most directly reflects the purpose of the NVIDIA DGX Station A100?
57 A model is placed on multiple A100 GPUs connected by NVLink, but a single-GPU Keras script still uses only one GPU. Which statement best explains this result?
58 A CUDA-enabled NGC container includes its own user-space CUDA libraries. What host-side compatibility condition is still essential on a DGX Station A100?
59
A custom CUDA operation built for older GPUs fails on an A100 with no kernel image is available for execution on the device. What is the most direct build-level remedy?
sm_70 because all Tensor Core GPUs use the same binary.
sm_80 or compatible compute_80 PTX.
60 An organization wants future AI workloads to share a DGX Station efficiently while preserving isolation between teams. Which strategy is most technically sound?
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →