• Andy (unregistered)

    I was at an interview for a C position. The interviewer asked how to declare and allocate a two dimentional array as an array of pointers. I got that one right, he seemed satisfied and asked how I would reference an element knowing the index values. My reply was that you reference it as nested pointers, but the easy way is to use subscripts like a normal array.

    "No, that can't work. The memory layout is different from an array."

    "True, but the compiler knows the difference and will generate the correct code."

    He paused, and said "excuse me for a moment." He turned his chair around and typed in a program, compiled and ran it.

    I got the job. We worked together for several years at a few different jobs. I still consider him a good friend.

  • foo (unregistered) in reply to snoofle
    snoofle:
    emurphy:
    lemonhead:
    a-ha - So it was the good ol' 8 coin question. You have 8 identical coins and a balance scale. 1 of the 8 coins weighs more than the others. What is the least number of times you can use the scale to find out the 1 coin that weighs more than the other 7? I like that one.

    Friendly nitpick: "identical-looking".

    If it actually was 8 coins, then I bet I not only know the two-weighing solution, but also know the non-optimal three-weighing solution that the interviewer had in mind.

    If you like this sort of thing, then I recommend rec.puzzles (if you dig old-school Usenet and/or nitpicking) and/or groups.yahoo.com/group/puzzleteasers (you have to deal with English written with a Bangalore accent, but that's probably a useful skill in IT anyhow).

    For the benefit of those who don't know the answer:

    Simple answer: binary search: split 4-and-4, then 2-and-2, then 1-and-1: 3 weighings

    Better answer: split into groups of 3, 3 and 2, and weigh 3-and-3

    if 3-and-3 are the same, it must be one of the other two: weigh them 1-and-1: 2 weighings

    if 3-and-3 are different: take the lighter (or heavier - depending upon whether you're looking for the lighter or heavier item), and weight any 2 of them as: 1-and-1 --- if the 1-and-1 are the same, it's the third one: 2 weighings --- if the 1-and-1 are different, it's the lighter (heavier) one: 2 weighings

    Now try the same problem, but you only know one coin is different, but don't know whether it is heavier or lighter.

    Anyway, to get back on-topic, I signed up for a bunch of interviews in school without paying close enough attention. When I got to IBM, the interviewer asked me how I would like Rochester. I told him I was born in upstate NY. Turns out the plant was in Rochester, Minn. Oh well.

  • (cs) in reply to Alan
    Alan:
    I mucked up my last post. I typed the correct code, the code in the exam was:

    string s = ""; for (int a = 1; a <= 5; a++) { s += "\r\n" + a + ":"; for (int j = 1; j <= 5; a++) { s += j; } } Console.WriteLine(s);

    Thank god, cos I was banging my head for a moment trying to find the problem in the first one...

  • Picky bugger (unregistered) in reply to AndrewB
    AndrewB:
    emurphy:
    lemonhead:
    a-ha - So it was the good ol' 8 coin question. You have 8 identical coins and a balance scale. 1 of the 8 coins weighs more than the others. What is the least number of times you can use the scale to find out the 1 coin that weighs more than the other 7? I like that one.

    Friendly nitpick: "identical-looking".

    If it actually was 8 coins, then I bet I not only know the two-weighing solution, but also know the non-optimal three-weighing solution that the interviewer had in mind.

    If you like this sort of thing, then I recommend rec.puzzles (if you dig old-school Usenet and/or nitpicking) and/or groups.yahoo.com/group/puzzleteasers (you have to deal with English written with a Bangalore accent, but that's probably a useful skill in IT anyhow).

    Could everyone in this thread really have missed this?

    The answer is 1.

    The question is "What is the least number of times you can use the scale to find out the 1 coin that weighs more than the other 7?". And of course, we can assume that the coins are "identical in appearance" and not actually identical. If they were identical, then the problem would have contradicted itself, and therefore be invalid. Anyway...

    The problem does not specify how much heavier the heavy coin really is. Because the scenario is wide open, we are free to speculate that the heavy coin might weigh more than all the other coins combined. Therefore, you CAN (if lucky) determine with absolutely certainty the heavier coin in 1 step. It's plainly obvious: If you, by chance, happen to put the heavy coin on one side and all the other coins on the other side, and the 1-coin side wins, then you have solved the problem in 1 step.

    Yes yes, common sense would dictate that binary search is the best way to solve the problem. However, that is not relevant to the question poised. Study the problem over and over if you wish. Put forth solutions on how to fix the wording of the problem so that 2 is the correct answer. It doesn't matter. For the problem, as it was written, the answer is 1.

    If you want to be REALLY picky, then the answer could be 0. Assume that one of the coins is substantially heavier than the other ones (depleted uranium or something like that vs aluminium). You'd be able to pick it out by hand and would not need the scales at all ;-)

  • Andrew (unregistered) in reply to jisakujien
    jisakujien:
    At least you didn't have a school teacher send a letter home because you would not accept that a mile was shorter than a kilometer.

    This is actually true in some cases! A very high-speed projectile can appear to go one mile in a shorter distance than one kilometer. This "Length Contraction" is a consequence of relativity.

    Yes, I know, the projectile's length contracts, not the frame (mile) it runs on. But this is all about schooling people!

  • Eddie (unregistered)

    I walked out of one of the best job interviews I ever had feeling like it was a disaster. I was shocked when I got a call and an offer mere hours later. The reason was that I aced all the junior-level questions, did ok at the intermediate level quesations, but when the interviewer began asking high-level questions I spent what seemed like an eternity repeating things like, "I don't know. I'm not familiar. I haven't had experience with that."

    I ended up being hired solely on my ability to competently explain concepts that I knew and honestly admit when I did not know something instead of trying to bluff through it.

    Important life lesson that I will never forget.

  • (cs) in reply to amandahugginkiss
    amandahugginkiss:
    AndrewB:
    The problem does not specify how much heavier the heavy coin really is. Because the scenario is wide open, we are free to speculate that the heavy coin might weigh more than all the other coins combined. Therefore, you CAN (if lucky) determine with absolutely certainty the heavier coin in 1 step. It's plainly obvious: If you, by chance, happen to put the heavy coin on one side and all the other coins on the other side, and the 1-coin side wins, then you have solved the problem in 1 step.

    If the coin was that heavy, you wouldn't need a scale to determine the difference. If the coin really is that heavy, the answer would be 0.

    Of course, both of these are easily resolved. ("Using the balance scale, and no other methods of measuring the coins, what is the minimum number of weighings required to be certain of identifying the heavy coin?")

  • (cs) in reply to GJ
    GJ:
    It's also good practise to ensure you learn what the interviewer's job titles actually are. Especially before you launch into, as a backend DBA support person, why developement never listen to you and why they just do what they want and don't care about support's position in the company, you then learn that the two people interviewing you were the developement manager and his lead developer. What was worse I only found out after the agency called me and asked why I made a complete prat of myself!

    Even if they weren't developers, that company had to have developers somewhere. I recommend not complaining about holders of $JOB_TITLE in general, but rather complaining about holders of $JOB_TITLE that you've encountered in the past and how you'd appreciate working with some that were better than that.

    Learning your interviewers' job titles is still useful, as it lets you make an initial educated guess at their mindset.

  • (cs) in reply to emurphy
    emurphy:
    amandahugginkiss:
    AndrewB:
    The problem does not specify how much heavier the heavy coin really is. Because the scenario is wide open, we are free to speculate that the heavy coin might weigh more than all the other coins combined. Therefore, you CAN (if lucky) determine with absolutely certainty the heavier coin in 1 step. It's plainly obvious: If you, by chance, happen to put the heavy coin on one side and all the other coins on the other side, and the 1-coin side wins, then you have solved the problem in 1 step.

    If the coin was that heavy, you wouldn't need a scale to determine the difference. If the coin really is that heavy, the answer would be 0.

    Of course, both of these are easily resolved. ("Using the balance scale, and no other methods of measuring the coins, what is the minimum number of weighings required to be certain of identifying the heavy coin?")

    But then you couldn't give an answer of -8 by weighing the coins in your hands before they are even put on the scale.

  • Brian C. (unregistered) in reply to el jaybird
    I remember a few times I contradicted a prof when it came to some fact about the history of DOS or the 80x86 CPU architecture or something. For some reason I was particularly well versed in this subject (not any more, as you can see). He insisted, in front of the class, that I must be mistaken, and made me look like a fool (he has a little bit of a vicious sarcastic streak which made his class entertaining -- so long as you were not the butt of his jokes!).

    I had a professor do that to me in a lab one time, he loved to tell people they were wrong and see if they would back down, when pushed enough in everyone would.... until he met me. I forget the original subject, but all I remember is the class sitting in stunned silence when I called him a stubborn a**hole. Well no one had ever utterly refused to back down from him before so he broke out in laughter, we went out for drinks and latter when he was promoted to Dean and transferred to another campus he offered me a teaching position.

  • Brian (unregistered)

    I recall my first interview (phone-based) being one that I got flummoxed half-way through and started to BS my way around. The interviewer, a blunt-speaking fellow, called me on it and 'declined' my services (with about 5 words - rather polite, looking back).

    Next interview I had, I simply said that I had no idea but was interested in learning. I got that job.

    As for logic problems, does anyone have the pattern for the weighing, assuming the weight is known to be either heavier or lighter?

    With some quick inspection, I've got the following:

    Between 1 to 3 coins: 1 weighing. Between 4 to 9 coins: 2 weighings. Between 10 to ??? coins: 3 weighings.

    (..and since I didn't see it mentioned earlier, in the case where you aren't told if the odd coin is heavier or lighter, I believe you add one weighing to the total; aka: find the odd coin, then weigh it against any other coin)

  • JL (unregistered) in reply to Brian
    Brian:
    As for logic problems, does anyone have the pattern for the weighing, assuming the weight is known to be either heavier or lighter?

    With some quick inspection, I've got the following:

    Between 1 to 3 coins: 1 weighing. Between 4 to 9 coins: 2 weighings. Between 10 to ??? coins: 3 weighings.

    I'd guess ??? is 27, since each weighing can find the group with the odd item out of three groups where two groups have an equal number of items. So n weighings can find the odd item out of 3^n items. It's a ternary (instead of a binary) search.
  • (cs) in reply to Brian
    Brian:
    As for logic problems, does anyone have the pattern for the weighing, assuming the weight is known to be either heavier or lighter?

    ("assuming you know whether the weight is heavier or lighter")

    Brian:
    With some quick inspection, I've got the following:

    Between 1 to 3 coins: 1 weighing. Between 4 to 9 coins: 2 weighings. Between 10 to ??? coins: 3 weighings.

    1. In general, for X coins where X <= 3^N, you divide them into three sets

    A with ceiling(X/3) coins B with another ceiling(X/3) coins C with the rest of the coins

    and weigh A against B. This tells you which set contains the bad coin, and each set contains at most 3^(N-1) coins.

    Brian:
    (..and since I didn't see it mentioned earlier, in the case where you aren't told if the odd coin is heavier or lighter, I believe you add one weighing to the total; aka: find the odd coin, then weigh it against any other coin)

    It does work (weigh A against B, then A against C, and continue as above) but it's not optimal. With optimal strategy, up to (3^N-3)/2 coins can be done in N weighings. Google "12 coins" for more info.

  • James Schend (unregistered) in reply to operagost
    operagost:
    James Schend:
    For instance, I was doing a phone screening with Google and the interviewer asked me (Forgive me if I get this wrong, I'm going from memory) what a .eml file was and what limitation it had. Forgetting for the moment that this question was utterly irrelevant to what I was interviewing for, and that it could be easily found on Google in like 10 seconds, I told her that I was unfamiliar with that file format, and asked for a hint. She told me it has to do with email, so I replied that while I'm familiar with most email clients, I've only done administration on Lotus Notes, but I could make an educated guess: the file format is a database of Outlook email, and the limitation is either a 2GB or 4GB filesize. Turns out I got it right.
    No, you didn't. Outlook uses .pst and Outlook express uses .dbx. Both, however, use .eml for plain-text exports of individual messages.

    What part of "going from memory" did you not understand? Cripes, I put it right there in the post and there still has to be the jerk telling me I'm wrong.

    I got the question right that's the point of the story. Whether or not I remember the trivial details years later when posting on a message board doesn't really matter, does it?

    Sorry, I guess I'm thin-skinned today.

    As to why Google is asking trivia questions like that... I don't know. I never got far enough in the interview process to ask, although I was curious.

  • (cs) in reply to jisakujien
    jisakujien:
    At least you didn't have a school teacher send a letter home because you would not accept that a mile was shorter than a kilometer.
    When I was in 6th grade (about age 12, for non-US folks), I was sent to the principal's office and nearly suspended for insisting that water expands when it freezes--in a science class, no less. I hadn't yet gotten the hang of that, "just smile and nod," thing.
  • Magnus (unregistered) in reply to snoofle

    "km" = 2 letters, significantly shorter than "mile" (four letters)...

  • Gustav (unregistered) in reply to tyrannical
    tyrannical:
    It wouldn't have mattered. If you didn't know what DB2 was you obviously didn't have any IBM Mainframe experience. Even if you could BS through DB2, MVS, CICS, and TSO would have really stumped you. You really didn't have the job experience they were looking for, not even remotely close.

    Maybe not the experience, but that doesn't mean he didn't have the skills to learn quickly. I taught myself Cobol while on a job, and later SAS querying to a DB2 RDMS with no prior experience - if you are a quick learner and know the basic concepts they'll take you further than previous experience.

  • Gustav (unregistered) in reply to poochner
    poochner:
    jisakujien:
    At least you didn't have a school teacher send a letter home because you would not accept that a mile was shorter than a kilometer.
    When I was in 6th grade (about age 12, for non-US folks), I was sent to the principal's office and nearly suspended for insisting that water expands when it freezes--in a science class, no less. I hadn't yet gotten the hang of that, "just smile and nod," thing.

    Why would you smile and nod? Go find proof in the library, and show it to the teacher and principal. If they won't back down, get your parents to stand up for you.

    In 7th grade a teach insisted that 12am was noon, and 12pm was midnight. When I disagreed, his response was "you're a 12 year old kid and I'm an adult - who do you think is correct?" It wasn't until I showed him the dictionary entry that he apologized to me and the class.

  • Default Luser (unregistered)

    I went for an interview fresh-out of undergrad up at APC (yes, the UPS marker) in Rhode Island to do software work. The whole morning was spent on boring generic forms and bullshit sessions.

    Come afternoon, they finally started with the technical interview. I sit down with this guy, and he starts quizzing me on bug troubleshooting:

    "A user types data into a form and presses the OK button <form closes>. When the form is brought up again, the data is back to the original values. Solve the problem."

    My first question was: how many buttons are on the form? I figured this might be a simple "ok, cancel" button-swap problem. He said there was just one: the OK button. I thought that was weird, but I didn't persure the matter.

    So, here I was asking questions about the underlying software framework: what happens to the data once the OK button is pressed, how the form is populated via that data the next time it appears, and whether it was properly tested, setting up test cases, etc, when he gets this smug look, interrupts me, and says: "You missed the scope of the problem completely. It was a swapped button error."

    I told him HIS error explaining the scope of the form, and that I thought it was a swaped-button problem from the beginning (that's why I asked the button question), and he didn't believe me - we were at an impasse. Didn't hurt me at all, I got to see the backwoods of Rhode Island for free, and I'm not so sure I wanted to live there.

    I guess the moral of the story is: DO NOT hesitate to question what the interviewer declares to be true, just avoid being an ass about it. Explain your thoughts, and see what the interviewer thinks.

  • no one (unregistered) in reply to poochner

    In the 6th grade, I was literally screamed at for about 10 minutes for correcting my teacher. He basically went on a tirade about how he was tired I was always correcting him and showing he was wrong. Previously, the teacher constantly spouted BS he knew nothing about and I was the only one who had the guts and knowledge to show him he was wrong, using the set of encyclopedia britanica we had as my source. I don't really remember any of the BS anymore except that it varied from the extraordinarily obvious to some more subtle trivia (the issue in particular that caused the outburst was him telling us that a Robinson projection map was a Mercator projection map).

    Of course, that little episode sent my reputation soaring among my peers. I never corrected him ever again, but his reputation was so shot that by then, I didn't need to. Everything he said afterwards was pretty much regarded as non-information, and I think that was a far more important lesson than anything 6th graders get taught--that even figures of perceived authority can be wrong.

    Eventually, our parents heard about his incompetence and went to our PTA, the principal, and even the union with it. And even though he was tenured, he ended up with the worst teaching position in the school the following year and retired soon after that.

    My friends and I still get a good laugh at it every now and again.

  • (cs) in reply to Gustav
    Gustav:
    poochner:
    jisakujien:
    At least you didn't have a school teacher send a letter home because you would not accept that a mile was shorter than a kilometer.
    When I was in 6th grade (about age 12, for non-US folks), I was sent to the principal's office and nearly suspended for insisting that water expands when it freezes--in a science class, no less. I hadn't yet gotten the hang of that, "just smile and nod," thing.

    Why would you smile and nod? Go find proof in the library, and show it to the teacher and principal. If they won't back down, get your parents to stand up for you.

    In 7th grade a teach insisted that 12am was noon, and 12pm was midnight. When I disagreed, his response was "you're a 12 year old kid and I'm an adult - who do you think is correct?" It wasn't until I showed him the dictionary entry that he apologized to me and the class.

    This was back in the dark ages--the adults were always right, even in the face of proof. If you found proof, you were a trouble-maker. Making the teacher look bad, unforgivable; arson or skipping class, not so bad.

    Unlike today, where the kids' parents will sue at the drop of a hat, because little Johnny didn't get an A when he didn't do any homework and failed all the tests. You know, he might not qualify for that free college tuition and they would have to pay (GASP!) for it. OTOH, kids get expelled for having the wrong kind of keychain these days, so it's just all fucked up.

  • Earl Colby Pottinger (unregistered) in reply to jisakujien
    jisakujien:
    At least you didn't have a school teacher send a letter home because you would not accept that a mile was shorter than a kilometer.

    Please tell me your parents knew better. And what happen when they corrected the teacher?

  • Maserati (unregistered) in reply to Matt

    Ahh, the bullshit question. Love 'em. I had a nice variant of that pattern on an interview: "What is the current version of Norton Utilities (Mac version)". I'm a DiskWarrior/TechTool guy so my initial response while trying to remember was "ummmm". Turns out I was right, they're a DW shop too.

    I also blew an interview once on the basic principle of never badmouth your current^G previous employer. I had just finally realized "Hey, why are DNS, DHCP and NDS all hosted on the wrong side of a saturated WAN link ?". I've actually seen that network diagram on a certification exam (with a WINS server) and got it right when asked what was wrong with it. Then I made the joke about a networking environment that looks like an example from a certification exam. I shoulda just apologized for wasting the interviewer's time and slunk away in shame.

    No, I'm not still bitter about that. At least I don't have to support an environment with all services (except for a file server) on the wrong end of a slow WAN link anymore.

  • whicker (unregistered) in reply to Maserati
    Maserati:
    Ahh, the bullshit question. Love 'em. I had a nice variant of that pattern on an interview: "What is the current version of Norton Utilities (Mac version)". I'm a DiskWarrior/TechTool guy so my initial response while trying to remember was "ummmm". Turns out I was right, they're a DW shop too.

    I also blew an interview once on the basic principle of never badmouth your current^G previous employer. I had just finally realized "Hey, why are DNS, DHCP and NDS all hosted on the wrong side of a saturated WAN link ?". I've actually seen that network diagram on a certification exam (with a WINS server) and got it right when asked what was wrong with it. Then I made the joke about a networking environment that looks like an example from a certification exam. I shoulda just apologized for wasting the interviewer's time and slunk away in shame.

    No, I'm not still bitter about that. At least I don't have to support an environment with all services (except for a file server) on the wrong end of a slow WAN link anymore.

    Are you absolutely sure that the reason you weren't hired was because of that? To me it would be more like you were offering a point of further discussion and that you were affirming that you knew what a good network environment looked like.

    If the interviewer was truly that irrational, well... It's a big world out there and it works both ways. As for wasting the interviewer's time, what are you, accounting? You were hopefully hand-picked to come in, the time was allotted, the interviewer wanted to speak with YOU. Hardly wasted time.

  • GrouchyAdmin (unregistered)

    I remember when interviewing for a position over ten years ago. I had cut my teeth on Linux, and moved on to BSD, and Solaris. Hell, even IRIX didn't cause too much pain.

    I made the mistake of telling this to a possible employer, to show that I had (similar, for various views of POSIX and layout) abilities, where they only used Linux. He went into at least a fifteen minute tirade on how FreeBSD was the devil (but had never heard of BSD/OS, which, honestly, was DAMN fast and pretty good, as long as you could code around it), yadda yadda yadda.

    I was a bit surprised I didn't get walked out of the interview room in shackles.

    I still have a BSD/OS 4.0.1 CD and license in storage, somewhere.

    Oh, yeah... and I usually get paid to fix up Debian's shortcomings and f-ups of people who are touching things they shouldn't.

  • (cs) in reply to emurphy
    emurphy:
    amandahugginkiss:
    AndrewB:
    The problem does not specify how much heavier the heavy coin really is. Because the scenario is wide open, we are free to speculate that the heavy coin might weigh more than all the other coins combined. Therefore, you CAN (if lucky) determine with absolutely certainty the heavier coin in 1 step. It's plainly obvious: If you, by chance, happen to put the heavy coin on one side and all the other coins on the other side, and the 1-coin side wins, then you have solved the problem in 1 step.

    If the coin was that heavy, you wouldn't need a scale to determine the difference. If the coin really is that heavy, the answer would be 0.

    Of course, both of these are easily resolved. ("Using the balance scale, and no other methods of measuring the coins, what is the minimum number of weighings required to be certain of identifying the heavy coin?")

    Actually the question you propose is still correctly answerable with "1". If you weigh any two coins and one happens to be heavier than the other, you can then be absolutely certain that that one is the heavy one.

    The correct form of the question would be "Using the balance scale and no other methods of measuring the coins, what would be the minimum number of weighings that you would need to plan in advance to be certain of identifying the heavy coin before actually doing it?"

  • aeiluindae (unregistered) in reply to Will

    I and a friend of mine are probably responsible for making our 5th grade teacher retire. We knew more about the science she was teaching than she did, and we corrected her when she was wrong (for example, she believed that mass and weight are the same thing). She refused to listen to us and then showed concern about whether we were ready to move on to the next grade. That was the year I stopped trusting my teachers.

Leave a comment on “Schooling the Interviewer”

Log In or post as a guest

Replying to comment #:

« Return to Article