1What is the primary function of Docker in the context of microservices?
A.To manage physical hardware resources manually
B.To act as a web server for static files
C.To package applications and dependencies into a portable container
D.To replace the need for an operating system
Correct Answer: To package applications and dependencies into a portable container
Explanation:
Docker allows developers to package an application with all of its dependencies into a standardized unit called a container, ensuring consistency across environments.
Incorrect! Try again.
2Which of the following describes a key difference between Virtual Machines (VMs) and Containers?
A.VMs spin up faster than containers
B.Containers have their own guest operating system, while VMs share the host OS
C.Containers share the host OS kernel, while VMs include a full guest OS
D.VMs are more lightweight than containers
Correct Answer: Containers share the host OS kernel, while VMs include a full guest OS
Explanation:
Containers are lightweight because they share the machine's OS system kernel and therefore do not require an OS per application, unlike VMs.
Incorrect! Try again.
3What is a Docker Image?
A.A read-only template used to create containers
B.A writable layer on top of a file system
C.A database used by Docker
D.A running instance of a container
Correct Answer: A read-only template used to create containers
Explanation:
A Docker image is an immutable (read-only) file that contains the source code, libraries, dependencies, tools, and other files needed for an application to run.
Incorrect! Try again.
4Which file is used to define the instructions for building a Docker image?
A.docker-compose.yml
B.package.json
C.container.conf
D.Dockerfile
Correct Answer: Dockerfile
Explanation:
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
Incorrect! Try again.
5In a Dockerfile, which instruction initializes a new build stage and sets the base image?
A.BASE
B.FROM
C.START
D.IMPORT
Correct Answer: FROM
Explanation:
The FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions.
Incorrect! Try again.
6What is the purpose of the 'EXPOSE' instruction in a Dockerfile?
A.It documents that the container listens on the specified network ports at runtime
B.It creates a security vulnerability
C.It downloads external dependencies
D.It publishes the port to the host machine automatically
Correct Answer: It documents that the container listens on the specified network ports at runtime
Explanation:
EXPOSE functions as a type of documentation between the person who builds the image and the person who runs the container, indicating which ports are intended to be published.
Incorrect! Try again.
7Which Docker command is used to list all currently running containers?
A.docker run
B.docker images
C.docker ps
D.docker list
Correct Answer: docker ps
Explanation:
The 'docker ps' command lists the containers that are currently running. Adding '-a' would show stopped containers as well.
Incorrect! Try again.
8What is Container Orchestration?
A.The automated management of the lifecycle of containers
B.The manual installation of Docker on servers
C.The creation of virtual machines
D.The process of writing code for microservices
Correct Answer: The automated management of the lifecycle of containers
Explanation:
Container orchestration handles the automation of tasks such as scheduling, deploying, scaling, load balancing, and managing the health of containers.
Incorrect! Try again.
9Which of the following is the most popular open-source platform for container orchestration?
A.Ansible
B.Jenkins
C.Nagios
D.Kubernetes
Correct Answer: Kubernetes
Explanation:
Kubernetes (K8s) is the industry standard open-source platform for automating deployment, scaling, and management of containerized applications.
Incorrect! Try again.
10In Kubernetes architecture, what is a 'Pod'?
A.A network firewall rule
B.The master node controller
C.A storage volume
D.The smallest deployable unit used to encapsulate one or more containers
Correct Answer: The smallest deployable unit used to encapsulate one or more containers
Explanation:
A Pod is the basic execution unit of a Kubernetes application, representing a single instance of a running process in your cluster.
Incorrect! Try again.
11What is the role of the 'Control Plane' (formerly Master Node) in Kubernetes?
A.To provide storage to containers
B.To run the actual application workloads
C.To manage the cluster, schedule pods, and maintain the desired state
D.To act as a load balancer for external traffic only
Correct Answer: To manage the cluster, schedule pods, and maintain the desired state
Explanation:
The Control Plane makes global decisions about the cluster (like scheduling) and detects/responds to cluster events.
Incorrect! Try again.
12Which component of the Kubernetes Control Plane is a key-value store used for all cluster data?
A.etcd
B.controller-manager
C.kube-scheduler
D.kube-proxy
Correct Answer: etcd
Explanation:
etcd is a consistent and highly-available key-value store used as Kubernetes' backing store for all cluster data.
Incorrect! Try again.
13What is the function of the 'kube-scheduler'?
A.It assigns newly created Pods to nodes based on resource availability and constraints
B.It stores the cluster state
C.It exposes the Kubernetes API
D.It executes the containers on the node
Correct Answer: It assigns newly created Pods to nodes based on resource availability and constraints
Explanation:
The scheduler watches for newly created Pods with no assigned node and selects a node for them to run on.
Incorrect! Try again.
14Which agent runs on every Kubernetes node and ensures that containers are running in a Pod?
A.kubelet
B.etcd
C.kube-apiserver
D.Cloud Controller Manager
Correct Answer: kubelet
Explanation:
The kubelet is the primary 'node agent' that runs on each node and ensures that containers described in PodSpecs are running and healthy.
Incorrect! Try again.
15What is a 'Service' in Kubernetes?
A.A script that runs during startup
B.A background process in the Linux OS
C.A tool for building Docker images
D.An abstraction that defines a logical set of Pods and a policy to access them
Correct Answer: An abstraction that defines a logical set of Pods and a policy to access them
Explanation:
A Kubernetes Service enables network access to a set of Pods, often providing load balancing and a stable IP address.
Incorrect! Try again.
16Which command line tool is used to communicate with the Kubernetes cluster?
A.docker-cli
B.k8s-run
C.kube-admin
D.kubectl
Correct Answer: kubectl
Explanation:
kubectl is the command-line interface for running commands against Kubernetes clusters.
Incorrect! Try again.
17What is the purpose of 'Continuous Integration' (CI)?
A.To deploy applications to production once a year
B.To manually compile code before release
C.To manage the physical servers in a data center
D.To automate the merging of code changes into a shared repository and running tests
Correct Answer: To automate the merging of code changes into a shared repository and running tests
Explanation:
CI is the practice of automating the integration of code changes from multiple contributors into a single software project, usually accompanied by automated builds and tests.
Incorrect! Try again.
18Which of the following is a benefit of Continuous Integration?
A.It slows down the development process
B.It eliminates the need for version control
C.It allows developers to work in isolation for months
D.It detects integration errors early in the development cycle
Correct Answer: It detects integration errors early in the development cycle
Explanation:
By integrating frequently, errors are detected immediately by automated tests, making them easier to fix.
Incorrect! Try again.
19In the context of CI/CD, what is a 'Build Artifact'?
A.A bug found during testing
B.A compiled and packaged file (like a JAR or Docker Image) ready for deployment
C.The source code file
D.The documentation of the project
Correct Answer: A compiled and packaged file (like a JAR or Docker Image) ready for deployment
Explanation:
An artifact is the byproduct produced during the software build process, such as a binary, library, or container image.
Incorrect! Try again.
20What is the difference between 'ADD' and 'COPY' in a Dockerfile?
A.ADD allows extracting tar files and downloading URLs, while COPY only copies local files
B.COPY is deprecated; ADD is the new standard
C.There is no functional difference
D.COPY is for Linux, ADD is for Windows
Correct Answer: ADD allows extracting tar files and downloading URLs, while COPY only copies local files
Explanation:
COPY is preferred for basic file copying. ADD has extra features like remote URL support and auto-extraction of tar archives.
Incorrect! Try again.
21What is a 'Deployment' in Kubernetes?
A.A network policy
B.A resource object that manages ReplicaSets and provides declarative updates to Pods
C.A one-time job execution
D.A method to install Kubernetes
Correct Answer: A resource object that manages ReplicaSets and provides declarative updates to Pods
Explanation:
A Deployment provides declarative updates for Pods and ReplicaSets, allowing you to describe the desired state (e.g., image version, replica count).
Incorrect! Try again.
22Which Kubernetes concept is used to isolate resources within the same cluster?
A.Nodes
B.Volumes
C.Namespaces
D.Ingress
Correct Answer: Namespaces
Explanation:
Namespaces provide a mechanism for isolating groups of resources within a single cluster, often used for multi-tenancy or separating environments (dev/test/prod).
Incorrect! Try again.
23What is 'Rolling Update' in the context of microservices deployment?
A.Deploying the new version to a separate environment for testing only
B.Gradually replacing instances of the old version with the new version
C.Shutting down all instances and starting new ones simultaneously
D.Reverting to a previous version manually
Correct Answer: Gradually replacing instances of the old version with the new version
Explanation:
Rolling updates allow deployments' updates to take place with zero downtime by incrementally updating Pods instances with new ones.
Incorrect! Try again.
24What is the purpose of a '.dockerignore' file?
A.To list the files that should be included in the image
B.To specify files and directories that should be excluded from the build context
C.To list ignored users
D.To ignore errors during the build process
Correct Answer: To specify files and directories that should be excluded from the build context
Explanation:
The .dockerignore file prevents unnecessary files (like git history or temporary build files) from being sent to the Docker daemon, optimizing build speed and image size.
Incorrect! Try again.
25In Kubernetes, what is a 'ReplicaSet' responsible for?
A.Ensuring a specified number of pod replicas are running at any given time
B.Managing user permissions
C.Exposing services to the internet
D.Storing configuration data
Correct Answer: Ensuring a specified number of pod replicas are running at any given time
Explanation:
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time to ensure availability.
Incorrect! Try again.
26Which instruction in a Dockerfile defines the command to run when the container starts?
A.EXEC
B.RUN
C.BUILD
D.CMD
Correct Answer: CMD
Explanation:
CMD specifies the instruction that is to be executed when a Docker container starts. There can only be one CMD instruction in a Dockerfile.
Incorrect! Try again.
27What is 'Blue-Green Deployment'?
A.Deploying only to users with blue or green screens
B.Updating half the servers in the morning and half at night
C.A deployment that fails 50% of the time
D.A technique where two identical environments exist, one running production (Blue) and one with the new version (Green)
Correct Answer: A technique where two identical environments exist, one running production (Blue) and one with the new version (Green)
Explanation:
Blue-Green deployment reduces downtime and risk by running two identical production environments. Only one serves live traffic at a time.
Incorrect! Try again.
28What is the 'Docker Daemon'?
A.A container analysis tool
B.The command line interface for Docker
C.The registry where images are stored
D.A background service that manages Docker objects like images, containers, and networks
Correct Answer: A background service that manages Docker objects like images, containers, and networks
Explanation:
The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects.
Incorrect! Try again.
29Which Kubernetes component exposes the Kubernetes API?
A.kube-scheduler
B.kubelet
C.kube-apiserver
D.etcd
Correct Answer: kube-apiserver
Explanation:
The API server is the front end for the Kubernetes control plane; it validates and configures data for the api objects.
Incorrect! Try again.
30What is the primary purpose of 'Docker Hub'?
A.A cloud-based registry service for sharing and storing Docker images
B.A tool to compile Java code
C.To run containers on the cloud
D.A local storage for Docker logs
Correct Answer: A cloud-based registry service for sharing and storing Docker images
Explanation:
Docker Hub is the world's largest library and community for container images, allowing users to pull and push images.
Incorrect! Try again.
31What is a 'Canary Deployment'?
A.Deploying to a bird-themed server
B.Releasing code only to internal developers
C.Releasing code to a small percentage of users before a full rollout
D.Deploying code without testing
Correct Answer: Releasing code to a small percentage of users before a full rollout
Explanation:
Canary deployment is a strategy to reduce the risk of introducing a new software version in production by slowly rolling out the change to a small subset of users.
Incorrect! Try again.
32Which Docker command creates an image from a Dockerfile?
A.docker create
B.docker commit
C.docker build
D.docker image-maker
Correct Answer: docker build
Explanation:
The 'docker build' command builds Docker images from a Dockerfile and a 'context' (a set of files).
Incorrect! Try again.
33What does the 'WORKDIR' instruction do in a Dockerfile?
A.It installs a worker process
B.It creates a new user
C.It sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow
D.It defines the network mode
Correct Answer: It sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow
Explanation:
WORKDIR sets the directory inside the container where commands will be executed.
Incorrect! Try again.
34In Kubernetes, what is an 'Ingress'?
A.A type of container image
B.A storage volume
C.A security credential
D.An API object that manages external access to the services in a cluster, typically HTTP
Correct Answer: An API object that manages external access to the services in a cluster, typically HTTP
Explanation:
Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
Incorrect! Try again.
35What is the role of 'kube-proxy'?
A.To build container images
B.To schedule pods
C.To maintain network rules on nodes allowing network communication to your Pods
D.To store cluster data
Correct Answer: To maintain network rules on nodes allowing network communication to your Pods
Explanation:
kube-proxy is a network proxy that runs on each node and maintains network rules to allow communication.
Incorrect! Try again.
36Why is immutability important in container images?
A.It ensures that the container runs exactly the same way in every environment
B.It allows the image to be changed easily at runtime
C.It prevents the image from being deleted
D.It makes the image size larger
Correct Answer: It ensures that the container runs exactly the same way in every environment
Explanation:
Immutability means once an image is created, it doesn't change. This guarantees consistency across development, testing, and production.
Incorrect! Try again.
37Which CI tool is widely used for building and testing software projects continuously?
A.Zoom
B.Photoshop
C.Jenkins
D.Excel
Correct Answer: Jenkins
Explanation:
Jenkins is a popular open-source automation server used to automate parts of software development related to building, testing, and deploying.
Incorrect! Try again.
38What is a Multi-stage build in Docker?
A.Building an image on multiple computers at once
B.A method to reduce image size by using multiple FROM instructions and copying artifacts between stages
C.Running a build for more than 24 hours
D.Building multiple images for different OS versions
Correct Answer: A method to reduce image size by using multiple FROM instructions and copying artifacts between stages
Explanation:
Multi-stage builds allow you to use intermediate images to compile code and then copy only the necessary artifacts to the final image, drastically reducing size.
Incorrect! Try again.
39What is the relationship between a Pod and a Node in Kubernetes?
A.They are the same thing
B.A Pod runs on a Node
C.A Node is a type of storage for a Pod
D.A Node runs inside a Pod
Correct Answer: A Pod runs on a Node
Explanation:
A Node is a worker machine (VM or physical). Pods are scheduled to run on Nodes.
Incorrect! Try again.
40Which Kubernetes object is used to store sensitive information like passwords or keys?
A.Volume
B.Deployment
C.Secret
D.ConfigMap
Correct Answer: Secret
Explanation:
Kubernetes Secrets let you store and manage sensitive information, such as passwords, OAuth tokens, and ssh keys.
Incorrect! Try again.
41What does the 'ENV' instruction do in a Dockerfile?
A.Ends the build process
B.Installs a new environment
C.Validates the environment
D.Sets an environment variable
Correct Answer: Sets an environment variable
Explanation:
The ENV instruction sets the environment variable key to the value, which persists when a container is run from the resulting image.
Incorrect! Try again.
42In the context of Docker, what is a 'Volume'?
A.The loudness of the container
B.A CPU limit
C.A networking protocol
D.A mechanism for persisting data generated by and used by Docker containers
Correct Answer: A mechanism for persisting data generated by and used by Docker containers
Explanation:
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers, as container storage is ephemeral by default.
Incorrect! Try again.
43What is the 'Self-healing' capability in Kubernetes?
A.The ability of Kubernetes to restart failed containers, replace them, and kill containers that don't respond to health checks
B.The ability of the code to fix syntax errors
C.The ability of the hardware to repair itself
D.The ability to automatically upgrade the operating system
Correct Answer: The ability of Kubernetes to restart failed containers, replace them, and kill containers that don't respond to health checks
Explanation:
Kubernetes monitors the state of the pods and nodes and automatically attempts to correct discrepancies between the desired state and the actual state.
Incorrect! Try again.
44Which of the following is a key principle of Continuous Integration?
A.Deploying to production manually once a month
B.Committing to the main branch frequently (at least daily)
C.Manual testing only
D.Long-lived feature branches
Correct Answer: Committing to the main branch frequently (at least daily)
Explanation:
Frequent commits ensure that the code base remains stable and that integration conflicts are resolved quickly.
Incorrect! Try again.
45What is a 'ConfigMap' in Kubernetes?
A.A configuration file for the Docker daemon
B.An API object used to store non-confidential data in key-value pairs
C.A tool to map ports
D.A map of the physical network
Correct Answer: An API object used to store non-confidential data in key-value pairs
Explanation:
ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable.
Incorrect! Try again.
46What is the 'Sidecar' pattern in microservices deployment?
A.Deploying a helper container alongside the main application container in the same Pod
B.Running two different applications on the same server
C.Backing up data to a side server
D.Using a motorcycle for delivery
Correct Answer: Deploying a helper container alongside the main application container in the same Pod
Explanation:
The sidecar pattern involves co-locating another container in the same Pod to enhance or extend the functionality of the main container (e.g., logging agents, proxies).
Incorrect! Try again.
47Which Docker command stops a running container?
A.docker halt
B.docker stop
C.docker pause
D.docker end
Correct Answer: docker stop
Explanation:
The 'docker stop' command issues a SIGTERM to the main process inside the container to gracefully shut it down.
Incorrect! Try again.
48What is the difference between RUN and CMD in a Dockerfile?
A.They are identical
B.CMD executes during the build phase; RUN executes when the container starts
C.RUN executes during the build phase; CMD executes when the container starts
D.RUN is used for networking; CMD is for storage
Correct Answer: RUN executes during the build phase; CMD executes when the container starts
Explanation:
RUN commands are executed when building the image (e.g., installing packages). CMD specifies the default command to run when the container is launched.
Incorrect! Try again.
49In Kubernetes, what is a 'StatefulSet'?
A.A workload API object used to manage stateful applications
B.A set of stateless web servers
C.A configuration for stateless apps
D.A set of static IP addresses
Correct Answer: A workload API object used to manage stateful applications
Explanation:
StatefulSets manage the deployment and scaling of a set of Pods, providing guarantees about the ordering and uniqueness of these Pods (useful for databases).
Incorrect! Try again.
50What is the main advantage of using a 'Layered Architecture' in Docker images?
A.It looks better visually
B.It encrypts the data automatically
C.It allows the image to run on Windows and Linux simultaneously
D.It allows caching and reuse of layers, speeding up builds and reducing storage
Correct Answer: It allows caching and reuse of layers, speeding up builds and reducing storage
Explanation:
Docker images are built from layers. If a layer hasn't changed, Docker reuses the cached layer, making builds faster and saving disk space.