nerdexam
Cisco

200-901 · Question #141

FILL BLANK Fill in the blanks to complete the Bash script in which each file in a directory is renamed to its SHA256 hash? TARGET_DIR=/usr/local/certs for f in '__________ __________'; do __________…

The correct answer is C. write and run tests before writing new code. The question stem describes a bash scripting scenario but the answer choices pertain to test-driven development (TDD). Based on the choices and correct answer provided, the question tests knowledge of the TDD methodology.

Infrastructure and Automation

Question

FILL BLANK Fill in the blanks to complete the Bash script in which each file in a directory is renamed to its SHA256 hash? TARGET_DIR=/usr/local/certs for f in '__________ __________'; do __________ $f' openssl sha -sha256 -r < $f | cut -f1 -cl' '' Answer:

TARGET_DIR=/usr/local/certs for f in '/usr/local/certs'; do echo $f' openssl sha -sha256 -r < $f | cut -f1 -cl' ''

Options

  • Awrite documentation for tests
  • Bwrite tests after adding new blocks of code
  • Cwrite and run tests before writing new code
  • Drun tests after writing new code

How the community answered

(55 responses)
  • A
    2% (1)
  • B
    11% (6)
  • C
    84% (46)
  • D
    4% (2)

Why each option

The question stem describes a bash scripting scenario but the answer choices pertain to test-driven development (TDD). Based on the choices and correct answer provided, the question tests knowledge of the TDD methodology.

Awrite documentation for tests

Writing documentation for tests is a documentation practice and is not a defining principle of TDD.

Bwrite tests after adding new blocks of code

Writing tests after adding code describes the traditional 'test-last' approach, which is the opposite of TDD.

Cwrite and run tests before writing new codeCorrect

Test-driven development requires that tests be written and run before any production code is authored. This 'Red-Green-Refactor' cycle - write a failing test, write code to pass it, then refactor - is the defining tenet of TDD and ensures all code has a corresponding test driving its implementation.

Drun tests after writing new code

Running tests after writing code does not conform to TDD, which requires tests to exist and fail before any new production code is written.

Concept tested: Test-driven development core tenet

Source: https://martinfowler.com/bliki/TestDrivenDevelopment.html

Topics

#Bash Scripting#File Operations#SHA256 Hashing#Linux Commands

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice