LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Interview Fail Question (https://www.linuxquestions.org/questions/linux-newbie-8/interview-fail-question-4175545719/)

MrLinuxDonnelly 06-18-2015 03:24 AM

Interview Fail Question
 
Morning All,

I had this question yesterday and after being up 13 hours straight and then going to an interview i completely had a brain lapse and still am having one trying to figure the answer to this.

below is the contents of a file :

BANCA ITALIA IT2920c08378
BANK OF MILAN IT28376152a7

You need to change the IT in the end string to FR without effecting any other IT's within the file.

I straight away thought of a sed statement however since i cant seem to do it.

syg00 06-18-2015 04:04 AM

sed will certainly do it - best to use the "$" anchor; say IT([[:xdigit:]]+$)

MrLinuxDonnelly 06-18-2015 04:19 AM

Quote:

Originally Posted by syg00 (Post 5379160)
sed will certainly do it - best to use the "$" anchor; say IT([[:xdigit:]]+$)

What would the actual command be ?

syg00 06-18-2015 04:57 AM

How would it look it I gave you the whole answer ..... :tisk:
You gotta put in some effort for those interviews .... :p

rtmistler 06-18-2015 06:34 AM

Quote:

Originally Posted by syg00 (Post 5379178)
How would it look it I gave you the whole answer ..... :tisk:

Shaking head, rolling eyes in agreed commiseration.

I seriously doubt that this eentsy, little question was the whole downfall of an interview that was one question away from being a done deal.
Quote:

Originally Posted by syg00 (Post 5379178)
You gotta put in some effort for those interviews .... :p

@OP perhaps you ought to consider a couple of possible points here, such as why you were up 13 hours straight before this interview. Which is not so amazing when you think about it. Gee, I sleep about 7-8 hours per night, therefore I'm "up" for 16 or more hours per day. Pretty much we ALL are.

If you had to pull an all night study session for some interview, then you aren't qualified for the job.

If the reason instead was because you stayed up late due to some other reason, then whatever kept you up late was obviously more important to you.

Either case, a lack of sleep is not the end of the world, your abilities did not suddenly disappear because you had a difficult preceding day and night before this interview. One little question does not break an interview.

I submit that most interviewers, especially if they feel a person is competent and happened to ask that question of you, and your response was "I'm thinking that I'd use sed for this, but the exact syntax escapes me right now, I'd have to work that through on a terminal or re-look up my regular expressions to get it right, but I do realize the problem here is that the search term appears in areas beyond the intended change points ...", in that case I feel a forgiving interviewer who already feels you're pretty close to being qualified, would let that one slide. I'm thinking here that you were always a stretch for this particular job and not being able to answer this question was just one more brick in the wall.

HMW 06-18-2015 07:32 AM

Hmm... I think I'm gonna try to solve this myself. I like fiddling with sed.

syg00 has pretty much given us the solution, now we just need to implement it properly.

Edit:
Ok, after a bit of trial and error this seems to work
Code:

sed 's/IT\([0-9]\)/FR\1/g'
Might not be as foolproof as what syg00 suggested, but still.

jefro 06-18-2015 07:28 PM

HMW, it was nice of you to provide a way. Can you also explain it?


I'm not for or against full answers. To each their own. I'd teach younger people by having them do some work however. It doesn't seem mean to me to have a user work a bit.

HMW 06-19-2015 04:53 AM

Quote:

Originally Posted by jefro (Post 5379558)
HMW, it was nice of you to provide a way. Can you also explain it?

I'll do my best, since I am now sitting in front of a machine running Windows 7.
Code:

sed 's/IT\([0-9]\)/FR\1/g'
s/IT\([0-9]\):
Search for the capital letters IT followed by any digit in the range 0-9. The round brackets also saves the digit.

/FR\1/g:
Replace the letter IT with the letters FR, and put the saved digit back after FR with \1. Do it globally by using 'g'.

I hope that made sense!

JeremyBoden 06-19-2015 06:46 AM

Quote:

Originally Posted by MrLinuxDonnelly (Post 5379149)
below is the contents of a file :

BANCA ITALIA IT2920c08378
BANK OF MILAN IT28376152a7

You need to change the IT in the end string to FR without effecting any other IT's within the file.

This is a typically stupid interview question.
Why would you want to change the country code of two Italian banks to France?

They obviously couldn't be bothered to formulate a realistic situation. :doh:

rtmistler 06-19-2015 07:12 AM

Quote:

Originally Posted by JeremyBoden (Post 5379749)
This is a typically stupid interview question.
Why would you want to change the country code of two Italian banks to France?

They obviously couldn't be bothered to formulate a realistic situation. :doh:

I never ask "canned" questions. Instead I ask the person to describe what they've worked on. Be they student or someone who has worked, they've typically done a project of some type, which they should be able to describe well enough to me to convince me that they understand what they've done.

Death therefore is to have a primary talent highlighted on your resume and know absolutely zip about it. Which of course NEVER happens! :rolleyes:

TenTenths 06-19-2015 09:50 AM

Quote:

Originally Posted by rtmistler (Post 5379764)
I never ask "canned" questions.

I've a list of 50 "canned" questions, 23 of which get asked in a telephone interview that should take no more than 20 minutes. Candidates get graded 0 to 5 depending on their answer, the time taken, the way the answer is communicated etc. I use this method to pre-screen candidates before a face-to-face, where the other questions may or may not get asked.

If the candidate gets more than 50 at 3 or above they stand a good chance of getting brought in for a more conventional face-to-face where we talk about experience, projects and do a drill-down.

I've had several people apply for operations admin jobs that have scored extremely low on the first 23 questions, including one guy that answered 20 out of the 23 with "I don't know".

Each company and each interviewer has their own methods.

allend 06-19-2015 10:10 AM

The question goes to the ability to write regular expressions.
An additional finesse would be to use the sed capability to match an exact number of sequences.
Code:

sed 's:IT\(.\{10\}$\):FR\1:'

dugan 06-19-2015 10:23 AM

This is all you need:

Code:

sed 's/IT28/FR28/g'

rtmistler 06-19-2015 10:33 AM

Quote:

Originally Posted by TenTenths (Post 5379849)
I've a list of 50 "canned" questions, 23 of which get asked in a telephone interview that should take no more than 20 minutes. Candidates get graded 0 to 5 depending on their answer, the time taken, the way the answer is communicated etc. I use this method to pre-screen candidates before a face-to-face, where the other questions may or may not get asked.

If the candidate gets more than 50 at 3 or above they stand a good chance of getting brought in for a more conventional face-to-face where we talk about experience, projects and do a drill-down.

I've had several people apply for operations admin jobs that have scored extremely low on the first 23 questions, including one guy that answered 20 out of the 23 with "I don't know".

Each company and each interviewer has their own methods.

You're evil! :eek: (Making devil sign with my hand and hissing)

OK sorry, no offense intended. I really am joking and actually DO understand how that is applicable for your situation and the jobs you interview people for.

My situation has always been R&D. New college hires know nothing, but what they've studied. They need to at least talk about their theory courses enough to convince me that they really are a B.S.E.E. student.

For everyone else, you've worked on "something", and if you can't even talk about that, then "get outta my face".

Yeah, plenty of stories ...

Habitual 06-19-2015 11:07 AM

Quote:

Originally Posted by TenTenths (Post 5379849)
one guy that answered 20 out of the 23 with "I don't know".

Which is a perfectly acceptable answer in my book, (but 20/23? that's Scary). One has to know what he doesn't know and be able to admit it.
Also knowing when one doesn't know is a good thing.

"I don't know, but I can find out" has been my answer to some Interview Questions in the past.


All times are GMT -5. The time now is 07:16 PM.