CPA CPA Version Control & DevOps Practices 2 — Questions and Answers
Question 1: In a CI/CD pipeline, what is the purpose of the 'CD' (Continuous Delivery) stage?
- To write test cases for new features
- To automatically prepare every successful build for potential release to production (Correct answer)
- To assign code reviews to team members
- To back up the source code repository
Correct answer: To automatically prepare every successful build for potential release to production
Continuous Delivery ensures every passing build is automatically packaged and released to a staging environment, making it ready for deployment to production at any time.
Question 2: What is Infrastructure as Code (IaC)?
- Writing application logic in low-level assembly language
- Managing and provisioning infrastructure through machine-readable configuration files rather than manual processes (Correct answer)
- Running code directly on bare-metal servers without an OS
- A programming paradigm for embedded systems
Correct answer: Managing and provisioning infrastructure through machine-readable configuration files rather than manual processes
IaC treats infrastructure configuration as versioned code, enabling repeatable, automated provisioning with tools like Terraform or Ansible.
Question 3: What does a `.gitignore` file do?
- Lists collaborators who cannot push to the repository
- Specifies intentionally untracked files that Git should not track or stage (Correct answer)
- Stores encrypted credentials for remote repository access
- Defines the default merge strategy for the repository
Correct answer: Specifies intentionally untracked files that Git should not track or stage
A .gitignore file contains patterns for files and directories that Git should exclude from tracking, such as build artifacts, logs, and secrets.
Question 4: What is a Docker container?
- A virtual machine with its own kernel
- A lightweight, portable runtime environment that packages an application with its dependencies (Correct answer)
- A cloud storage bucket for application artifacts
- A Git repository hosting service
Correct answer: A lightweight, portable runtime environment that packages an application with its dependencies
A Docker container is a standardized, isolated runtime unit that bundles an application and all its dependencies, ensuring consistent behavior across environments.
Question 5: In Git, what is a 'merge conflict'?
- A network error when pushing to a remote repository
- A situation where two branches have made incompatible changes to the same part of a file (Correct answer)
- A corrupted commit in the repository history
- An error caused by committing without a message
Correct answer: A situation where two branches have made incompatible changes to the same part of a file
A merge conflict occurs when Git cannot automatically reconcile differing changes to the same lines in the same file from two branches being merged.
Question 6: What is the role of an artifact repository (e.g., Nexus, Artifactory) in a DevOps pipeline?
- To run automated test suites against compiled code
- To store and manage binary build artifacts, libraries, and deployment packages (Correct answer)
- To monitor production server metrics and alerts
- To manage source code access permissions
Correct answer: To store and manage binary build artifacts, libraries, and deployment packages
An artifact repository centrally stores versioned build outputs (JARs, Docker images, npm packages) so they can be reliably retrieved and deployed across environments.
In a CI/CD pipeline, what is the purpose of the 'CD' (Continuous Delivery) stage?