Web Development Deployment 2 — Questions and Answers
Question 1: What does a blue-green deployment strategy involve?
- Running two identical environments and switching traffic between them (Correct answer)
- Deploying to a subset of servers painted blue first
- Using feature flags to hide new code until ready
- Rolling back by reverting the last git commit
Correct answer: Running two identical environments and switching traffic between them
Blue-green deployment maintains two identical production environments, allowing instant traffic switching and easy rollback.
Question 2: Which HTTP status code indicates a successful deployment health check?
- 204
- 301
- 200 (Correct answer)
- 202
Correct answer: 200
A 200 OK response from a health check endpoint confirms the service is running and accepting requests.
Question 3: What is the primary purpose of a Dockerfile's ENTRYPOINT instruction?
- Set environment variables at build time
- Define the default command that runs when the container starts (Correct answer)
- Copy files into the container image
- Expose a port on the container
Correct answer: Define the default command that runs when the container starts
ENTRYPOINT specifies the executable that runs when a container is started from the image.
Question 4: What is canary deployment?
- Deploying only to staging servers
- Gradually rolling out changes to a small percentage of users before full rollout (Correct answer)
- Encrypting deployment artifacts with a canary key
- Running automated smoke tests in production
Correct answer: Gradually rolling out changes to a small percentage of users before full rollout
Canary deployment releases a new version to a small traffic slice first to detect issues before a full rollout.
Question 5: In a CI/CD pipeline, what is the purpose of a staging environment?
- To store build artifacts permanently
- To mirror production for final testing before release (Correct answer)
- To run unit tests in parallel
- To cache npm dependencies between builds
Correct answer: To mirror production for final testing before release
Staging is a production-like environment used to validate changes in context before they reach real users.
Question 6: Which command builds a Docker image from a Dockerfile in the current directory?
- docker run -t myapp .
- docker build -t myapp . (Correct answer)
- docker create myapp .
- docker push myapp .
Correct answer: docker build -t myapp .
`docker build -t myapp .` builds an image tagged 'myapp' using the Dockerfile in the current directory.
Question 7: What does 'infrastructure as code' (IaC) mean in deployment?
- Writing application logic in infrastructure languages like YAML
- Provisioning and managing infrastructure through machine-readable configuration files (Correct answer)
- Using servers to compile application source code
- Storing deployment scripts inside the database
Correct answer: Provisioning and managing infrastructure through machine-readable configuration files
IaC means defining servers, networks, and services in versioned config files (e.g., Terraform, CloudFormation) instead of manual processes.
What does a blue-green deployment strategy involve?