Skip to content

Graded Quiz: Advanced Keras Functionalities :Deep Learning with Keras and Tensorflow (IBM AI Engineering Professional Certificate) Answers 2025

1. Question 1 — Keras Functional API

  • It allows the creation of models with multiple inputs and outputs.

  • ❌ It only supports sequential models.

  • ❌ It simplifies code compared to Sequential API.

  • ❌ It cannot be used to create shared layers.

Explanation:
The Functional API enables multi-input, multi-output, and shared-layer architectures.


2. Question 2 — Method to override for forward pass

  • ❌ compile

  • call

  • ❌ build

  • init

Explanation:
call() defines forward pass logic in custom layers.


3. Question 3 — Input layer definition

  • ❌ Dense(784)

  • ❌ Dense(shape=(784,))

  • ❌ InputLayer(shape=(784,))

  • Input(shape=(784,))

Explanation:
Use Input() to create the input tensor for Functional models.


4. Question 4 — Custom layer creation

  • ❌ Cannot have trainable weights

  • Created by subclassing the Layer class

  • ❌ Cannot use activation

  • ❌ Must implement compile

Explanation:
Custom layers subclass tf.keras.layers.Layer.


5. Question 5 — Purpose of build()

  • ❌ Compile the model

  • ❌ Define forward pass

  • Create and initialize the layer’s weights

  • ❌ Initialize attributes

Explanation:
build() creates weights based on input shape.


6. Question 6 — Adding a dense layer with ReLU

  • ❌ Defining in Sequential

  • Using the Dense class with activation

  • ❌ Subclass Model

  • ❌ Subclass Layer (overkill for this task)

Correct usage:

Dense(units, activation='relu')

7. Question 7 — Key benefit of Functional API

  • ❌ Simplifies single-input models

  • ❌ Easier debugging

  • ❌ Faster training

  • Allows complex models (multi-input / multi-output)

Explanation:
Functional API is designed for non-linear architectures.


8. Question 8 — Purpose of add_weight

  • To create and initialize weights for the custom layer

  • ❌ Add new input

  • ❌ Add new layer

  • ❌ Compile the model

Explanation:
add_weight() creates trainable/untrainable variables used by the layer.


9. Question 9 — TF feature enabling immediate execution

  • Eager execution

  • ❌ Scalability

  • ❌ High-level APIs

  • ❌ Rich ecosystem

Explanation:
Eager execution runs TensorFlow ops immediately, useful for debugging.


10. Question 10 — Role of Input()

  • ❌ Initialize weights

  • ❌ Compile model

  • ❌ Define custom layer

  • Define input tensor for the model

Explanation:
Input() describes the shape and dtype of model inputs in the Functional API.


🧾 Summary Table

Q# Correct Answer
1 Functional API allows multi-input/output
2 call
3 Input(shape=(784,))
4 Subclass Layer
5 Create weights
6 Dense(…, activation=’relu’)
7 Build complex models
8 Create layer weights
9 Eager execution
10 Define input tensor