programming
beginner
10 sample questions
Ci/cd Pipelines MCQ Practice Test
Automating testing and deployment using tools like Jenkins, GitLab CI, or GitHub Actions.
Q1. Your CI/CD pipeline uses a container registry to store Docker images. After a successful build, the pipeline fails to push the image to the registry. The error message indicates insufficient permissions. Which of the following is the MOST likely cause?
-
A. The pipeline's service account lacks the necessary permissions in the container registry. ✓
-
B. The Docker image is too large to be pushed.
-
C. The container registry is temporarily unavailable.
-
D. The pipeline is attempting to push to the wrong registry URL.
Explanation: CI/CD pipelines often rely on service accounts with specific permissions. If the service account used by the pipeline doesn't have the 'push' permission in the container registry, the image upload will fail. While the other options are possible causes of pipeline failure, insufficient permissions are the most likely explanation for a permission-related error.
Q2. In a CI/CD pipeline using AWS CodePipeline, you have a stage that builds a Docker image and pushes it to Amazon Elastic Container Registry (ECR). Which CodePipeline action would MOST likely be responsible for pushing the image to ECR?
-
A. Invoke a Lambda function to push the image
-
B. Use an AWS CodeBuild action with the 'aws ecr get-login' command ✓
-
C. Manually push the image using the AWS CLI
-
D. Use an AWS CodeDeploy action to deploy the image
Explanation: CodeBuild provides the build environment to execute commands, including the necessary authentication to push images to ECR. While a Lambda function could do this, it's not the standard or most efficient approach within a CodePipeline context. CodeDeploy handles deployments to compute environments, not image pushes to a registry. Manual pushing is not automated and defeats the purpose of a CI/CD pipeline.
Q3. In a CI/CD pipeline using AWS CodePipeline, you have a stage that deploys your application to an Amazon EC2 instance. The deployment fails due to insufficient permissions. Which AWS service is MOST likely responsible for managing the necessary permissions for this deployment stage?
-
A. AWS Lambda
-
B. AWS IAM ✓
-
C. AWS S3
-
D. Amazon RDS
Explanation: AWS Identity and Access Management (IAM) is responsible for managing access to AWS resources. The deployment stage needs appropriate IAM roles and policies to allow it to connect to and deploy to the EC2 instance.
Q4. In a CI/CD pipeline using AWS CodePipeline, your build stage successfully compiles your application but fails to deploy to an AWS Elastic Beanstalk environment due to insufficient permissions. Which of the following is the MOST likely cause of this deployment failure?
-
A. The CodePipeline role lacks the necessary IAM permissions to interact with Elastic Beanstalk. ✓
-
B. The application code contains a bug preventing deployment.
-
C. The Elastic Beanstalk environment is improperly configured.
-
D. The CodePipeline pipeline is not configured to deploy to Elastic Beanstalk.
Explanation: AWS CodePipeline relies on IAM roles to grant it the necessary permissions to access other AWS services. If the role associated with the pipeline doesn't have the correct permissions to interact with Elastic Beanstalk (like deploying applications), the deployment will fail. While the other options are possible, insufficient permissions are the most common cause of this specific type of deployment failure in an AWS environment.
Q5. In a CI/CD pipeline using AWS CodePipeline, you have a stage that deploys your application to an Amazon EC2 instance. Which AWS service is MOST likely used to securely manage and rotate the EC2 instance's access keys used by the pipeline for deployment?
-
A. AWS Secrets Manager ✓
-
B. AWS Key Management Service (KMS)
-
C. AWS Identity and Access Management (IAM)
-
D. Amazon S3
Explanation: AWS Secrets Manager is specifically designed for securely storing and managing sensitive data like database credentials, API keys, and in this case, EC2 access keys. While IAM handles user permissions and KMS manages encryption keys, Secrets Manager is the best fit for managing secrets directly used in the pipeline.
Q6. In a CI/CD pipeline using AWS CodePipeline, you have a stage that runs unit tests. The tests fail. What is the MOST likely immediate outcome?
-
A. The pipeline proceeds to the next stage, ignoring the failed tests.
-
B. The pipeline stops execution at the failed test stage. ✓
-
C. The pipeline automatically retries the tests three times before stopping.
-
D. A notification is sent, but the pipeline continues to the deployment stage.
Explanation: In most CI/CD setups, including AWS CodePipeline, a failed stage halts the pipeline's progress. This prevents faulty code from being deployed further. Manual intervention is usually required to fix the issue and restart the pipeline from the failed stage or a previous point.
Q7. Your CI/CD pipeline uses a cloud-based container registry (like Docker Hub or Google Container Registry) for storing your application's container images. After a successful build, which step MOST likely directly follows the image build process in your pipeline?
-
A. Pushing the container image to the registry ✓
-
B. Deploying the application to a staging environment
-
C. Running automated UI tests
-
D. Initiating infrastructure provisioning
Explanation: Before the application can be deployed or tested, the newly built container image needs to be stored in a central repository (the container registry) that is accessible by other pipeline stages. Pushing the image is the direct next step after building it.
Q8. In a CI/CD pipeline using AWS CodePipeline, you have a stage that deploys your application to an Amazon EC2 instance. This deployment stage fails intermittently due to a lack of sufficient permissions. Which AWS service should be primarily configured to resolve this permission issue?
-
A. AWS Identity and Access Management (IAM) ✓
-
B. Amazon S3
-
C. Amazon CloudWatch
-
D. AWS Lambda
Explanation: IAM is responsible for managing access control in AWS. The deployment stage needs appropriate IAM roles and policies to allow it to interact with the EC2 instance (e.g., to connect via SSH and deploy files).
Q9. Your CI/CD pipeline uses a Docker image stored in Amazon ECR. After a successful build, the pipeline needs to deploy this image to an ECS cluster. Which AWS service is MOST directly responsible for handling the deployment of the Docker image to the ECS cluster?
-
A. AWS CodeDeploy ✓
-
B. AWS Elastic Beanstalk
-
C. AWS Lambda
-
D. Amazon S3
Explanation: AWS CodeDeploy is specifically designed for deploying software to various compute services, including Amazon ECS. While Elastic Beanstalk can handle deployments, it's a higher-level service that manages more than just the deployment aspect. Lambda is for serverless functions, and S3 is for object storage.
Q10. In a CI/CD pipeline using AWS CodePipeline, you have a stage that runs unit tests. These tests consistently fail due to a missing environment variable. Where is the BEST place to configure this environment variable to ensure it's available during the unit test stage?
-
A. Within the CodePipeline pipeline definition itself, as a parameter for the unit test action. ✓
-
B. Directly within the unit test code, hardcoding the value.
-
C. In the AWS CodeCommit repository's environment variables settings.
-
D. As a system environment variable on the EC2 instance running the CodeBuild project.
Explanation: Defining the environment variable within the CodePipeline action ensures it's securely passed to the unit test stage without hardcoding sensitive information in the code or relying on potentially inconsistent system-level settings. CodePipeline allows you to pass parameters to actions, making this the most robust and maintainable solution.
That was just a sample. Sign up to unlock the full question bank with timed tests and certificates.
Sign Up Free