DevOps DevOps 2 — Questions and Answers
Question 1: In a CI/CD pipeline, what is the primary purpose of a 'build artifact'?
- A packaged, deployable output produced once and promoted across environments (Correct answer)
- A log file describing test failures
- A temporary cache cleared after each commit
- A branch protection rule in the repository
Correct answer: A packaged, deployable output produced once and promoted across environments
A build artifact is the immutable packaged output built once and promoted through environments to ensure consistency.
Question 2: Which practice best describes 'shift-left' testing?
- Moving testing earlier into the development cycle (Correct answer)
- Running all tests only in production
- Testing only after deployment
- Shifting test ownership to the operations team
Correct answer: Moving testing earlier into the development cycle
Shift-left means catching defects earlier by integrating testing earlier in the development lifecycle.
Question 3: What does the term 'idempotent' mean in the context of configuration management tools like Ansible?
- Applying the same operation multiple times yields the same result (Correct answer)
- The tool runs faster on each subsequent execution
- Configuration changes are randomly applied
- Each run requires manual approval
Correct answer: Applying the same operation multiple times yields the same result
Idempotent operations produce the same end state no matter how many times they are applied.
Question 4: In Kubernetes, what is the role of a 'liveness probe'?
- Detects when a container should be restarted because it is unhealthy (Correct answer)
- Scales the deployment based on CPU usage
- Routes traffic to the fastest pod
- Encrypts pod-to-pod communication
Correct answer: Detects when a container should be restarted because it is unhealthy
A liveness probe checks whether a container is alive and triggers a restart if it fails.
Question 5: Which strategy deploys a new version alongside the old one and gradually shifts traffic?
- Canary deployment (Correct answer)
- Recreate deployment
- Rollback deployment
- Hotfix deployment
Correct answer: Canary deployment
A canary deployment routes a small portion of traffic to the new version before a full rollout.
Question 6: What is the main benefit of using Infrastructure as Code (IaC)?
- Reproducible, version-controlled infrastructure provisioning (Correct answer)
- Eliminating the need for any servers
- Removing the need for monitoring
- Faster physical hardware installation
Correct answer: Reproducible, version-controlled infrastructure provisioning
IaC lets infrastructure be defined in code so it is reproducible, reviewable, and version controlled.
Question 7: In Git, what does a 'merge conflict' indicate?
- Two branches changed the same lines and Git cannot auto-resolve them (Correct answer)
- The remote repository is offline
- A commit was signed with an invalid key
- The branch has no upstream configured
Correct answer: Two branches changed the same lines and Git cannot auto-resolve them
A merge conflict occurs when overlapping changes prevent Git from automatically combining branches.
In a CI/CD pipeline, what is the primary purpose of a 'build artifact'?