• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

C# interview question

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    Originally posted by Durbs View Post
    Yeah, it was that kind of interview, it kicked off gently with asking me to explain anti-patterns with a smug look. Went ok though (I hope!).
    Always a bad sign, whether or not you get the gig. I've never understood why some people feel the need to come across as the cleverest person in the room, which personality trait often manifests itself by their asking obscure questions, the answers to which they've only just encountered themselves. Possessing obscure knowledge isn't what makes a good developer. Being able to produce solutions to well-defined real world problems within a reasonable amount of time and the ability to get along with other people is. The first of those skills you can only assess by asking them to tackle a meaningful but limited problem using all of the tools they'll have available on the job. The latter you can only gauge from speaking with them.

    Comment


      #12
      No offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.

      <<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).
      Will work inside IR35. Or for food.

      Comment


        #13
        Originally posted by VectraMan View Post
        No offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.

        <<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).
        The sort of programmer who's just done a course is more likely to get a question like that right, than someone who has been using the language for business applications for years without ever needing that syntax.

        If someone wrote that instead of *16, I'd make them change it. Clarity is more important than nanoseconds in all but the tiniest minority of uses.

        Comment


          #14
          Originally posted by VectraMan View Post
          No offence, but how do you lot get paid money for programming in a C based language and not know the simple operators? It's a clever question: obviously the intent is to ascertain whether you're the sort of programmer who'd read a book or paid for a course, or whether you're the sort of programmer who really understands what they're doing.

          <<4 is a faster way of doing *16 for integers (although to be fair that's probably not a factor in this day and age). Or it could be to do with some bitwise calculation, or when dealing with nibbles for some reason (parsing a hex value springs to mind).
          What, you mean for those situations where int.Parse(hexValueAsString, System.Globalization.NumberStyles.HexNumber) just isn't clever or obscure enough?

          Comment


            #15
            Originally posted by Gentile View Post
            What, you mean for those situations where int.Parse(hexValueAsString, System.Globalization.NumberStyles.HexNumber) just isn't clever or obscure enough?
            All programming is easy if somebody else has already done the work for you. But what about the occasions where the thing you need doesn't already exist?

            What if a programmer didn't know about loops, because they'd never had to use one? After all, you could probably do a lot of business applications getting by with just ifs and else, and calling other people's functions. That's how this thread sounds to me.
            Will work inside IR35. Or for food.

            Comment


              #16
              Originally posted by VectraMan View Post
              All programming is easy if somebody else has already done the work for you. But what about the occasions where the thing you need doesn't already exist?

              What if a programmer didn't know about loops, because they'd never had to use one? After all, you could probably do a lot of business applications getting by with just ifs and else, and calling other people's functions. That's how this thread sounds to me.
              Having witnessed a police project where the number of characters you could type in a criminal record was 256, because that's the number of holes that were in the punched cards that were used by the ancient system that they were supposed to be updating used to allow, I'm more than happy for people to think outside outdated boxes, ta. Doing things a certain way just because that's the way you've always done them (and is the only way you know how to do them) can lead to some fairly counter-intuitive solutions and unreadable code. The Shift operator is at best a legacy feature in C#.

              Comment


                #17
                Originally posted by k2p2 View Post
                Anyone got a real world example where it would be useful?
                If you were designing one of those Knight Rider style red scanner light things for your car then you could use it to bit-shift the port register that controls the LEDs, although you would need both << and >>, in a for loop probably, because the real thing goes left and right.

                Other than that, it's not used for much.

                Comment


                  #18
                  Although I agree that interviewers should not try and look clever than the person they are trying to interview, I would say that anything on this page is fair game when questioning medium to high level c# programmers:

                  C# Operators (C#)

                  and you should have proposed a conciser rewrite:

                  int i = 500;
                  i << = 4;
                  Coffee's for closers

                  Comment


                    #19
                    Originally posted by Durbs View Post
                    Had a tech test today which was in the main ok. One question though did my head in, I was asked something like:

                    int i = 500;
                    i = i << 4;

                    Tell us what i is.

                    What the hell is the << operator, its probably something dead obvious but I seem to have gone through my career without using << ?
                    For those who have moved from C++ to C# this is a simple question. It's a good way to quickly find out if some one has falsely stated C++ on their CV.

                    Comment


                      #20
                      You guys will be arguing for the re-introduction of Sinclair Basic GOTO statements next.

                      Comment

                      Working...
                      X