CompTIA AutoOps+ Free Sample Questions

Description

Covers coding for automation, source control and infrastructure as code, configuration management and RESTful systems, CI workflow management, and continuous delivery and secure provider connections.

20 free sample questions150 in the full practice test

Try simulator

AT0-001 Sample Questions

  1. Question 1

    Beginner

    Automation Coding Concepts · Automation scripting fundamentals

    A systems engineer is writing a Python script to automate the cleanup of temporary files across several Linux servers. The engineer defines a variable max_age_days = 30 at the very beginning of the script, outside of any functions. Inside a function named clean_temp_files(), the engineer attempts to reassign max_age_days = 15 without any additional keywords. What is the result of this action in Python?

    Answer and explanation

    Correct answer: A

    In Python, assigning a value to a variable inside a function creates a new local variable by default. To modify the global variable, the engineer would need to explicitly declare global max_age_days inside the function before assignment.

  2. Question 2

    Beginner

    Automation Coding Concepts · Automation scripting fundamentals

    When writing a Bash script to iterate over a list of server IP addresses stored in a text file, which loop construct is most appropriate for reading the file line by line? Select the correct keyword to fill in the blank.

    _____ line in $(cat servers.txt); do
    ping -c 1 $line
    done

    Answer and explanation

    Correct answer: C

    The for loop is used in Bash to iterate over a sequence of items, such as the output of a command substitution like $(cat servers.txt). A while read loop is another valid approach, but the syntax provided specifically matches the for loop structure.

  3. Question 3

    IntermediateMultiple answers

    Automation Coding Concepts · Automation scripting fundamentals

    An automation engineer is refactoring a monolithic PowerShell script into modular functions. The engineer wants to ensure that a custom function accepts parameters explicitly by name and enforces data typing. Which TWO of the following approaches can be used to define parameters for a PowerShell function? (Select TWO)

    Answer and explanation

    Correct answers: A, D

    PowerShell also allows defining parameters in parentheses immediately after the function name, similar to languages like C# or Python (e.g., function My-Func($param1) { }).

    In PowerShell, you can define parameters using the Param() block directly inside the function's curly braces. This is a best practice for advanced functions.

  4. Question 4

    Advanced

    Automation Coding Concepts · Automation scripting fundamentals

    A DevOps team uses a Python automation script to restart critical production services via a third-party REST API. During automated testing in the CI pipeline, the team wants to ensure the script's logic is tested without actually sending HTTP requests to the live production API. Which of the following is the BEST approach to achieve this?

    Answer and explanation

    Correct answer: A

    Mocking is the standard practice for testing code that interacts with external systems. By using a library like unittest.mock (specifically @patch), the team can simulate the API's responses (success, timeout, error codes) without making actual network calls, ensuring the script's logic is fully tested safely.

  5. Question 5

    Beginner

    Automation Coding Concepts · Version control with Git

    A junior administrator has finished editing a Terraform configuration file locally and wants to save this snapshot of the work to their local Git repository history. However, they are not yet ready to share this code with the rest of the team. Which Git command accomplishes this?

    Answer and explanation

    Correct answer: B

    The git commit command saves a snapshot of the staged changes to the local repository history. Because git push is not used, the changes remain local and are not shared with the remote repository.

  6. Question 6

    Beginner

    Automation Coding Concepts · Version control with Git

    According to Semantic Versioning (SemVer) principles, an update to an automation module that introduces backwards-incompatible API changes requires incrementing the MINOR version number.

    Answer and explanation

    Correct answer: A

    False. Semantic Versioning uses a MAJOR.MINOR.PATCH format. Backwards-incompatible changes require incrementing the MAJOR version. The MINOR version is incremented when functionality is added in a backwards-compatible manner.

  7. Question 7

    Advanced

    Automation Coding Concepts · Version control with Git

    A large enterprise uses a strict Git branching strategy for their infrastructure automation code. The team maintains a main branch representing production and a develop branch for integration.

    During a weekend deployment, a critical bug is discovered in production that is causing automated database backups to fail. The development team is currently midway through building several new features in the develop branch.

    Which workflow represents the correct strategy to address this issue while adhering to standard GitFlow principles?

    Answer and explanation

    Correct answer: D

    In GitFlow, a hotfix branch is created directly from main to address critical production bugs immediately. Once fixed, the hotfix must be merged back into main (and tagged with an updated version) and also merged into develop to ensure the fix is included in future releases without pulling unfinished features into production.

    flowchart LR Main((main)) --> Hotfix([hotfix]) Hotfix -->|Merge| Main Hotfix -->|Merge| Develop((develop))

  8. Question 8

    Intermediate

    Automation Coding Concepts · Version control with Git

    An automation team prefers a linear, clean commit history without 'merge commits' cluttering the repository. When a developer pulls changes from the remote tracking branch into their local feature branch, which Git command should they use to place their local commits on top of the remote commits?

    Answer and explanation

    Correct answer: D

    The git pull --rebase command fetches the remote changes and rebases the local branch's commits on top of them. This rewrites the commit history to be linear, avoiding the creation of an extraneous merge commit.

  9. Question 9

    Intermediate

    Automation Coding Concepts · IaC principles

    A cloud architect is explaining the benefits of Infrastructure as Code (IaC) to a new team member. The architect highlights that running the same deployment script multiple times will yield the exact same environment state without creating duplicate resources or causing errors on subsequent runs. Which IaC principle is the architect describing?

    Answer and explanation

    Correct answer: D

    Idempotency in IaC means that applying a configuration multiple times results in the same outcome as applying it once. The tool checks the current state and only makes changes necessary to achieve the desired state, preventing duplicate resource creation.

  10. Question 10

    Advanced

    Automation Coding Concepts · IaC principles

    An organization mandates that server instances must never be modified in-place after they are provisioned. If an operating system patch is required, the automation pipeline must destroy the existing instances and deploy entirely new instances from an updated image. Which Infrastructure as Code (IaC) principle does this strictly enforce?

    Answer and explanation

    Correct answer: D

    Immutability dictates that infrastructure components are never modified after they are deployed. Instead of updating existing servers (mutable infrastructure), changes are made by replacing the old components entirely with new ones. This eliminates configuration drift.

Register free for 10 more questions

Or unlock all 150 AT0-001 questions with explanations, timed mode and flashcards.