CS DevOps & Deployment 2 — Questions and Answers
Question 1: In a CI/CD pipeline, what is the primary purpose of the continuous integration stage?
- Automatically merging and testing code changes frequently to detect integration issues early (Correct answer)
- Deploying code directly to production servers
- Monitoring application performance in production
- Provisioning cloud infrastructure on demand
Correct answer: Automatically merging and testing code changes frequently to detect integration issues early
Continuous integration merges developer changes into a shared branch frequently and runs automated builds and tests to catch conflicts early.
Question 2: A team wants zero-downtime deployments by running two identical production environments and switching traffic between them. Which strategy is this?
- Blue-green deployment (Correct answer)
- Canary deployment
- Rolling deployment
- Shadow deployment
Correct answer: Blue-green deployment
Blue-green deployment maintains two identical environments and switches all traffic from one to the other after the new version is verified.
Question 3: Which file is used to define the steps for building a Docker container image?
- Dockerfile (Correct answer)
- docker-compose.yml
- package.json
- Makefile
Correct answer: Dockerfile
A Dockerfile contains the ordered instructions Docker uses to build a container image layer by layer.
Question 4: What does 'Infrastructure as Code' (IaC) primarily enable?
- Defining and provisioning infrastructure through machine-readable configuration files (Correct answer)
- Writing application code that runs without servers
- Encrypting infrastructure credentials in source code
- Replacing operations teams with developers
Correct answer: Defining and provisioning infrastructure through machine-readable configuration files
IaC manages servers, networks, and services through versioned configuration files, making infrastructure reproducible and auditable.
Question 5: A deployment gradually routes 5% of users to a new version before rolling it out to everyone. What is this called?
- Canary deployment (Correct answer)
- Blue-green deployment
- Big bang deployment
- Hotfix deployment
Correct answer: Canary deployment
A canary deployment exposes a small subset of users to the new release to detect problems before full rollout.
Question 6: In Kubernetes, which object ensures a specified number of identical pod replicas are running at all times?
- Deployment (Correct answer)
- ConfigMap
- Ingress
- Namespace
Correct answer: Deployment
A Kubernetes Deployment manages a ReplicaSet to keep the desired number of pod replicas running and handles rolling updates.
Question 7: What is the main risk of storing secrets like API keys directly in a Git repository?
- They remain in the commit history and can be exposed even after deletion (Correct answer)
- Git compresses them, making them unreadable
- They slow down clone operations significantly
- They automatically expire after each commit
Correct answer: They remain in the commit history and can be exposed even after deletion
Secrets committed to Git persist in history and can be recovered by anyone with repository access, even if later removed.
In a CI/CD pipeline, what is the primary purpose of the continuous integration stage?