1. Home
  2. Data Science
  3. TensorFlow
  4. Which two arguments must be provided to model.compile()…

Added 2 Nov 2026

Which two arguments must be provided to model.compile() before training a Keras model?

  1. A learning rate and a batch size
  2. A dataset and the number of epochs
  3. An input shape and an output layer
  4. An optimizer and a loss function Correct answer

Correct answer

D. An optimizer and a loss function

19 views

MCQSEXAM

Explanation

compile() sets how weights are updated (optimizer) and what is minimised (loss). Metrics are optional, and epochs and batch size go in fit().

Reference

Asked in: Data Science Interviews, AI Engineer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More TensorFlow MCQs

Practise all TensorFlow MCQs

Similar MCQs