wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Week3_S2

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is one key advantage of using TensorFlow's Data API for loading and preprocessing data?

a)

It only works with data already stored as TensorFlow Tensor objects

b)

It requires the entire dataset to be loaded into memory as a NumPy array before processing.

c)
  • It lacks support for data shuffling or parallel data loading.

d)

It can easily read data from various sources and apply transformations in just a few lines of code.

2.

In tf.data pipelines, what happens when you call a transformation method (like batch() or shuffle()) on a Dataset?

a)

It modifies the existing Dataset in-place.

b)

It returns a new Dataset with the transformation applied, leaving the original Dataset unchanged.

c)

It copies all the data into a new data structure immediately.

d)

It has no effect until you explicitly convert the Dataset to a list.

3.

Which tf.data method should you use to apply a custom preprocessing function to each element of a Dataset?

a)

map() – to transform each element using a function.

b)

filter() – to remove elements based on a condition.

c)

batch() – to combine elements into batches.

d)

apply() – to directly modify the Dataset in place.

4.

How can you remove data entries that don’t meet a certain condition using the tf.data API?

a)

Use map() with a condition to skip elements.

b)

Use the filter() method with a boolean function to drop unwanted items.

c)

Use skip() to skip any false elements.

d)

Manually iterate and discard items; tf.data cannot do this.

5.

In the context of tf.data, what does the shuffle(buffer_size) operation do?

a)

It sorts the dataset elements in ascending order up to the buffer size.

b)

It loads the entire dataset into memory and performs a perfect shuffle of all elements.

c)

It maintains a buffer of buffer_size elements and randomly selects the next element from that buffer, replenishing it from the source, to produce a shuffled stream.

d)

It repeats the dataset buffer_size times in random order.

6.

Why is using prefetch(1) at the end of a tf.data pipeline beneficial for training performance?

a)

It has no effect unless you are using a GPU.

b)

It automatically parallelizes the model across multiple GPUs.

c)

It caches the entire dataset in memory before training starts.

d)

It overlaps data preparation with model training by always having the next batch ready in advance.

7.

Why use a deep neural network (multiple hidden layers) instead of a shallow one (single hidden layer)?

a)

deep networks never overfit, whereas shallow ones do.

b)

deep networks can model complex functions with far fewer neurons by learning hierarchical features.

c)

deep networks require no tuning of hyperparameters.

d)

a single hidden layer cannot approximate complex functions at all.

8.

How do you use a trained Keras model to make predictions on new data?

a)

Use model.evaluate(new_X, new_y) and read off the predictions from the loss

b)

Re-compile the model with the new data as training data.

c)

Call the model’s predict method on the new input data (e.g. model.predict(new_X))

d)

Add the new data to the model’s training set and call model.fit again for one epoch.

9.

Which scenario is not a clear sign that your model is overfitting the data?

a)

The model performs poorly on both training and validation sets.

b)

The model performs much better on the training set than on the validation set

c)

Training accuracy and validation accuracy are both high and very close to each other.

d)

Adding more training data causes the validation performance to improve.

10.

If your model is performing poorly even on the training data (much error on the training set), what is this situation called, and what does it imply?

a)

It is underfitting, implying the model is too simple or not trained enough to capture the patterns in the training data.

b)

It is overfitting, implying the model memorized the training data and is failing to generalize.

c)

It means the model has a bug – a well-configured neural network should always fit the training data almost perfectly.

d)

It implies perfect generalization, because low training performance often means high test performance.