Curated

Automation, Orchestration, and Scripting

0 votes

All cards113

  1. Which Ansible component is a reusable unit of code that performs a specific task, such as installing a package?

    A module is the unit of work Ansible runs on a managed host, such as the dnf or copy module. A collection is a distribution format that bundles modules, plugins and roles, not a single task unit.

  2. Which Puppet component separates configuration data from manifest code through hierarchical key-value lookups?

    Hiera looks up data from a hierarchy of sources so values stay out of manifests. PuppetDB is a different component: it stores catalogs, facts, and reports, not lookup data for manifests.

  3. Which OpenTofu block type declares an infrastructure object, such as a virtual machine, for OpenTofu to manage?

    A resource block declares an object that OpenTofu creates, updates, and destroys. A data block only reads existing objects and does not manage them.

  4. Which tool configures a cloud VM image at first boot using user-data supplied by the provider?

    Cloud-init reads user-data and metadata from the cloud provider on first boot to set up hostname, users, packages and keys. Kickstart automates the Anaconda installer from installation media rather than customizing a prebuilt cloud image.

  5. In a CI/CD workflow, a series of automated stages that builds, tests, and releases code after each commit is called a ___.

    pipeline

  6. In Kubernetes, a Deployment manages a ___ object to keep the declared number of identical pod replicas running and to handle rolling updates.

    ReplicaSet

  7. In a Docker Swarm cluster, a node that runs the Raft consensus store and can schedule services is called a ___ node.

    manager

  8. Which option makes docker compose logs keep streaming new log output instead of exiting?

    --follow (-f) keeps streaming new log lines as services write them. --tail only limits how many existing lines are shown, then the command exits.

  9. In Bash, which parameter expansion returns the number of characters in the value of the variable name?

    ${#name} expands to the length of the value of name. ${!name} is indirect expansion, which uses the value of name as the name of another variable.

  10. Inside a Bash function body, which variable holds the first argument passed to the function?

    Inside a function, $1 refers to the function's own first argument, not the script's. $0 is the script name, $# is the argument count, and $@ expands to all arguments.

  11. Which bash assignment sets IFS to a single newline character?

    The $'...' ANSI-C quoting form turns \n into a real newline. In single or double quotes, \n stays a literal backslash and n, and unquoted \n becomes just the letter n.

  12. Which case pattern acts as the catch-all for values not matched by earlier patterns?

    The *) pattern matches any string, so placed last it serves as the default branch. The ?) pattern matches only a single character, and Bash case has no default or else keyword.

  13. Which keyword terminates the body of a Bash for, while, or until loop?

    done closes the loop body that begins with do. fi ends an if block and esac ends a case block.

  14. Which shebang line finds python3 through the user's PATH instead of a hardcoded location?

    /usr/bin/env searches PATH for python3, so the script runs wherever the interpreter is installed. A direct path such as /usr/bin/python3 only works if the interpreter is at exactly that location.

  15. Which operator in [[ ]] tests whether a string matches a regular expression?

    The =~ operator matches the left string against the extended regular expression on the right. The == operator only compares strings or glob patterns, and -eq compares integers.

  16. Which Bash array holds the matched text and capture groups after a successful [[ $foo =~ regex ]] test?

    BASH_REMATCH holds the full match at index 0 and each parenthesized group at the following indexes. PIPESTATUS stores exit codes from the last pipeline, not regex matches.

  17. In a shell script, the test expression [ -f /etc/hosts ] returns true only if /etc/hosts exists and is a ___ file.

    regular

  18. Running ___ MYVAR removes the variable MYVAR from the current shell so that it no longer has a value.

    unset

  19. Which command records a virtual environment's installed packages and exact versions in a file that pip install -r can read?

    pip freeze prints every installed package as name==version, the format pip install -r expects. pip list --outdated shows only upgradable packages in a table, not a reusable requirements file.

  20. Which Python data type is the value {'host': 'web01', 'port': 22}?

    A dict stores key-value pairs inside curly braces. A list uses square brackets and holds ordered items without keys.

  21. Which naming style does PEP 8 recommend for constants such as a default timeout?

    PEP 8 recommends UPPER_CASE_WITH_UNDERSCORES for constants, such as MAX_RETRIES. Lowercase with underscores is for functions and variables, and CapitalizedWords is for class names.

  22. Which Git command temporarily shelves uncommitted changes so you can switch branches with a clean working tree?

    git stash saves modified tracked files onto a stack and restores a clean working tree; git stash pop brings them back. git reset --hard also cleans the tree but permanently discards the changes.

  23. Which AI use case rewrites a slow Bash loop to reduce execution time without changing its output?

    Code optimization improves the performance or efficiency of existing code while preserving its behavior. Code linting only flags syntax, style, or likely errors and does not restructure code for speed.

  24. Which deployment option keeps sensitive prompts and data on infrastructure your organization controls?

    A local self-hosted model processes prompts on organization-controlled systems, so sensitive data is not sent to an outside provider. Public services may retain prompts or use them for LLM training.

  25. Telling an AI to respond only with a JSON object rather than prose specifies the desired output ___.

    format

  26. An Ansible ___ is a YAML file that contains one or more plays, each mapping a group of hosts to an ordered list of tasks.

    playbook

  27. The Puppet server compiles a ___ for each agent, a document that describes the desired state of every resource on that node.

    catalog

  28. Running the command tofu ___ in a new working directory downloads the required providers and prepares the directory for other OpenTofu commands.

    init

  29. On a RHEL system, the ___ boot option tells the installer where to find the Kickstart file for an unattended installation.

    inst.ks

  30. (image)

    Each term is a core concept or practice in modern CI/CD workflows, from source tracking and early validation to declarative deployment and build outputs.

  31. (image)

    All five are Kubernetes workload controller objects that create and manage pods, each with a different placement, identity or lifecycle behavior.

  32. (image)

    All five describe how Docker Swarm places, exposes, groups and schedules workloads across the nodes of a cluster.

  33. To list the containers of the current Compose project along with their status and published ports, run docker compose ___.

    ps

  34. In Bash, if name is set to reading, the expansion ${name:0:4} returns the string ___.

    read

  35. In Bash, the body of a function definition is typically a list of commands enclosed in curly ___.

    braces

  36. A script that parses /etc/passwd with read sets IFS=___ so that each line is split at its field delimiter.

    :

  37. Inside single brackets in a Bash if statement, the operator ___ tests whether two integers are numerically equal.

    -eq

  38. The Bash loop `for n in $(seq 2 2 10); do echo $n; done` prints a total of ___ lines of output.

    5

  39. A script written for the POSIX sh shell, located at its conventional absolute path, begins with the line #!___ so the kernel launches that interpreter.

    /bin/sh

  40. To test in a Bash [ ] expression whether integer $a is not equal to integer $b, use the ___ operator.

    -ne

  41. To make [[ $foo =~ ^[0-9]+ ]] succeed only when the whole value of foo is digits, add the ___ anchor character at the end of the pattern.

    $

  42. (image)

    All six are operators used inside a shell test expression to check a file attribute, check a string, or negate the result.

  43. (image)

    Each term is a shell mechanism for defining, scoping, or reading values and shortcuts within a script or session.

  44. After running python3 -m venv .venv, the command source .venv/bin/___ must be run in a Bash shell so that the python and pip commands point to the virtual environment.

    activate

  45. In Python, the value ['root', 'admin', 'guest'] is an ordered, changeable collection known as a ___.

    list

  46. PEP 8 recommends limiting all lines of code to a maximum of ___ characters.

    79

  47. To upload your local commits on the main branch to the remote named origin, run git ___ origin main.

    push

  48. Asking an AI assistant to draft a README and inline comments that describe what an existing Bash backup script does is an example of using AI for ___ generation.

    documentation

  49. Content entered into a public AI chatbot may be retained and used for LLM ___, so confidential company data should not be submitted to it.

    training

  50. (image)

    Each term is a distinct technique or component used when crafting a prompt to get a more accurate and useful AI response.