---
title: "Quiz: Virtualization and Containers"
domain: cloud-computing
level: beginner
questions: 10
---

# Quiz: Virtualization and Containers

## Questions

### 1. You install a hypervisor on a server with a modern Intel CPU, and it reports that hardware virtualization (VT-x) is not available. The CPU is known to support it. What is the most likely cause?
*Objective: 1. Explain how hardware virtualization works and compare type 1 and type 2 hypervisors.*

- A) The guest operating systems are too new for the hypervisor.
- B) The extension is switched off in the server's firmware settings.
- C) VT-x only works with type 2 hypervisors, so a type 1 hypervisor can't use it.
- D) The server has too many virtual machines running already.

### 2. A developer installs Oracle VirtualBox on a laptop that runs Windows and starts a Linux VM. Which statement describes this setup correctly?
*Objective: 1. Explain how hardware virtualization works and compare type 1 and type 2 hypervisors.*

- A) It is a type 1 hypervisor, because the Linux guest has its own kernel.
- B) It is a type 1 hypervisor, because it uses the CPU's virtualization extensions.
- C) It is a type 2 hypervisor: it runs as an application on the Windows host, which still controls the hardware.
- D) It is not virtualization, because the guest and the host use different operating systems.

### 3. An online shop runs a stateless Linux web application. For a sale, it must add dozens of extra copies within seconds and fit as many as possible on each server. Which choice fits best, and why?
*Objective: 2. Compare virtual machines and containers in isolation, startup time, density and overhead.*

- A) Containers: they start a process on the shared host kernel, so they start in about a second and carry little overhead per copy.
- B) Virtual machines: each copy then gets its own kernel, which makes it start faster.
- C) Virtual machines: the guest operating systems are shared between copies, so density is higher.
- D) Containers: they boot a smaller guest operating system than a virtual machine does.

### 4. A newly published Linux kernel vulnerability lets a local process become root on the host. A server runs ten containers for one team and, on the same hardware, VMs for other customers. Which workloads are most directly exposed to a kernel bug on the host?
*Objective: 2. Compare virtual machines and containers in isolation, startup time, density and overhead.*

- A) Only the VMs, because a hypervisor has a larger attack surface than a kernel.
- B) None of them, because namespaces make the kernel invisible to containers.
- C) Only containers that run as root inside, because other containers have no access to the kernel.
- D) The containers, because they all use the host's kernel directly; a VM's own kernel is a separate one that an attacker would reach only through the hypervisor.

### 5. Inside a container, `ps` shows `sleep` as PID 1 and nothing else. On the host, `ps -e` shows the same process with PID 41390 among hundreds of others. Which kernel feature explains this?
*Objective: 3. Explain how Linux namespaces and control groups (cgroups) isolate and limit a container.*

- A) The cgroup `pids.max` limit, which hides processes beyond the limit.
- B) A pid namespace, which gives the container its own process numbering and view.
- C) A seccomp profile, which filters the `ps` command's system calls.
- D) overlayfs, which merges the container's processes with the image layers.

### 6. An administrator wants a container to (1) never use more than 1 GB of memory and (2) see only its own network interfaces and ports. Which pair of kernel features does that?
*Objective: 3. Explain how Linux namespaces and control groups (cgroups) isolate and limit a container.*

- A) A net cgroup for the memory limit and a memory namespace for the interfaces.
- B) A pid namespace for the memory limit and a user namespace for the interfaces.
- C) The memory controller of a cgroup for the limit, and a net namespace for the interfaces.
- D) A mnt namespace for the memory limit and a uts namespace for the interfaces.

### 7. Your machine already holds `shop:1.0`. You pull `shop:2.0`, which was built on the same base image and differs only in its last `COPY` layer. What does the pull download?
*Objective: 4. Build a container image and explain its layers and the Open Container Initiative (OCI) formats.*

- A) The whole image again, because every tag is a separate full copy.
- B) Only the manifest, because layers are always rebuilt locally.
- C) The base layers only, because the last layer is generated from the `Containerfile` on your machine.
- D) The new manifest and configuration, and only the layers you don't already have: here, the changed last layer.

### 8. A `Containerfile` starting with `FROM python:3` built correctly last month, but today's build fails. Nobody changed the file. What is the most likely reason, and the best fix?
*Objective: 4. Build a container image and explain its layers and the Open Container Initiative (OCI) formats.*

- A) The tag `python:3` now points to a newer image; pin an exact version tag (or a digest) in `FROM`.
- B) The registry deleted the image's layers; add more `RUN` instructions to rebuild them.
- C) The OCI specification changed; convert the image to another format.
- D) The digest of `python:3` is mutable; stop using digests.

### 9. A container started with `--memory 256m` exits with code 137. `podman inspect` shows `OOMKilled=true`, and the kernel log has `Memory cgroup out of memory: Killed process ...`. The application loads a 300 MB data file into memory at startup. What is the best next step?
*Objective: 5. Configure resource limits for a container and troubleshoot a container stopped for exceeding its memory.*

- A) Increase `--cpus`, because a faster CPU lets the application finish before the limit is reached.
- B) Remove the `--memory` option, so the container is never limited.
- C) Work out how much memory the application really needs, then raise the limit to match (or change the application to stream the file instead of loading it all).
- D) Add a restart policy: the container will eventually start with less memory use.

### 10. In a container's cgroup you read `cpu.max` = `25000 100000`. What does this mean?
*Objective: 5. Configure resource limits for a container and troubleshoot a container stopped for exceeding its memory.*

- A) The container may use 25 CPUs.
- B) The container may use 25 ms of CPU time in each 100 ms period, which is a quarter of one CPU; beyond that it is throttled, not killed.
- C) The container is killed after it has used 25,000 microseconds of CPU in total.
- D) The container may use 25% of the host's memory in each 100 ms period.

---

## Answer key

<details>
<summary>Show answers</summary>

| # | Answer | Explanation |
|---|---|---|
| 1 | B | VT-x and AMD-V can be disabled in the firmware (BIOS/UEFI) settings, so a CPU that supports them may still report them as unavailable. Both type 1 and type 2 hypervisors use the extensions (C), and the number of VMs or the guest OS version (A, D) doesn't switch the feature off. |
| 2 | C | VirtualBox is an application that runs on the Windows host OS, which stays in charge of the hardware: that is a type 2 hypervisor. A guest having its own kernel (A) is true for every VM, and using CPU extensions (B) is true for both types. |
| 3 | A | Containers are processes on the host kernel: they start in milliseconds to seconds and have little per-copy overhead, so many fit on one server. A VM must boot a whole guest OS (B), guests don't share operating systems (C), and a container doesn't boot a guest OS at all (D). |
| 4 | D | All containers on a host run on the same kernel, so a kernel bug is reachable from every container. A VM has its own guest kernel; an attacker would first have to break through the hypervisor. This is why different customers' workloads are usually separated with VMs. Namespaces limit what a process sees, not which kernel it uses (B). |
| 5 | B | A pid namespace gives the container its own process numbers (the first process is PID 1) and hides other processes. `pids.max` limits how many processes there can be, not what you see (A); seccomp filters system calls (C); overlayfs deals with files (D). |
| 6 | C | cgroups limit resources (the memory controller sets `memory.max`), and namespaces limit visibility (a net namespace gives its own interfaces and ports). The other options pair features with things they don't do: there is no "memory namespace", and pid, mnt, uts and user namespaces don't limit memory. |
| 7 | D | Images are stacks of content-addressed layers, so the pull fetches the new manifest and configuration, and only the layers whose digest is not yet in the local store. The unchanged base layers are reused. |
| 8 | A | A tag is a movable label: `python:3` follows the newest 3.x release, so the base image changes under the build. Pinning an exact version tag, or a digest for a guarantee, makes the build repeatable. Digests are immutable (D) and a registry doesn't need extra `RUN` lines (B). |
| 9 | C | The evidence (`OOMKilled=true` and the kernel line) proves the limit is the cause: the application needs more than 256 MB. The fix is to match limit and need, or to reduce the need. More CPU doesn't change memory use (A), removing all limits puts neighbours at risk (B), and restarts won't change a 300 MB requirement (D). |
| 10 | B | The first number is the quota and the second the period, both in microseconds: 25,000 µs of CPU per 100,000 µs is 0.25 CPU. A group that uses its quota is throttled until the next period; CPU is compressible, so nothing is killed. It says nothing about memory (D). |

</details>
