Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Interview questions gone wrong...

Interview questions gone wrong...

Scheduled Pinned Locked Moved The Lounge
questioncareercom
39 Posts 26 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Fuzzychaos

    Had an interview over the phone today. Totally bunged the question. They asked for a test to check if a number is a power of 2 and I answered it as a test to see if it was divisible by 2! Should have been (x && !(x & (x - 1))). What a dolt I be! I was so nervous I messed up other simple ones too. Needless to say I didn't get the job failing the technical questions. Anyone have other mixed up interview questions?

    Jeremy Pemberton-Pigott
    A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
    New Dawn Engineering

    C Offline
    C Offline
    charlieg
    wrote on last edited by
    #13

    I guess it sort of depends on the type of programming you will be doing, but seriously, folks, when was the last time you had to do that in a program? I've been writing code for 25 years. I'll be polite: this is a bs question. If someone asked me that question over the phone, I'd have a hard time not laughing. I think I would respond with, "could you give me an example of actually using such a silly question?" Am I the only one here thinking this?

    Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW. My other son commutes in an M1A2 Abrams

    F P 2 Replies Last reply
    0
    • C charlieg

      I guess it sort of depends on the type of programming you will be doing, but seriously, folks, when was the last time you had to do that in a program? I've been writing code for 25 years. I'll be polite: this is a bs question. If someone asked me that question over the phone, I'd have a hard time not laughing. I think I would respond with, "could you give me an example of actually using such a silly question?" Am I the only one here thinking this?

      Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW. My other son commutes in an M1A2 Abrams

      F Offline
      F Offline
      Fuzzychaos
      wrote on last edited by
      #14

      It was for embedded systems development on a mobile device job interview.

      Jeremy Pemberton-Pigott
      A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
      New Dawn Engineering

      C M 2 Replies Last reply
      0
      • F Fuzzychaos

        It was for embedded systems development on a mobile device job interview.

        Jeremy Pemberton-Pigott
        A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
        New Dawn Engineering

        C Offline
        C Offline
        charlieg
        wrote on last edited by
        #15

        :omg: I rest my case. I can see perhaps sampling basic binary skills, but really....

        Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW. My other son commutes in an M1A2 Abrams

        1 Reply Last reply
        0
        • N Nish Nishant

          Alvaro Mendez wrote:

          x % 2 == 0 is probably what they were expecting.

          :confused: How will that help determine if a number is a power of 2? Powers of 2 are 1,2,4,8,16,32...

          Regards, Nish


          Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
          Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

          A Offline
          A Offline
          Alvaro Mendez
          wrote on last edited by
          #16

          Nishant Sivakumar wrote:

          How will that help determine if a number is a power of 2? Powers of 2 are 1,2,4,8,16,32...

          Oops, perhaps he meant multiple of 2. :-O At least, that's what I understood. :~ Alvaro


          If [God] knows what we are going to do then we have no free will and are just characters in a play written by him. Without free will, morality for humans makes no sense. Without free will and morality, any sort of punishment or reward system loses any justification. Heaven and hell would be places where [God] could watch the souls he created, predestined just for eternal happiness or agony. - Mark Thomas

          A 1 Reply Last reply
          0
          • F Fuzzychaos

            Had an interview over the phone today. Totally bunged the question. They asked for a test to check if a number is a power of 2 and I answered it as a test to see if it was divisible by 2! Should have been (x && !(x & (x - 1))). What a dolt I be! I was so nervous I messed up other simple ones too. Needless to say I didn't get the job failing the technical questions. Anyone have other mixed up interview questions?

            Jeremy Pemberton-Pigott
            A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
            New Dawn Engineering

            L Offline
            L Offline
            leckey 0
            wrote on last edited by
            #17

            Man, all my recent interviews have been what are your strengths/weakneses? I actually had one guy who admitted he hadn't interviewed anyone in about 5 year. So I got out of tought questions. (Man I wish those guys would call me back with an offer!) :badger:

            B 1 Reply Last reply
            0
            • L leckey 0

              Man, all my recent interviews have been what are your strengths/weakneses? I actually had one guy who admitted he hadn't interviewed anyone in about 5 year. So I got out of tought questions. (Man I wish those guys would call me back with an offer!) :badger:

              B Offline
              B Offline
              bryce
              wrote on last edited by
              #18

              i like that wanky one about biggest weakness - i give them the "oh you mean hwo i always work too hard" with the eyerolling and p*ss takign then i tell them that my biggest weakness is that i tend to speak my mind. "why is that a weakness?" "because sometimes i don't bother preparsing it, so if you don't want to hear what i have to say, dont hire me" works well in nz, australia and the UK though Dunno how that would go down in america land- but i'm not in Amexica ;) - suspect i might get away with it coz i'm not a local Bryce

              --- To paraphrase Fred Dagg - the views expressed in this post are bloody good ones. --
              Publitor, making Pubmed easy. http://www.sohocode.com/publitor

              Our kids books :The Snot Goblin, and Book 2 - the Snotgoblin and Fluff

              1 Reply Last reply
              0
              • F Fuzzychaos

                It was for embedded systems development on a mobile device job interview.

                Jeremy Pemberton-Pigott
                A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
                New Dawn Engineering

                M Offline
                M Offline
                Marco Turrini
                wrote on last edited by
                #19

                Fuzzychaos wrote:

                It was for embedded systems development on a mobile device job interview.

                Whatever it was meant for, unless you are un-employed, you'ld be happy not to work for them: I can't see how can be so important the ability to determine if a number is the power of two; I can find tons of sample in dozens of languages just goggling, if I ever needed it. In my opinion, the most important thing in a developer is not how to solve such a small problem, but how to properly design an application, so that it's stable, easy to correct and expand and possibly performant (but this may vary, depending on the target). Looks like yor interviewer is (or was) a coder, not a programmer. Good luck for next time!

                Marco Turrini

                1 Reply Last reply
                0
                • L Leslie Sanford

                  By the way...

                  Fuzzychaos wrote:

                  Had an interview over the phone today.

                  Fuzzychaos wrote:

                  Should have been (x && !(x & (x - 1))).

                  How do you say that over the phone?

                  P Offline
                  P Offline
                  Polymorpher
                  wrote on last edited by
                  #20

                  Right bracket, x, logical and, not, right bracket, x, binary and, right bracet, x - 1, left bracket, left bracket, left bracket ;)

                  Pablo Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.

                  N 1 Reply Last reply
                  0
                  • C charlieg

                    I guess it sort of depends on the type of programming you will be doing, but seriously, folks, when was the last time you had to do that in a program? I've been writing code for 25 years. I'll be polite: this is a bs question. If someone asked me that question over the phone, I'd have a hard time not laughing. I think I would respond with, "could you give me an example of actually using such a silly question?" Am I the only one here thinking this?

                    Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW. My other son commutes in an M1A2 Abrams

                    P Offline
                    P Offline
                    Polymorpher
                    wrote on last edited by
                    #21

                    I would only see it being valid if it was for something along the lines of game programing or some sort of math intinsive software.

                    Pablo Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.

                    1 Reply Last reply
                    0
                    • L Leslie Sanford

                      By the way...

                      Fuzzychaos wrote:

                      Had an interview over the phone today.

                      Fuzzychaos wrote:

                      Should have been (x && !(x & (x - 1))).

                      How do you say that over the phone?

                      P Offline
                      P Offline
                      prst123
                      wrote on last edited by
                      #22

                      I feel that was a tough one :)

                      1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        If that is of some comfort to you: I screwed up a simple binary search in an interview once.


                        Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

                        M Offline
                        M Offline
                        Mike Dimmick
                        wrote on last edited by
                        #23

                        Most people do. I saw something recently about how most binary search implementations don't work if the start and end pointers are above 2GB in memory. Normally the algorithm finds the mid-point by adding start and end together, then dividing by 2 - if the start and end pointers are above 2GB, you get an integer overflow and the 'mid point' ends up right down near address 0. This doesn't work very well. Most of us will still be fine on Win32 because it's hard to get a user-mode pointer above 2GB. You can only do it by booting with the /3GB switch (on OSs which support it) and linking the executable with /LARGEADDRESSAWARE.

                        Stability. What an interesting concept. -- Chris Maunder

                        1 Reply Last reply
                        0
                        • B Bassam Abdul Baki

                          Marc Clifton wrote:

                          My answer would have been, why are you testing to see if a number is a power of 2?

                          Easy, for mathematical factorization like Mersenne primes. You change your algorithm if it is a power of two +/-1.


                          "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon

                          Web - Blog - RSS - Math - LinkedIn

                          M Offline
                          M Offline
                          Mike Dimmick
                          wrote on last edited by
                          #24

                          Strangely, I'm not in the habit of doing that every day as a programmer. (If you happen to be programming strong cryptographic key generation and wish to check that the key you generated is strong enough to withstand easy factorization, then go ahead. I'll use CryptoAPI where someone else has already written it.)

                          Stability. What an interesting concept. -- Chris Maunder

                          J I 2 Replies Last reply
                          0
                          • M Mike Dimmick

                            Strangely, I'm not in the habit of doing that every day as a programmer. (If you happen to be programming strong cryptographic key generation and wish to check that the key you generated is strong enough to withstand easy factorization, then go ahead. I'll use CryptoAPI where someone else has already written it.)

                            Stability. What an interesting concept. -- Chris Maunder

                            J Offline
                            J Offline
                            JakeWyman
                            wrote on last edited by
                            #25

                            I agree... Ive been writing both production and shrink wrap code for over 11 years and I have always looked up anything that I didnt know. Why memorize something that you may never use? I'd rather have a developer on my team that has a good attitude, understands the business problems that they are trying to solve and knows where to look when they dont know the answer to a quetsion...

                            Jake-

                            1 Reply Last reply
                            0
                            • M Mike Dimmick

                              Strangely, I'm not in the habit of doing that every day as a programmer. (If you happen to be programming strong cryptographic key generation and wish to check that the key you generated is strong enough to withstand easy factorization, then go ahead. I'll use CryptoAPI where someone else has already written it.)

                              Stability. What an interesting concept. -- Chris Maunder

                              I Offline
                              I Offline
                              Intellisense
                              wrote on last edited by
                              #26

                              I agree that those types of questions are probably more about the interviewer's ego than finding the skill level of the applicant. But, that question made me think, a little.:doh: Consider this. All powers of 2, in binary are in the following form: 01, 10, 100, 1000, 10000 etc... which of course is 1, 2, 4, 8, 16, etc... So the easy way to tell is just any number that in binary is a single 1 followed by all zeros.

                              A 1 Reply Last reply
                              0
                              • A Alvaro Mendez

                                Nishant Sivakumar wrote:

                                How will that help determine if a number is a power of 2? Powers of 2 are 1,2,4,8,16,32...

                                Oops, perhaps he meant multiple of 2. :-O At least, that's what I understood. :~ Alvaro


                                If [God] knows what we are going to do then we have no free will and are just characters in a play written by him. Without free will, morality for humans makes no sense. Without free will and morality, any sort of punishment or reward system loses any justification. Heaven and hell would be places where [God] could watch the souls he created, predestined just for eternal happiness or agony. - Mark Thomas

                                A Offline
                                A Offline
                                AmitDey
                                wrote on last edited by
                                #27

                                The interviewer meant POWER of 2 ie..1,2,4,8,16,32 and i believe, (((x&(x-1))+1)==2*x) is the right answer.... coz any power of 2 will be of the form 00001000.... and x-1 will of form 00000111.... Now when we do x&(x-1)...ie. bitwise and we get 00001000... 00000111... ------------ 00001111... whichh is 1 less than 0001000 ...(x*2)

                                I M 2 Replies Last reply
                                0
                                • S Shog9 0

                                  Fuzzychaos wrote:

                                  Anyone have other mixed up interview questions?

                                  "Have you ever had problems with a co-worker?" Yeah, just don't answer that one. Definitely don't launch into long stories. :-o

                                  ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                                  B Offline
                                  B Offline
                                  BoneSoft
                                  wrote on last edited by
                                  #28

                                  Yeah, that's like "do I look fat in these pants?" or "do you like that girl?" There are around 14,000 answers to those questions, all of which are incorrect.


                                  Try code model generation tools at BoneSoft.com.

                                  1 Reply Last reply
                                  0
                                  • F Fuzzychaos

                                    Had an interview over the phone today. Totally bunged the question. They asked for a test to check if a number is a power of 2 and I answered it as a test to see if it was divisible by 2! Should have been (x && !(x & (x - 1))). What a dolt I be! I was so nervous I messed up other simple ones too. Needless to say I didn't get the job failing the technical questions. Anyone have other mixed up interview questions?

                                    Jeremy Pemberton-Pigott
                                    A programmer with a dream can accomplish anything. So, start by implementing your castle in the clouds and then working on its interface to a foundation :-D Quote by: Jeremy Pemberton-Pigott
                                    New Dawn Engineering

                                    B Offline
                                    B Offline
                                    BoneSoft
                                    wrote on last edited by
                                    #29

                                    Had a phone interview once where on question 3 they said, "Can you tell me in code how to determine if any given number is a prime number in the most optimized algorythm? Go ahead, we'll wait..." Phukers! My reply started with something like "Um uhhh durhh..." Didn't get that job, perhaps a blessing. Then recently, had a phone interview where they gave me several language questions, then asked "If you needed a windows app to listen on another thread for a web service response, how would you implement that design-wise?" My response started off just about the same. I drew blank. My brain was screaming "NOT ENOUGH INFORMATION!" After the call, I thought of a couple good answers, but it sucks when that happens in an interview because then you're thinking about solutions for that stupid scenario for DAYS. Jury's still out on that position...


                                    Try code model generation tools at BoneSoft.com.

                                    1 Reply Last reply
                                    0
                                    • A AmitDey

                                      The interviewer meant POWER of 2 ie..1,2,4,8,16,32 and i believe, (((x&(x-1))+1)==2*x) is the right answer.... coz any power of 2 will be of the form 00001000.... and x-1 will of form 00000111.... Now when we do x&(x-1)...ie. bitwise and we get 00001000... 00000111... ------------ 00001111... whichh is 1 less than 0001000 ...(x*2)

                                      I Offline
                                      I Offline
                                      Ivan Milanov
                                      wrote on last edited by
                                      #30

                                      AmitDey wrote:

                                      Now when we do x&(x-1)...ie. bitwise and we get 00001000... 00000111... ------------ 00001111...

                                      :confused: This "&" is the bitwise operator for the logical function AND, so, with it you would get 00001000... 00000111... ----------- with operator & 00000000... What you need is the bitwise operator for the logical function OR. The operator is "|" so this operator would be the correct one, hence the expression is "x|(x-1)" 00001000... 00000111... ----------- with operator | 00001111...

                                      1 Reply Last reply
                                      0
                                      • A AmitDey

                                        The interviewer meant POWER of 2 ie..1,2,4,8,16,32 and i believe, (((x&(x-1))+1)==2*x) is the right answer.... coz any power of 2 will be of the form 00001000.... and x-1 will of form 00000111.... Now when we do x&(x-1)...ie. bitwise and we get 00001000... 00000111... ------------ 00001111... whichh is 1 less than 0001000 ...(x*2)

                                        M Offline
                                        M Offline
                                        Mikon Dosogne
                                        wrote on last edited by
                                        #31

                                        I think you meant x|(x-1)... But there is another way: x&(~(x-1))==x 00001000... = x 00000111... = x-1 11111000... = ~(x-1) 00001000... = x&(~(x-1)) This should work even if x = 2 (...0000001) or x = (1000000...) Mikon Dosogne

                                        B 1 Reply Last reply
                                        0
                                        • M Mikon Dosogne

                                          I think you meant x|(x-1)... But there is another way: x&(~(x-1))==x 00001000... = x 00000111... = x-1 11111000... = ~(x-1) 00001000... = x&(~(x-1)) This should work even if x = 2 (...0000001) or x = (1000000...) Mikon Dosogne

                                          B Offline
                                          B Offline
                                          bezorn
                                          wrote on last edited by
                                          #32

                                          How about this: x&(x-1)==0

                                          M 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups