Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Technical Test

Options
  • 20-07-2006 1:25pm
    #1
    Closed Accounts Posts: 108 ✭✭


    Hi all, I currently looking to change jobs. I'm a VB develpoer with 5 years experience. Contacted a few agencies, one mentioned a senior programming role with Citigroup. Haven't done an interview or anything yet but he mentioned a 3 hour technical test. Anyone know what to expect here?
    Cheers, Les


Comments

  • Registered Users Posts: 304 ✭✭PhantomBeaker


    Well, I'm assuming some of it will be down to making sure you know the language and general caveats of it and the like.

    I had a short technical test with IBM for a summer internship, and it essentially boiled down to asking questions about pointers and the like. For example (this is in java though)

    String s1 = "Hello world";
    String s2 = "Hello world";

    if(s1 == s2){
    System.out.print(1);
    } else{
    System.out.print(2);
    }

    What is printed in this case.. that sort of stuff. Basically proving you can understand code fragments and the subtleties behind them.

    Maybe asking how you invoke your programs, how you'd write libraries and how you'd reference them. Basically making sure you know your stuff.

    You might also be asked questions about your technical knowledge... like questions about how the xml and xslt technologies relate, or similar stuff. We were also asked a rake-load of these questions for the internship.


  • Registered Users Posts: 872 ✭✭✭grahamor


    i work for citigroup, was meant to do a tech test and never did, thank god. i think PhantomBeaker is right though, just understanding coding in general and how things are done is what you need to know (sequence, selection, iteration)


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo



    String s1 = "Hello world";
    String s2 = "Hello world";

    if(s1 == s2){
    System.out.print(1);
    } else{
    System.out.print(2);
    }

    What is printed in this case..
    "1"
    What do I win? :D


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    GreeBo wrote:
    "1"
    What do I win? :D

    bit more to it then that. How about.

    String s1 = new String("Hello World");
    String s2 = new String("Hello World");

    (which I suspect what the actual question was)


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Hobbes wrote:
    bit more to it then that. How about.

    String s1 = new String("Hello World");
    String s2 = new String("Hello World");

    (which I suspect what the actual question was)
    ahh but thats a totally different question!

    The original was harder because it sucked you into the object comparison v's string value comparison "trap", though I suspect it was a type :)


  • Advertisement
  • Registered Users Posts: 304 ✭✭PhantomBeaker


    Heh, what do you know... the answer to that question IS 1, the way I asked it.

    And yes, I suppose I did mean the s1 = new String etc etc...

    That's an interestink thing to know about the java compiler... it does optimise somewhat. :rolleyes:

    ...cool...


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Heh, what do you know... the answer to that question IS 1, the way I asked it.

    And yes, I suppose I did mean the s1 = new String etc etc...

    That's an interestink thing to know about the java compiler... it does optimise somewhat. :rolleyes:

    ...cool...
    as I said, what do I win? :p


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    GreeBo wrote:
    as I said, what do I win? :p

    My love and respect.

    Of course by love I don't mean the love between a man and a woman, but more the love between a programmer and the task of having to debug object-oriented code in assembly (think "gcc -s").

    And by respect, as much respect as is due to one who probably compiled it to see what it did.

    :D

    Aoife


  • Registered Users Posts: 431 ✭✭plenderj


    I went for a job as a senior dev in London using VB primarily. I walked in, and they said "Right, you're a VB MVP. Do you mind if we do this interview in C#?".

    The first things I had to do up on a whiteboard in front of them was write code to multiply two numbers together without using the multiply operator.
    Then I had to code it recursively... urgh!


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    You know, that's going into my repetoire of tests to see if I know a language or not... multiplication without the multiplication operator.

    It's simple when you think about it outside an interview, but I'd probably brick it if that was given to me as part of one.

    (Edit: ok, just implemented the various ways I was thinking about doing it... after some initial logic bug hunting, it's all good - Thanks for the question, it was mildly entertaining for a short while : ) )


  • Advertisement
  • Registered Users Posts: 431 ✭✭plenderj


    Now do it recursively ;)


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    Oh, well, I have about 4 functions. 2 are recursive and 2 are iterative. So basically two different ways of doing it, but both done iteratively and recursively.

    Trust my black heart to think of the more difficult version first! When I thought of the difficult version I thought "Oooh, that's a bad one to ask in an interview" until I thought of the easy way and realised "Oh. The horrible part of the question is realising exactly what's being asked, not actually doing it"

    You know, that would be a fun one to give CS students who think they know their stuff.


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    what are your two different ways?
    I just did it there now...take a minute or two to get your head around the recursive logic, but it is much more elegant programming.

    I got bored and decided to allow the class to take in any number of factors and return the result..still using recursion
    ahh double recursion...:o


  • Registered Users Posts: 431 ✭✭plenderj


    I also toyed for a while in my head of doing a version whereby you divide by the reciprocal, but never bothered actually testing it...


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    Um, there's iterative addition, which is the easy one. It's really simple.

    Then there's this one (done in C):
    int multiple(int n, int f){
      if( f < 0){ 
        f = -f;
        n = -n;
      }
      return (f == 0) ? 0 : (multiple(n, f >> 1) << 1) + ((f%2) ? n : 0);
    }
    

    I just remembered that one off the top of my head (i.e. not cut/paste).

    Yes, it's demon code, but it's fun. :)

    Aoife


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    plenderj wrote:
    Now do it recursively ;)

    I thought recursion was bad? :)


  • Registered Users Posts: 431 ✭✭plenderj


    Who ever said recursion was bad?


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    Um, there's iterative addition, which is the easy one.
    you said you had 2 ways of each (so two methods of recursion and two methods of iterative)
    What are your two methods?
    I presume you have two ways of performing multiplication, then each implemented eithe recurisveuly or iteratively....:confused:


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    plenderj wrote:
    Who ever said recursion was bad?

    Well in Java for example it has a much larger memory overhead then using normal looping expressions. It is more prone to stack crashes if not coded correctly where as an expression loop isn't.

    Thats not to say it shouldn't be used, but you should be aware of what the conditions are.

    Its a bit like the StringTokenizer and the split() method.


  • Registered Users Posts: 304 ✭✭PhantomBeaker


    GreeBo wrote:
    you said you had 2 ways of each (so two methods of recursion and two methods of iterative)
    What are your two methods?
    I presume you have two ways of performing multiplication, then each implemented eithe recurisveuly or iteratively....:confused:

    Yes. the iterative addition one is just a for loop. I'm not writing that. It also takes log(f) (where f is the factor) time. (I'll leave that as an exercise to the reader ;) )

    The recursive version of that cuts the running time to O(log f).
    int addmultiple(int n, int f){
            if(f < 0){
                    f = -f;
                    n = -n;
            }
            if(f == 0){ /* I'm pretty sure I can drop this, but hey.*/
                    return 0;
            } else if (f ==1){
                    return n;
            }
            int half_value = addmultiple(n, f/2 );
            return ((f % 2)? n : 0) + half_value + half_value;
    }
    

    The other method is essentially how hardware does it (although hardware has a couple of optimisations to that algorithm). As I posted the recursive version above, I'm going with the iterative version.
    int b_multiply(int n, int f){
            if(f < 0){
                    f = -f;
                    n = -n;
            }
            int answer = 0;
            int counter =0;
            while(f > 0){
                    if(f % 2){
                            answer += (n << counter);
                    }
                    counter++;
                    // printf("f was: %d, f is now: %d\n", f, (f >> 1));
                    f = f >> 1;
            }
            return answer;
    }
    

    Once you're not scared of the << and >> operators, and once you realise that shifting a bit up by one means that it's multiplying it by two, and shifting down by a bit is dividing by 2, it should all make sense.

    In this case, the recursive and the iterative both have the same running times (O(log f)), so even though the recursive is prettier to look at, this actually takes up less memory, and doesn't use up as much of the stack. Plus it's easier to debug.


  • Advertisement
  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    Show off's :D

    Can you do it via memory shifts ?

    edit :

    I had no idea how to do this , but after 10 mins playing around , it turns out I do (vb.net)

    Private Function Multiply(ByVal no1 As Integer, ByVal no2 As Integer) As Integer

    Dim Value As Integer

    If no1 > 0 Then

    Value = Value + no2

    no1 -= 1

    Value = Value + Multiply(no1, no2)

    End If

    Return Value

    End Function

    edit edit : Just saw that Phanton did it with bit shifting, now thats definatly above me:D


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    In vb to bit shift I think you do...

    value ^ 2

    Been a while. that might be wrong.


  • Registered Users Posts: 431 ✭✭plenderj


    That'll just square a number


  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    I'm not 100% sure myself , but I think 2003 uses << and >>


  • Registered Users Posts: 1,391 ✭✭✭fatherdougalmag


    Plenty of entertainment with the Gimpel 'Bug of the Month': http://www.gimpel.com/html/bugs.htm


  • Registered Users Posts: 932 ✭✭✭yossarin


    The technical test in my work is a debugging test.

    we have a few java classes and you had to be able to step through the program and debug it.

    its stuff like thinking to print and undertand a stack trace, and understanding classpaths, libraries and class herarchies. Its made to not be solvable in the time we give you (30 mins, took me 38).

    One test i was given in an interview for inmarsat was a pointers C++ test. they'd show you a few lines of code using varibales and pointers and ask you what a particular variables value would be.

    I've had a few interviews where i've been struggling though somthing and the engineer has solved it him/herself without meaning to - just while wanting to help.


Advertisement