Free CompTIA AT0-001 Practice Questions 2026 - Page 2
Automation Coding Concepts
Match the text-processing task to its tool.
Search matching log lines
Extract a JSON field
Print whitespace-delimited fields
A. grep
B. awk
C. jq
Supplied source solution: Search matching log lines -> A. grep; Extract a JSON field -> C. jq; Print whitespace-delimited fields -> B. awk
Explanation:
Searching matching log lines maps to A, grep, because it selects lines containing a pattern. Extracting a JSON field maps to C, jq, which understands JSON values and property access. Printing whitespace-delimited fields maps to B, awk, which provides field references such as $2. The appropriate tool depends on the data structure being processed. Import review: The source solution is preserved above. The sample does not establish the application's ColumnMatch answer representation, so the existing answer-storage fields remain unchanged.
Why the other options are incorrect:
Not applicable: the supplied items are sequence steps or matching choices, rather than incorrect distractors.
References:
GNU grep: matching lines
GNU awk: fields
jq manual: filters and iteration
Which command prints lines containing ERROR from app.log?
A. git add app.log
B. grep 'ERROR' app.log
C. jq '.ERROR' app.log
D. chmod ERROR app.log
Answer Option (Which option is correct) B. grep 'ERROR' app.log
Explanation:
grep searches the named file and prints each line containing a match for ERROR. The quoted pattern is passed as one shell argument, and app.log is the input file. Without additional options, matching is case-sensitive, which fits the uppercase text specified in the question.
Why the other options are incorrect:
A. git add app.log:
git add stages file content for a commit. It does not select matching log lines. The operator needs a text-search command.
C. jq '.ERROR' app.log:
jq expects structured JSON input. The expression selects a property rather than finding arbitrary text lines. A plain application log is not necessarily a JSON document.
D. chmod ERROR app.log:
chmod changes filesystem permissions. It does not search log contents for an error pattern. ERROR is not a valid symbolic permission mode here.
References:
GNU grep: matching lines
A space-delimited file contains host and status. Which tool naturally prints the second field?
A. git fetch file
B. curl -X POST file
C. sed -n '$2' file
D. awk '{print $2}' file
Answer Option (Which option is correct) D. awk '{print $2}' file
Explanation:
awk splits ordinary input records into whitespace-delimited fields by default. Its $2 reference selects the second field, and print writes that field for each record. This directly extracts the status column from the stated host-and-status file.
Why the other options are incorrect:
A. git fetch file:
git fetch downloads repository objects and references. It does not split this text record into fields. The status column remains unextracted.
B. curl -X POST file:
curl sends or retrieves data through supported protocols. POST does not mean print a text field. A local field-processing expression is needed.
C. sed -n '$2' file:
The proposed sed expression is not an awk field reference. sed does not interpret dollar-two as the second whitespace field here. This command does not implement the requested extraction.
References:
GNU awk: fields
Which command replaces every old-host occurrence with new-host in its output?
A. grep new-host file
B. sed 's/old-host/new-host/g' file
C. awk '{print $1}' file
D. git config old-host
Answer Option (Which option is correct) B. sed 's/old-host/new-host/g' file
Explanation:
The sed s command substitutes the replacement text for the matched text. The g flag applies the substitution to every match on each processed line, rather than only the first occurrence. This command writes transformed output; it does not modify the original file in place because no in-place option is supplied.
Why the other options are incorrect:
A. grep new-host file:
grep selects lines matching a pattern. This expression searches for the replacement name. It does not substitute occurrences of the old name.
C. awk '{print $1}' file:
The proposed awk expression prints the first field. It does not perform the specified substitution. Other fields can also be omitted from its output.
D. git config old-host:
git config manages Git settings. It is not a stream substitution tool. It cannot perform this file-content replacement as written.
References:
GNU sed: substitution command
Choose TWO PowerShell practices that preserve structured processing.
A. Filter objects before formatting
B. Discard properties before filtering
C. Select properties from pipeline objects
D. Parse table spacing as the primary interface
C. Select properties from pipeline objects
Answer Option (Which option is correct) A. Filter objects before formatting
Answer Option (Which option is correct) C. Select properties from pipeline objects
Explanation:
Option A filters the pipeline's objects while their properties are still available for comparisons. Option C selects the required properties from those objects. Formatting should normally happen at the display boundary, because formatted table output is a poor substitute for the underlying structured data.
Why the other options are incorrect:
B. Discard properties before filtering:
Discarding properties removes data needed for property-based tests. Later filters may no longer see the original object values. Filtering should happen while the structured objects are intact.
D. Parse table spacing as the primary interface:
Table spacing is presentation formatting rather than a stable data interface. Display widths and truncation can change. Object properties are a more reliable automation input.
References:
Microsoft PowerShell: object pipelines
Order a basic Python dependency preparation workflow.
|
Install declared requirements
Activate or select that environment
Run dependency and application checks
Create an isolated environment
|
|
Supplied source solution: A. Create an isolated environment -> C. Activate or select that environment -> B. Install declared requirements -> D. Run dependency and application checks
Explanation:
Create the isolated environment first, then activate it or explicitly select its interpreter. Install the declared requirements into that selected environment before running dependency and application checks. This sequence prevents accidental installation into another interpreter and ensures validation uses the prepared dependencies. Import review: The source solution is preserved above. The sample does not establish the application's Ordering answer representation, so the existing answer-storage fields remain unchanged.
Why the other options are incorrect:
Not applicable: the supplied items are sequence steps or matching choices, rather than incorrect distractors.
References:
Python: virtual environments
pip: repeatable installations
Choose TWO practices that improve repeatable container builds.
A. Always use unqualified latest
B. Download arbitrary unsigned scripts
C. Pin the base image digest
D. Pin tested dependencies
D. Pin tested dependencies
Answer Option (Which option is correct) C. Pin the base image digest
Answer Option (Which option is correct) D. Pin tested dependencies
Explanation:
Option C pins the base image by digest, identifying the intended image content. Option D fixes the tested dependency versions instead of allowing uncontrolled updates. These controls improve repeatability, although the complete build also depends on the remaining declared inputs and build process.
Why the other options are incorrect:
A. Always use unqualified latest:
The latest tag can point to different images over time. Identical source can therefore use a different base on later builds. An immutable digest gives a more precise build input.
B. Download arbitrary unsigned scripts:
Arbitrary unsigned scripts have uncontrolled origin and content. Their behavior can change without a reviewed dependency update. Verified and deliberately selected inputs offer better reproducibility.
References:
Docker: build best practices
pip: repeatable installations
Python prints len(["web1","web2","web3"]). What is the result?
A. web3
B. 2
C. 3
D. 1
Answer Option (Which option is correct) C. 3
Explanation:
len counts the elements of the list rather than the characters in each host name. The list contains web1, web2, and web3 as three separate elements. The expression therefore returns the integer 3.
Why the other options are incorrect:
A. web3:
web3 is an element of the list. len returns a count rather than that element. The result must be numeric.
B. 2:
2 undercounts the list's elements. The list includes three separate strings. A last zero-based index is not the same as length.
D. 1:
1 would count only one item. All three strings are separate list elements. The containing list has a larger length.
References:
Python: built-in types
Python: functions and control flow
A script receives a host name containing spaces. What avoids shell argument splitting?
A. Remove all quotes
B. Quote the variable expansion
C. Append a semicolon
D. Use git push
Answer Option (Which option is correct) B. Quote the variable expansion
Explanation:
Quoted variable expansion keeps a value containing spaces together as one shell argument. That prevents the shell from splitting the value into separate words before invoking the command. The supplied answer is appropriate for an arbitrary input label, but the phrase "host name containing spaces" needs editorial review because a conventional DNS hostname does not contain spaces.
Why the other options are incorrect:
A. Remove all quotes:
Removing quotes permits word splitting after expansion. Spaces can become argument boundaries. This undermines the required single-value handling.
C. Append a semicolon:
A semicolon separates shell commands. It does not protect spaces inside an expanded value. Argument quoting remains necessary.
D. Use git push:
git push transfers repository changes. It has no role in the shell's argument parsing. It cannot prevent expansion-based splitting.
References:
GNU Bash: double quotes
Python evaluates 5 > 3 and 2 > 4. What is the result?
A. FALSE
B. 5
C. An empty list
D. TRUE
Answer Option (Which option is correct) A. FALSE
Explanation:
The comparison 5 > 3 is true, while 2 > 4 is false. For this pair of Boolean operands, and is true only when both comparisons are true. The combined result is therefore False, represented by the source option FALSE.
Why the other options are incorrect:
B. 5:
5 is an operand in a comparison. That comparison produces a Boolean here. It does not make the complete expression return the number.
C. An empty list:
An empty list is not an operand in this expression. Both subexpressions are comparisons. Their conjunction does not construct a collection.
D. TRUE:
True would require both comparisons to be true. The second comparison is false. The conjunction therefore fails.
References:
Python: built-in types
Python: functions and control flow
| Page 2 out of 22 Pages |