Cloud Computing MCQs - Containers, Docker, Kubernetes and Serverless (Set 4)

Cloud Computing MCQs - Containers, Docker, Kubernetes and Serverless (Set 4) - CodingHumans

This set moves from virtual machines to lighter, cloud-native ways of running software. It covers Linux namespaces and cgroups, Docker images and Dockerfile behaviour, Kubernetes architecture and autoscaling, microservices design patterns and serverless constraints. With Dockerfile reasoning and an autoscaling calculation, it suits university cloud computing papers, DevOps interviews and placement rounds for backend and full stack roles.

How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 18 questions.

Cloud Computing MCQ series: Set 1 | Set 2 | Set 3 | Set 4 | Set 5 | Set 6

Topics covered in this set

  • Containers vs virtual machines
  • Namespaces and cgroups
  • Dockerfile layers, CMD and ENTRYPOINT
  • Kubernetes pods, services and control plane
  • Horizontal Pod Autoscaler
  • Microservices patterns and serverless design

Cloud Computing MCQs with answers and explanations

Q1. What is the main reason containers start faster and use fewer resources than virtual machines?

a) They share the host OS kernel instead of booting a full guest OS

b) They always run on a Type 1 hypervisor

c) They have no file system

d) They are implemented in hardware

Q2. Which Linux kernel feature is used to limit how much CPU and memory a container can consume?

a) Namespaces

b) cgroups

c) chroot

d) Hard links

Q3. A process inside a container sees itself as PID 1 even though the host gives it a different PID. Which feature makes this possible?

a) cgroups

b) seccomp

c) The PID namespace

d) A union file system

Q4. In the Dockerfile below, why is requirements.txt copied and installed before the rest of the source code?

FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]

a) To use layer caching so dependencies are not reinstalled when only application code changes

b) Because Docker processes files in alphabetical order

c) To reduce the number of running containers

d) Because CMD cannot run without it

Q5. An image is built from the Dockerfile below. Which command runs inside the container when you execute: docker run netcheck example.com

FROM alpine
ENTRYPOINT ["ping"]
CMD ["localhost"]

a) ping localhost

b) ping example.com

c) example.com

d) ping localhost example.com

Q6. What is the smallest deployable unit that Kubernetes creates and manages?

a) Container

b) Node

c) Deployment

d) Pod

Q7. Which Kubernetes control plane component is the consistent key-value store holding all cluster state?

a) kubelet

b) kube-proxy

c) etcd

d) CoreDNS

Q8. Which component runs on every worker node and makes sure the containers described in pod specs are running and healthy?

a) kube-scheduler

b) kubelet

c) kube-controller-manager

d) etcd

Q9. What is the default Kubernetes Service type, which exposes pods only on an internal cluster IP address?

a) NodePort

b) LoadBalancer

c) ClusterIP

d) ExternalName

Q10. A Deployment specifies replicas: 3. The node running one of its pods crashes. What happens next?

a) The Deployment is deleted

b) The ReplicaSet controller creates a replacement pod on another node to restore 3 replicas

c) The whole cluster shuts down

d) The remaining two pods automatically double their CPU limits

Q11. A Horizontal Pod Autoscaler targets 60% average CPU. There are 4 pods currently averaging 90% CPU. How many replicas will it aim for?

a) 5

b) 7

c) 8

d) 6

Q12. Which statement best describes a microservices architecture?

a) Independently deployable services organised around business capabilities, each owning its own data

b) A single deployable unit containing all features

c) All services must be written in the same language

d) Services communicate by sharing process memory

Q13. Which pattern stops calling a repeatedly failing downstream service for a period and returns a fallback, preventing cascading failures?

a) Sidecar

b) Strangler fig

c) Circuit breaker

d) Saga

Q14. In microservices, keeping data consistent across services through a sequence of local transactions, each with a compensating action on failure, is the

a) Two-phase locking protocol

b) Sharding pattern

c) Blue-green deployment

d) Saga pattern

Q15. Which component acts as a single entry point for clients, handling routing, authentication and rate limiting before requests reach microservices?

a) API gateway

b) Service mesh data plane

c) Message broker

d) Container registry

Q16. Why should a serverless function avoid depending on in-memory state from previous invocations?

a) Execution environments can be reused or discarded at any time, so that state is not guaranteed to exist

b) Function memory is read-only

c) Functions cannot declare variables

d) Keeping state doubles the bill automatically

Q17. What happens to data written inside a container's writable layer after the container is removed with docker rm?

a) It is saved into the image

b) It is lost unless it was written to a volume or bind mount

c) It is pushed to the registry

d) It is moved to the host's /tmp directory

Q18. Which pattern gradually migrates a monolith by routing selected features to new services until the old system can be retired?

a) Bulkhead

b) Retry with backoff

c) Strangler fig

d) Ambassador

Quick revision notes

  • Containers share the host kernel; VMs each run a full guest OS.
  • Namespaces = isolation (PID, net, mnt, uts, ipc, user); cgroups = resource limits.
  • Docker run arguments override CMD; CMD supplies default arguments to ENTRYPOINT.
  • Order Dockerfile steps from least to most frequently changing to maximise layer cache hits.
  • Kubernetes: pod = smallest unit; etcd = cluster state; kubelet = node agent; scheduler places pods.
  • HPA: desired = ceil(current replicas x current metric / target metric).
  • Microservices patterns: API gateway, circuit breaker, saga, strangler fig, database per service.
  • Serverless functions should be stateless and idempotent; keep state in external stores.

Frequently asked questions

What is the difference between Docker and Kubernetes?

Docker builds container images and runs containers on a single host. Kubernetes orchestrates containers across a cluster of machines, handling scheduling, scaling, self-healing and service discovery.

Are containers more secure than virtual machines?

Generally VMs offer stronger isolation because each has its own kernel, while containers share the host kernel. Containers can be hardened with namespaces, seccomp, read-only file systems and non-root users, or run inside lightweight VMs for stronger isolation.

When should I use serverless instead of containers?

Serverless suits event-driven, bursty or low-traffic workloads where scaling to zero saves money and operational effort. Long-running, latency-critical or steady high-throughput services are often cheaper and more predictable on containers.

Comments

Answered 0/0Correct 0