Dockerfile MCQs with answers Page - 7

You will find multiple-choice questions (MCQs) related to #Dockerfile here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 802.91K Points
Coach

Q. What does each line in a Dockerfile represent?

  • (A) A new container
  • (B) A new file
  • (C) A new layer
  • (D) A new variable

A

Admin • 802.91K Points
Coach

Q. What flag skips the cache when building a Docker image?

  • (A) --skip-cache
  • (B) --no-cache
  • (C) --build-clean
  • (D) --ignore-cache

A

Admin • 802.91K Points
Coach

Q. What is the default shell used by `RUN` in a Dockerfile?

  • (A) bash
  • (B) zsh
  • (C) /bin/sh -c
  • (D) /bin/bash

A

Admin • 802.91K Points
Coach

Q. Which instruction is used to configure the container at runtime?

  • (A) ENV
  • (B) RUN
  • (C) CMD
  • (D) LABEL

A

Admin • 802.91K Points
Coach

Q. What should you do to reduce image size?

  • (A) Use multiple RUN statements
  • (B) Use base image with GUI
  • (C) Use multi-stage builds
  • (D) Use MAINTAINER

A

Admin • 802.91K Points
Coach

Q. Can a Dockerfile contain comments?

  • (A) No
  • (B) Yes, using //
  • (C) Yes, using #
  • (D) Yes, using ;

A

Admin • 802.91K Points
Coach

Q. Which instruction should be placed at the beginning of a Dockerfile?

  • (A) CMD
  • (B) RUN
  • (C) COPY
  • (D) FROM
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More