# Free AT0-001 practice questions

> 10 free AT0-001 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/comptia-at0-001/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/comptia-at0-001/

### Question 1 of 10

A Python automation script provisions user accounts from a list. The engineer wants the provisioning logic in one place so it can be called for each user and unit-tested separately. Which change BEST meets this goal?

- A. Replace the loop with a while True construct that reads the next user from a counter until an IndexError occurs
- B. Store the provisioning steps in a global variable as a string and run it with exec() for each user in the list
- C. Copy the provisioning block once per user so each account has its own clearly separated section of code
- D. Move the provisioning steps into a function that takes the username as a parameter and call it inside the loop

**Answer:** D

**Explanation:** A parameterised function encapsulates the logic, removes duplication and can be called by unit tests directly. Copying the block per user multiplies maintenance effort and defeats reuse. Running code stored in a string with exec() is hard to test and a security risk, and an endless loop that relies on an exception for termination is fragile and does not make the logic more testable.

### Question 2 of 10 (choose 2)

A team adopts trunk-based development for its automation repository. Which two practices are characteristic of this branching strategy? (Choose two.)

- A. Each release is maintained on its own permanent branch that never merges back
- B. Feature flags hide incomplete work that has already been merged to main
- C. Long-lived feature branches are merged only at the end of each quarter
- D. Developers merge small changes into the main branch at least daily
- E. A separate develop branch collects features before release branches are cut

**Answer:** B, D

**Explanation:** Trunk-based development relies on frequent, small merges into a single main branch and uses feature flags to keep unfinished functionality inactive in production. Long-lived feature branches contradict the model, a develop branch plus release branches describes Git Flow, and permanent per-release branches are a release-maintenance pattern rather than trunk-based development.

### Question 3 of 10

An operations engineer writes a Bash script that must stop immediately when any command returns a non-zero exit status, instead of continuing with later steps. Which line should be added near the top of the script?

- A. trap '' EXIT
- B. set -x
- C. export PIPESTATUS=1
- D. set -e

**Answer:** D

**Explanation:** The set -e option makes Bash exit as soon as a command returns a non-zero status. The set -x option only prints each command before running it for debugging. An empty trap on EXIT merely registers a no-op handler and does not stop on failures, and PIPESTATUS is a read-only array Bash fills with pipeline exit codes rather than a switch that changes error handling.

### Question 4 of 10

An engineer uses curl to send JSON to an API, but the server responds with 415 Unsupported Media Type. Which curl option is MOST likely missing?

- A. -H "Content-Type: application/json"
- B. -H "Cache-Control: no-cache"
- C. -H "Connection: keep-alive"
- D. -H "Accept-Encoding: gzip"

**Answer:** A

**Explanation:** 415 means the server does not accept the request body's declared media type, which happens when JSON is sent without a Content-Type of application/json (curl defaults to form encoding with -d). Accept-Encoding concerns response compression, Cache-Control concerns caching, and Connection controls connection reuse; none of them declares the body format.

### Question 5 of 10

A team writes an Ansible playbook that lists the packages and services that should exist on each host, and the tool works out which steps are needed. Another team writes a shell script that lists each command to run in order. Which statement correctly compares the two approaches?

- A. The playbook is declarative because it describes the end state, while the script is imperative because it lists the steps
- B. The playbook is imperative because tasks run in order, while the script is declarative because it is easier to read
- C. Both are imperative because the target servers receive commands over SSH in each of the two approaches
- D. Both are declarative because each of them can be stored in Git and reviewed by the team before execution

**Answer:** A

**Explanation:** Declarative automation describes the desired end state and lets the tool determine the actions, which is how the playbook is described. Imperative automation specifies the exact sequence of commands, as in the shell script. Storing code in Git does not make it declarative, and the transport (SSH) does not determine the paradigm.

### Question 6 of 10

An automation server calls an API using mutual TLS. After the security team renewed certificates, the API rejects connections with "bad certificate" during the handshake, while server certificate validation on the client still succeeds. What is the MOST likely cause?

- A. The API changed its REST endpoint paths, so the handshake fails until the client uses the new URLs
- B. The client certificate presented by the automation server was not renewed or is not trusted by the API's client CA list
- C. The automation server's DNS cache returns an old IP address for the API after the certificate renewal
- D. The API's server certificate expired, so the client refuses to continue the handshake with the server

**Answer:** B

**Explanation:** In mutual TLS the server also validates the client certificate; a "bad certificate" alert from the server while the client trusts the server points to an expired, replaced or untrusted client certificate. The client already validates the server certificate successfully, DNS issues would not produce a certificate alert, and URL paths are sent only after the handshake.

### Question 7 of 10

A team stores deployment credentials in a CI secrets store. A pull request from a fork modifies the workflow to print every environment variable. Which configuration BEST prevents the secrets from being exposed?

- A. Do not make secrets available to workflows triggered by pull requests from forks, and require approval for outside contributors
- B. Rotate the secrets after every pull request is merged so that any leaked value expires within a day
- C. Store the secrets as base64-encoded strings in the repository so that they are not obvious in the logs
- D. Rely on the platform's log masking, since masked secrets can never be revealed by modified workflow steps

**Answer:** A

**Explanation:** Withholding secrets from untrusted fork-triggered runs and requiring approval stops modified workflows from accessing them at all. Masking can be bypassed by transforming the value before printing it, base64 encoding in the repository is not protection, and rotating after merge still leaves secrets exposed while the pull request runs.

### Question 8 of 10

A pipeline has three jobs: build, unit-test and integration-test. Both test jobs require the build output, but they do not depend on each other. Which pipeline design minimises total run time?

- A. Run all three jobs in a single sequential stage so the build output stays on one agent
- B. Declare integration-test as dependent on unit-test, and unit-test as dependent on build
- C. Declare that both test jobs depend on build so they start in parallel once build succeeds
- D. Run all three jobs in parallel immediately so that none of them waits for the others

**Answer:** C

**Explanation:** Expressing only the real dependency lets both test jobs run concurrently after the build, which is the shortest path. A single sequential stage or a chain from unit-test to integration-test adds unnecessary waiting. Starting the test jobs before the build finishes fails because their input does not yet exist.

### Question 9 of 10

A Kubernetes Deployment of 10 replicas is updated with a rolling update strategy of maxUnavailable: 0 and maxSurge: 2. What happens during the rollout?

- A. Two old pods are terminated before any new pod is created, keeping the total at eight pods
- B. All ten old pods are terminated first, and then ten new pods are started at the same moment
- C. Traffic is switched from a full set of old pods to a full set of new pods in one single step
- D. Up to two extra new pods are created at a time, and old pods are removed only after new ones are ready

**Answer:** D

**Explanation:** With maxSurge 2 the controller may run two pods above the desired count, and maxUnavailable 0 means it waits for new pods to become ready before removing old ones, so capacity never drops. Terminating everything first describes a recreate strategy, removing pods first would require maxUnavailable above zero, and an all-at-once switch describes blue-green.

### Question 10 of 10 (choose 2)

A team wants its CI/CD pipeline to authenticate to a cloud provider for deployments WITHOUT storing long-lived access keys anywhere. Which two approaches meet this requirement? (Choose two.)

- A. Encrypt an access key with a passphrase and commit it to the repository with the pipeline code
- B. Run the deployment on a self-hosted runner that uses an attached instance role or managed identity
- C. Configure OpenID Connect federation so the pipeline exchanges its identity token for short-lived cloud credentials
- D. Create a personal user account for the pipeline and save its password as a protected variable
- E. Store an access key pair in the CI secrets store and rotate it manually every 90 days

**Answer:** B, C

**Explanation:** OIDC workload identity federation and instance roles or managed identities both provide short-lived credentials without a stored long-term secret. Access keys in a secrets store or encrypted in the repository are still long-lived secrets, and a user account password is a reusable credential that also blurs human and machine identities.

Ready for a timed run? Take the free 15-question AT0-001 mini exam: https://devopscodelab.com/app/exams/comptia-at0-001/mini/

DevOpsCode Lab is not affiliated with CompTIA. AT0-001 and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
