Search matching log lines Extract a JSON field Print whitespace-delimited fields
Show answerHide answer
Explanation
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.
Which command prints lines containing ERROR from app.log?
Show answerHide answer
Correct answer: Bgrep 'ERROR' app.log
Explanation
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.
A space-delimited file contains host and status. Which tool naturally prints the second field?
Show answerHide answer
Correct answer: Dawk '{print $2}' file
Explanation
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.
Which command replaces every old-host occurrence with new-host in its output?
Show answerHide answer
Correct answer: Bsed 's/old-host/new-host/g' file
Explanation
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.
Choose TWO PowerShell practices that preserve structured processing.
Show answerHide answer
Correct answer: A, CFilter objects before formattingSelect properties from pipeline objects
Explanation
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.
Order a basic Python dependency preparation workflow.
Show answerHide answer
Explanation
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.
Choose TWO practices that improve repeatable container builds.
Show answerHide answer
Correct answer: C, DPin the base image digestPin tested dependencies
Explanation
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.
Python prints len(["web1","web2","web3"]). What is the result?
Show answerHide answer
Correct answer: C3
Explanation
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.
A script receives a host name containing spaces. What avoids shell argument splitting?
Show answerHide answer
Correct answer: BQuote the variable expansion
Explanation
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.
That's the last free question in Automation Coding Concepts
You've seen the free 30% (19 of 65 questions). Full access unlocks every question and full-length AT0-001 mock exams (60 questions, 60 minutes), a different mock on every attempt.
Full-length mocks with the same number of questions and the same time limit as the real AT0-001 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.