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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C#.NET Interview coding questions

  • 05-05-2014 3:56pm
    #1
    Registered Users, Registered Users 2 Posts: 3


    I have an interview for a post as a C#.NET developer which will include a 'whiteboard' test where I'll be asked to code a problem/function.
    Impossible to know what I'll be asked to do, what have you been asked in an interview?
    Thanks
    Tagged:


Comments

  • Closed Accounts Posts: 27 PeachPie


    dublin104 wrote: »
    I have an interview for a post as a C#.NET developer which will include a 'whiteboard' test where I'll be asked to code a problem/function.
    Impossible to know what I'll be asked to do, what have you been asked in an interview?
    Thanks

    Fizz bang..look it up.
    Thanks me later..


  • Registered Users, Registered Users 2 Posts: 3 dublin104


    Fizz Buzz? Do employers really ask that?


  • Registered Users, Registered Users 2 Posts: 341 ✭✭Mo14


    Check out the book 'Cracking the Coding Interview' if you have the time and haven't already. I'm only a third year intern so this may not be too relevant, but for the whiteboard part of the interview for my internship, I was asked 'Given a string, write a method that returns a string containing the duplicate characters in the input string'.
    So for the input "aaghgd", you'd return "ag". Very trivial, but it would still weed out the people who can't code to save their life.


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    dublin104 wrote: »
    Fizz Buzz? Do employers really ask that?

    Yup, unfortunately.


  • Registered Users, Registered Users 2 Posts: 3 dublin104


    Mo14 wrote: »
    Check out the book 'Cracking the Coding Interview' if you have the time and haven't already. I'm only a third year intern so this may not be too relevant, but for the whiteboard part of the interview for my internship, I was asked 'Given a string, write a method that returns a string containing the duplicate characters in the input string'.
    So for the input "aaghgd", you'd return "ag". Very trivial, but it would still weed out the people who can't code to save their life.

    Thanks, will check out that book. I have some time until the interview.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 240 ✭✭mrkite77


    If I were to interview someone for a C# position, I'd ask them to do some simple tasks and see if they used LINQ or not. Checking to see if people use idiomatic C# is the quickest way to see if they're C# programmers or Java programmers who quickly taught themselves C# syntax for the job.


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    Do you not think that you're narrowing your choices there? I disagree with profiling devs on the language they happen to most proficient in at the time.

    I'm willing to bet that a decent Java head will find his feet in C# in no time.


  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    mrkite77 wrote: »
    If I were to interview someone for a C# position, I'd ask them to do some simple tasks and see if they used LINQ or not. Checking to see if people use idiomatic C# is the quickest way to see if they're C# programmers or Java programmers who quickly taught themselves C# syntax for the job.

    Surely the use of LINQ or not doesn't make a good or bad programmer. If you want to know if they can use LINQ then put that in the question.

    I can use LINQ if I choose but whether I use it or not depends on the situation.
    Personally I find LINQ makes code a lot less readable.


  • Registered Users, Registered Users 2 Posts: 264 ✭✭not1but4


    dublin104 wrote: »
    Fizz Buzz? Do employers really ask that?

    Large MNC with (250,000 employees) asked me it. It was harder to pretend that I hadn't seen it before.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Surely the use of LINQ or not doesn't make a good or bad programmer. If you want to know if they can use LINQ then put that in the question.

    I can use LINQ if I choose but whether I use it or not depends on the situation.
    Personally I find LINQ makes code a lot less readable.
    +1, there's times where LINQ provides very real benefits, but for something really easy it just makes code slightly harder to read. In an interview in particular, I'd be tempted to not use LINQ so that my thought process and workings would be very clear.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    I usually ask one question regarding Linq, which tells me more about their knowledge that any syntax.
    public static void Main(string[] args)
    {
        Console.WriteLine("Before Method");
        GetStrings();
        Console.WriteLine("AfterMethod");
        Console.ReadLine();
    }
    
    
    public static IEnumerable<string> GetStrings()
    {
        Console.WriteLine("inside method");
        yield return "1";
        yield return "2";
    }
    

    What is the output of the above.


  • Registered Users, Registered Users 2 Posts: 586 ✭✭✭Aswerty


    @Giblet, That is just trying to catch people out. If you executed it and asked them why it worked that way, fine. But I'd really think less of an interviewer for asking a question like that. Understading how LINQ relies on lazy execution doesn't mean you're always going to see the execution path when shown a snippet of code. At least if you had a line to force the execution at the end of the program it would at least give the interviewee a prompt as to what the "gotcha" is.

    I would have failed this question even though I have the understanding you were looking for. I also think a lot of people don't use the yield keyword much which adds an unneccessary complication to the mix.


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    I guess I should have expanded more, I don't just throw that at the interviewee and chuckle to myself, it's broken down into what different Linq calls will do in each case.


  • Registered Users, Registered Users 2 Posts: 586 ✭✭✭Aswerty


    I suppose the goodness of a question is dependent on the context it's asked in as well as to the discussion that arises out of the interviewees answer, be it right or wrong. I ran your code in LINQPad thinking you were interested in the yield keyword (while wondering why the IEnumerable wasn't used). On seeing the output I realised it was an understanding of lazy execution that was being sought.


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Exactly, but the more important thing is how
    Where,
    Take and Skip
    and finally ToList
    will work.
    Also, I would probably ask how to implement a new Linq Method (without referencing it's an extension method)


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    not1but4 wrote: »
    It was harder to pretend that I hadn't seen it before.

    I actually prefer to hear that a candidate has heard of it!


Advertisement