Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Exam 101-500 topic 1 question 96 discussion

Actual exam question from LPI's 101-500
Question #: 96
Topic #: 1
[All 101-500 Questions]

What is the output when the regular expression s/[ABC] [abc]/xx/ is applied to the following string?

ABCabc -

  • A. ABxxbc
  • B. xxCxxc
  • C. xxxxxx
  • D. ABCabc
  • E. Axxaxx
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
cast7omadrid1
Highly Voted 3 years ago
The correct answer is A -> ABxxbc. You have to try it inside a file, open it with vim and do :s/[ABC] [abc]/xx/
upvoted 25 times
...
sugisho
Highly Voted 2 years, 4 months ago
[[email protected] ~]# echo "ABCabc" | sed "s/[ABC] [abc]/xx/" ABCabc [[email protected] ~]# echo "ABCabc" | sed "s/[ABC][abc]/xx/" ABxxbc
upvoted 20 times
...
DjBouz
Most Recent 2 days, 17 hours ago
The correct answer is A
upvoted 1 times
...
totalchod
1 week, 6 days ago
Selected Answer: A
the answer is a
upvoted 1 times
...
Adam_H
2 months ago
Selected Answer: D
Running the command echo "ABCabc" | sed "s/[ABC] [abc]/xx/" in Ubuntu 20.04 returns the result "ABCabc", so the correct answer is D.
upvoted 1 times
Adam_H
2 months ago
I just passed the test today, and they do NOT have a space between [ABC][abc], so the correct answer is ABxxbc.
upvoted 3 times
...
Adam_H
2 months ago
I just realized that the question does not have quotes around s/[ABC] [abc]/xx/ so it returns error "sed: -e expression #1, char 7: unterminated `s' command", which means the question currently has an error. Running the command without quotes or a space returns "ABxxbc", so I don't know which one is correct.
upvoted 1 times
...
...
Iamrandom
3 months, 1 week ago
[[email protected] ~]# echo "ABCabc" | sed s/[ABC][abc]/xx/ <--- no space, no quotes ABxxbc [[email protected] ~]# echo "ABCabc" | sed s/[ABC] [abc]/xx/ <--- with space, no quotes sed: -e expression #1, char 7: unterminated `s' command [[email protected] ~]# echo "ABCabc" | sed "s/[ABC] [abc]/xx/" <--- with space, with quotes ABCabc So either A or D depending if there's a typo or not.
upvoted 3 times
...
TT924
3 months, 2 weeks ago
Selected Answer: A
A for sure
upvoted 1 times
...
meer01
4 months, 2 weeks ago
Selected Answer: A
Used with sed, retuns A
upvoted 1 times
...
Wellison
6 months, 3 weeks ago
Selected Answer: D
[[email protected] ~]# echo "ABCabc" | sed "s/[ABC] [abc]/xx/" resultado com espaço "s/[ABC] [abc]/xx/" D = ABCabc
upvoted 2 times
Wellison
6 months, 3 weeks ago
[[email protected] ~]# echo "ABCabc" | sed "s/[ABC][abc]/xx/" resultado sem espaço "s/[ABC][abc]/xx/" A = ABxxbc
upvoted 1 times
...
...
Lazylinux
10 months, 3 weeks ago
Selected Answer: A
Definitely A, Tested and as per below comment on how to test it
upvoted 1 times
...
gonzaloco
11 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
KiddyLitty
11 months, 1 week ago
s/[ABC] [abc]/xx/ (with a space) cannot run without single quote. In the question, there is no quote. Answer should be A.
upvoted 2 times
...
MartiFC
1 year, 1 month ago
Selected Answer: A
FOR ME IS A
upvoted 1 times
...
k3n_
1 year, 1 month ago
Selected Answer: D
$ echo ABCabc | sed 's/[ABC] [abc]/xx/' ABCabc Note there is a whitespace in the question: [ABC]<whitespace>[abc]. Correct Answer: D
upvoted 2 times
...
minhng99
1 year, 2 months ago
It's a trick question, the answer is A, it's trying to replace the "C a" -> "xx"
upvoted 1 times
...
anhcq
1 year, 3 months ago
Selected Answer: A
tested, correct answer is A
upvoted 1 times
...
KicoRox
1 year, 5 months ago
The correct answer is A, becuase its trying to change 2 characters, and the only part in the string where there is a single uppercase and lowercase ABC or abc next to each others ir right in the middle, where AB->Ca<-bc which gets changed to xx, so ABxxbc
upvoted 4 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 ...