2

Before you start reading:

I didn't know if I should post this here or on Workplace, but since my question is more about the "programming language" part I thought it would fit better here. My apologies if it's not the case.

Also, I'm aware there is a similar question here, but the context is slightly different and I thought it would be better to post another question rather than digging out the old one.


About a few hours ago, I was asked to complete a "C++ intermediate" test for a job application. Turns out this test doesn't look like it's tailored for "intermediate" programmers to me.

Even though I clearly don't consider myself as a skilled C++ programmer, I don't think I am an absolute beginner either. I've been practicing C++ for a few years now, along with other programming languages and more conceptual things such as algorithms and design patterns. I if were to describe myself as a programmer, I'd say that:

  1. I'm not an expert in any language, but so far, I've known enough things to handle every projects that were given to me.
  2. If there was something I didn't know, then I learned it "on the fly" and was able to go on with the project I was working on.
  3. I have a working experience in C++.

Yet this intermediate test asked me about very specific questions like the impact of the overloading of the operator "new", or string manipulations with strtok, memmove and so on. I know these things can be useful, but even in a business context, I never had to do such things. I had to do other specific things, but too bad, it wasn't part of the questions asked.

(In my context, the application is for JavaScript development with a very strong algorithmic dimension, but since I never used JavaScript, they tested me on C++ instead since I'm going to work more on the algorithm part. So they are not actually testing me on a specific context which would justify the specific questions).

Obviously either my idea of what an intermediate C++ developer is supposed to know is wrong here, or this test isn't made to measure global intermediate skills. I mean, I thought I was an intermediate programmer, but that might be because I took in account my ability to find answers to my questions quickly. So I might be more a "beginner developer with the ability to look like an intermediate developer (given a few minutes)" rather than a true "intermediate developer".

So I'll consider the first hypothesis to be true, and say that this kind of test is quite good at measuring programming skills.

How can you effectively measure your programming skills in a language in order to comply with these tests? What are these tests actually trying to measure and what can I improve to get better at them (and potentially be hired for a job...)?

gnat
  • 21,442
  • 29
  • 112
  • 288
  • 9
    `I know these things can be useful, but even in a business context, I never had to do such things.` -- Welcome to the wonderful and wacky world of interviewing for software development jobs. – Robert Harvey Dec 18 '16 at 18:32
  • For what it's worth, I'm not a C++ expert, but I am familiar with the language, and if I were interviewing someone for a C++ job, I would expect them to know things like the impact of the overloading of the `new` operator, and string manipulations with `strtok`, `memmove` and so on. Those things are fundamental knowledge, and every C++ programmer should know them. – Robert Harvey Dec 18 '16 at 18:33
  • 1
    What I do take issue with is interviews for business domain jobs (such as website programming) that ask you how to balance a binary tree, a problem that was already solved years ago. I don't mind tests like "how to reverse a string," they are tedious, but they demonstrate that someone actually knows how to write code. You'd be surprised how many people applying for programming jobs don't actually know how to code. – Robert Harvey Dec 18 '16 at 18:35
  • Thanks for your answer. This is exactly why I'm asking this here, I am lacking the distance to look at this properly. It's just that since it's the first time I encounter this kind of question, I thought they were specific since nobody around me ever felt the need to ask/use/talk about this. But wouldn't you make sure that they know more global things about C++ beforehand? – Sonia Seddiki Dec 18 '16 at 18:37
  • The point is that if they don't know basic things like what `strtok` does, they probably will sink in a company that needs significant C++ experience. – Robert Harvey Dec 18 '16 at 18:38
  • So no, there isn't a non-subjective way to measure a programmer's ability, other than to give them a test, ask them questions about the language or get them to write some code. – Robert Harvey Dec 18 '16 at 18:41
  • Ok I was talking about `strtok` here because it was part of the question. Of course I had to use that at one point in my life, but for instance it was the first time I heard about `memmove`. Even if I know how it works, I didn't have to use it a lot. However, I had to use things like templates and polymorphism a lot, and those concepts seemed more important to test to me rather than the use of `strtok`. – Sonia Seddiki Dec 18 '16 at 18:41
  • You could say that in the interview, I suppose. Many shops are unimpressed with template programming; it's horribly complicated, and usually it's unnecessary unless you're building a framework. Frankly, they're more interested in your fundamental skills; if you know those, they can teach you the rest, or you can learn them yourself. – Robert Harvey Dec 18 '16 at 18:42
  • Ok, so it seems I was great at not knowing fundamentals things and getting away with it all this time :D. Thank you for your insight on the question! – Sonia Seddiki Dec 18 '16 at 18:50
  • 6
    @RobertHarvey: I've been a C++ programmer for over a decade and a half, and I couldn't tell you how to use `strtok`. It is "basic" only for programmers who A) have a need to tokenize strings, and B) are forbidden from using the C++ parts of the C++ standard library. C++ programmers can do much better than `strtok`. – Nicol Bolas Dec 18 '16 at 19:58
  • 4
    @SoniaSeddiki: "*I'll consider the first hypothesis to be true, and say that this kind of test is quite good at measuring programming skills.*" I would not. An intermediate C++ developer ought to be able to have some understanding of what happens if you overload `new`. But the specifics of `memmove` and out-dated C APIs like `strtok`? I would expect that from someone who's background included ***C***. Yes, they're parts of C++, but there are many intermediate C++ programmers who have never had to look into these dark corners of the standard library. – Nicol Bolas Dec 18 '16 at 20:01
  • @NicolBolas: Then the company that is asking about those things either needs to have skills in them, or hasn't come up with interview questions that adequately express the skills they *actually* need. Sometimes companies ask about these dark corners because they want to get a feel for the *depth* of someone's knowledge. I'm not saying that's right thinking, but that is how a lot of companies (and teachers, for that matter) approach it. – Robert Harvey Dec 18 '16 at 20:27
  • Do not under any circumstances accept a job offer from that company. Good companies hire by personality, intelligence, willingness and ability to learn, etc. I'll bet my next paycheck that most of the people already on their payroll would fail their interview tests! –  Dec 18 '16 at 20:50
  • 1
    *C++ in particular* is a very big and very complicated language. Being an "expert" in C++ is a very high bar. – user253751 Dec 18 '16 at 21:56
  • It depends on the questions, and on how they treat the results. For example, was the question about strtok testing whether you know the strtok syntax by heart, or could you look it up in the manual before answering a "where is the bug in this code"-type question? – Brandin Dec 18 '16 at 22:38
  • Did you ever have any formal training or are you self-taught? – Pieter B Nov 11 '17 at 21:56

2 Answers2

3

C++ is gigantic. Not just as a language or a library, but in terms of coding styles and understanding. Under the umbrella of C++, you find OOP styles, functional programming styles, metaprogramming, low-level programming, and plenty of others.

Saying that you're "intermediate" is essentially useless for saying anything about what you really know of C++ as a language. Someone can be an expert on the OOP part of the C++ realm, while being easily be mystified by deep metaprogramming constructs. Someone who is skilled in using C++ like C-with-classes can be confused by the simplest iostream idioms. Some people have used C++ for decades without understanding the specifics of the C++ object model.

There is no objective standard for what it means to be an "intermediate" C++ programmer. It'd be far better to list your actual skills at C++.


As for the test itself, it is probably good at finding C++ programmers who are used to a C-with-classes or a low-level style. But I wouldn't use it as a litmus test to decide who is "intermediate" and who is not.

You didn't post the specific questions, but asking about memmove strongly suggests deep, low-level memory stuff. The reason being that in C++, memmove can be exceedingly dangerous, and it can only be used reasonably on objects that fit a specific classification (in C++98/03, that was POD. in C++11, we call them trivially copyable). This is the sort of stuff that people who deal in high-performance memory operations need to know about.

strtok suggests the C-with-classes approach. It is an API that C++ inherited from C. But unlike memmove, there are C++ ways to tokenize strings that are generally superior to it. Using a stringstream and repeated getline calls would be equally as effective, and far safer.

You would only use strtok if C tools were more familiar to you, or if you absolutely need every ounce of performance in your string tokenizer.


I have to emphasize mobileink's point in the comments. It is very bizarre for a company to test your C++ knowledge, when they're considering hiring you to write algorithms rather than C++ code.

Nicol Bolas
  • 11,813
  • 4
  • 37
  • 46
  • `C++ is gigantic` -- Only for those people that are compelled to maintain code in all of the different coding styles that have been floated over the years. Surely the C++11 standard brings some sanity to this. Bjarnes book is over a thousand pages long, but so is *C# in a Nutshell.* – Robert Harvey Dec 18 '16 at 20:20
  • 2
    @RobertHarvey: The coding styles I'm talking about aren't some antiquated thing. This is what we have *today*. Qt focuses on OOP-style coding, while Boost promotes metaprogramming and functional styles. C++11 and later has done little to unify things. Indeed, thanks to lambdas, you have even more functional styles being promoted. Bjarne's book isn't capable of covering all the breadth of coding styles involved. – Nicol Bolas Dec 18 '16 at 20:37
  • 1
    "C++ is gigantic" - no, C++ is monstrous. Regarding the OP question: run for the exit! Anybody who uses C++ to test for knowledge of algorithms is somebody you do not want to work for. –  Dec 18 '16 at 20:46
  • Are QT, Boost and the like really part of the language proper? One could argue that C# is actually larger, because parts of the .NET framework are actually baked into it. – Robert Harvey Dec 18 '16 at 20:57
  • @RobertHarvey: I'm talking about the world of C++, not the language of C++. How C++ is used in practice, not C++ in theory. Hence the "not just as a language or a library". – Nicol Bolas Dec 18 '16 at 20:58
  • Well, not every company is going to need every corner of the C++ world, any more than any company is going to need comprehensive .NET Framework knowledge. Some companies will have no interest whatsoever in your Template skills, for example. – Robert Harvey Dec 18 '16 at 20:59
  • @RobertHarvey: Yes. And that's why I suggested explaining his actual skills, rather than labeling himself as an "intermediate C++ programmer". – Nicol Bolas Dec 18 '16 at 20:59
  • 3
    @RobertHarvey: Especially when the C++ test was for a position to write algorithms in JavaScript. :-) – Bart van Ingen Schenau Dec 18 '16 at 21:00
  • 1
    @BartvanIngenSchenau: Well then the company just doesn't know how to interview, and quite possibly has no idea what they're doing. – Robert Harvey Dec 18 '16 at 21:01
  • 1
    That happens quite often in companies where the tests are writen by HR and quickly reviewed by some and random developer in the company. The easy way is taking questions from the official certifications exams. Practice that has been proved to be useless because say nothing about the person an its capabilities. – Laiv Dec 18 '16 at 21:24
  • @NicolBolas Explaining skills is a bit hard right now. I was asked to evaluate my skills in JS, C++ and algorithms (!) on a scale of 1 to 5... I think they gave me a C++ test because I had some experience in C++, and because there was absolutely nothing to test on my JavaScript competences since I don't have any (my profile was still interesting though I assume, otherwise they wouldn't bother going through the whole recruitment process) – Sonia Seddiki Dec 18 '16 at 22:13
  • The thing here is that the tests they use come from specialized platforms, websites dedicated to test people on logic, personality, algorithms, programming and English. I don't know how they will use those tests, nor what the grade to these tests actually mean. – Sonia Seddiki Dec 18 '16 at 22:18
  • @SoniaSeddiki Did they interview you yet, or is this pre-interview? If they interview you, consider asking them why they use such a test (this is for your own information too). How they answer may also shape your decision of how badly you want to work there. – Brandin Dec 18 '16 at 22:43
  • @Brandin I already got an interview with the dev team and the HR, and this test came after with a bunch of others (logic, personality, algorithms and English). – Sonia Seddiki Dec 18 '16 at 22:48
  • 1
    Probably the only non-subjective way is to really give a problem with clear requirements and see how well you can implement a program that meets them. Or if there are unclear requirements part of the test could also be to see if/how well you try to clarify them. – Brandin Dec 18 '16 at 23:03
3

Completely objective (and just as useful as most tests):

#include <random>
#include <iostream>

int skill() { 
    static std::mt19937_64 gen{std::random_device()()};
    static std::uniform_int_distribution<int> range(1, 10);

    return range(gen);
}

int main(int argc, char **argv) { 
    if (argc != 2) {
        std::cerr << "Usage: skill_level <candidate name>\n";
        return EXIT_FAILURE;
    }

    std::cout << "On a scale of 1 to 10, " << argv[1] << " rates a: " << skill() << "\n";
}

If you want a result that's useful, it's probably going to get somewhat subjective instead. Objective testing mostly tests the ability to regurgitate facts on demand--but what matters for real programming is understanding.

While I think it's fair to state that at least some knowledge of facts is necessary for understanding, I can't imagine anybody thinking it's (even close to) sufficient. As such, you're pretty much stuck with guessing about their level of understanding based on indicators that combine indirection and subjectivity in varying degrees.

Jerry Coffin
  • 44,385
  • 5
  • 89
  • 162