Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are these interview questions too challenging for beginners? [closed]

Tags:

c#

So I just interviewed two people today, and gave them "tests" to see what their skills were like. Both are entry level applicants, one of which is actually still in college. Neither applicant saw anything wrong with the following code.

I do, obviously or I wouldn't have picked those examples. Do you think these questions are too harsh for newbie programmers?

I guess I should also note neither of them had much experience with C#... but I don't think the issues with these are language dependent.

//For the following functions, evaluate the code for quality and discuss.  E.g.
//E.g. could it be done more efficiently? could it cause bugs?        
public void Question1()
{
    int active = 0;

    CheckBox chkactive = (CheckBox)item.FindControl("chkactive");
    if (chkactive.Checked == true)
    {
        active = 1;
    }

    dmxdevice.Active = Convert.ToBoolean(active);
}

public void Question2(bool IsPostBack)
{
    if (!IsPostBack)
    {
        BindlistviewNotification();
    }

    if (lsvnotificationList.Items.Count == 0)
    {
        BindlistviewNotification();
    }
}


//Question 3
protected void lsvnotificationList_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
   ListViewDataItem item = lsvnotificationList.Items[e.ItemIndex];
   string Email = ((TextBox)item.FindControl("txtEmailAddress")).Text;
   int id = Convert.ToInt32(((HiddenField)item.FindControl("hfID")).Value);

   ESLinq.ESLinqDataContext db = new ESLinq.ESLinqDataContext();
   var compare = from N in db.NotificationLists
                 where N.ID == id 
                 select N;
   if (compare.Count() > 0)
   {
       lblmessage.Text = "Record Already Exists";
   }
   else
   {
       ESLinq.NotificationList Notice = db.NotificationLists.Where(N => N.ID == id).Single();
       Notice.EmailAddress = Email;
       db.SubmitChanges();
   }
   lsvnotificationList.EditIndex = -1;
   BindlistviewNotification();
}
like image 924
CodeRedick Avatar asked Sep 29 '08 23:09

CodeRedick


People also ask

Are closed-ended questions good for interviews?

Closed-ended interview questions This category of job interview questions calls for simple, informational answers. Often, they can be just a "yes" or "no," but you should give candidates an opportunity to explain themselves. These questions can help you quickly gain basic information about the job seeker.

What is the difference between an open and closed interview question?

Open-ended questions are questions that allow someone to give a free-form answer. Closed-ended questions can be answered with “Yes” or “No,” or they have a limited set of possible answers (such as: A, B, C, or All of the Above).

Why are open-ended questions better during an interview?

Open-ended questions give your respondents the freedom and space to answer in as much detail as they like, too. Extra detail really helps to qualify and clarify their responses, yielding more accurate information and actionable insight for you.


2 Answers

I don't typically throw code at someone interviewing for a position and say "what's wrong?", mainly because I'm not convinced it really finds me the best candidate. Interviews are sometimes stressful and a bit overwhelming and coders aren't always on their A-game.

Regarding the questions, honestly I think that if I didn't know C#, I'd have a hard time with question 3. Question #2 is a bit funky too. Yes, I get what you're going for there but what if the idea was that BindlistviewNotification() was supposed to be called twice? It isn't clear and one could argue there isn't enough info. Question 1 is easy enough to clean up, but I'm not convinced even it proves anything for an entry-level developer without a background in C#.

I think I'd rather have something talk me through how they'd attack a problem (in pseudo-code or whatever language they are comfortable with) and assess them from that. Just a personal opinion, though.

like image 89
itsmatt Avatar answered Nov 15 '22 11:11

itsmatt


I am a junior programmer, so I can give it a try:

  1. "active" is unnecessary:

    CheckBox chkactive = (CheckBox)item.FindControl("chkactive");
    dmxdevice.Active = chkactive.Checked
    
  2. You should use safe casting to cast to a CheckBox object. Of course, you should be able to find the checkbox through its variable name anyway.:

    CheckBox chkactive = item.FindControl("chkactive") as CheckBox;
    
  3. The second function could be more concise:

    public void Question2(bool IsPostBack)
    {
        if (!IsPostBack || lsvnotificationList.Items.Count == 0)
        {
            BindlistviewNotification();
        }
    }
    

Only have time for those two, work is calling!

EDIT: I just realized that I didn't answer your question. I don't think this is complicated at all. I am no expert by any means and I can easily see the inefficiencies here. I do however think that this is the wrong approach in general. These language specific tests are not very useful in my opinion. Try to get a feeling for how they would attack and solve a problem. Anyone who can get past that test will be able to easily pick up a language and learn from their mistakes.

like image 23
Ed S. Avatar answered Nov 15 '22 09:11

Ed S.