exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 165 discussion

Actual exam question from Cisco's 200-901
Question #: 165
Topic #: 1
[All 200-901 Questions]

Refer to the exhibit.

What is the action of the Bash script that is shown?

  • A. For all directories in the current folder, the script goes into the directory and makes a new directory.
  • B. The script waits until input is entered. If the directory exists, the script goes into it until there is no directory with the same name, then it creates a new directory.
  • C. The script waits until input is entered, then it goes into the directory entered and creates a new directory with the same name.
  • D. The script goes into the directory called ג€$ndirג€ and makes a new directory called ג€$ndirג€.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jonasff
Highly Voted 4 years, 7 months ago
Have tested with shell script and B is the answer.
upvoted 31 times
...
FireTv
Highly Voted 4 years, 7 months ago
B is the answer
upvoted 15 times
...
kymoni
Most Recent 10 months ago
Selected Answer: B
Answer B
upvoted 1 times
...
macxsz
2 years, 7 months ago
Selected Answer: B
Very obvious it is B
upvoted 2 times
...
DenskyDen
3 years, 10 months ago
Should be B. https://linuxhint.com/30_bash_script_examples/
upvoted 4 times
...
uzbin
4 years, 1 month ago
tested script in shell. It is B. read = Ask user for input saved as $ndir (DIR NAME) check if this exists - if yes, cd into it. if not exist - create $ndir.
upvoted 6 times
...
bpbenabd
4 years, 3 months ago
I have tested this bash script, so the correct answer is B
upvoted 3 times
...
garcesdavid88
4 years, 4 months ago
the answer is B
upvoted 3 times
...
TechBrain
4 years, 6 months ago
I tested. The answer is B. The script waits until input is entered. So A & D are wrong. The script creates the folder if id doesn’t exist. So C is wrong “goes into the directory entered”.
upvoted 5 times
psyborg
4 years, 5 months ago
I also tested the script and it does that. read command waits for input and then assigns the input to the variable ndir. the while command checks if a directory with that name exists, if it does, it will cd into that directory and then loop and check again if there is a directory with that name. When it no longer finds a directory with that name, it will create one: Here is the script run three times. Each time it is run, it waits and I type the word "folder" and hit enter key. $ cat ../ndir.sh #!/bin/bash read ndir while [ -d $ndir ] do cd $ndir done mkdir $ndir $ $ tree . 0 directories, 0 files $ ../ndir.sh folder $ tree . └── folder 1 directory, 0 files $ ../ndir.sh folder $ tree . └── folder └── folder 2 directories, 0 files $ ../ndir.sh folder $ tree . └── folder └── folder └── folder 3 directories, 0 files $
upvoted 9 times
...
...
afsarmahmood
4 years, 6 months ago
B is the answer.
upvoted 9 times
...
ReadTheDoc
4 years, 7 months ago
A is correct. B is wrong because there is no sleep <time> command here for the script to wait.
upvoted 1 times
geex
3 years, 11 months ago
read ndir waits for input on stdin, so the correct answer is B
upvoted 2 times
...
...
JM_Lee
4 years, 7 months ago
I think C
upvoted 3 times
JM_Lee
4 years, 7 months ago
sorry.. B
upvoted 10 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...