Hacker News new | comments | show | ask | jobs | submit login

Oh, you came up with a shitty test (testing I'm not even sure what) to stroke your ego while probably turning some kids away from programming? And then you thought that a recollection of this experience was worth sharing with the world? I sarcastically applaud your efforts. But seriously you are a douche.

In fairness, the author does recognize that he failed in giving a good test.

The thing is, those questions demonstrate a certain type of playfulness in dealing with the subject. It is not uncommon for good students to think of this type of questions when they design their first tests, precisely because those are the kinds of questions that they like to think about themselves. What they fail to recognize is that those questions are incredibly hard for others precisely because of their playfulness.

So those questions are useful for quickly recognizing really good students (students that are so good that they transcend the requirements of the course and can deal with the subject on this playful level), but they should only make up a very small portion of any test. And teachers should probably warn their students about this type of question...

If the object of the course is to study C++, I say this is a good test, and it's not even that hard tbh.

I did not say it was. But it's a shitty test regardless.

Again, it depends on what those kids were supposed to study. If it's a general programming/algorithms class then yes this is testing the wrong knowledge. If it's a C++ specific class, this is completely justified. How does one come out of a C++ class and not know this stuff?

It was "an intro to programming course for incoming engineering freshman".

Also I write C++ for living and I was not entirely sure if "y = x++3;" was valid or not (turns out it is an error but "y = x+ +3;" is fine, which I would have guessed but would not have been quite certain).

Edit: Now that I think about, I believe that "x = (x++ == 3 + x % (x=x=3));" is undefined behavior. I guess the question is not asking about that but regardless, that's a stupid thing to ask.

If you set aside the fact that the deeper issue is probably that C++ in general is a bad intro language to begin with, then its not completely unreasonable to test on this syntactic stuff, especially as you go farther back when compilers/checkers were less friendly. For better or worse, one of the lessons of programming is the unforgiving nature of the computer to do exactly what you typed in, and not what you meant. I remember having a similar test or quiz to this when I was in high school (~12 years ago or so). Its not that big of a deal, the whole class is not just that, its just to kind of drill this into your head. We were using pretty terrible Borland compilers with rubbish error messages. At that particular point, being able to stare at code and determine what minor thing you mistyped was unfortunately a crucial skill. Again, this is arguably less important today (and arguably all written tests are bad for CS).

Later in college, I remember hating the assembly tests where you had to keep track of what numbers were in what address, and whether you were adding what was on the stack or in some register or the address or what was in the address and making a mistake in the very beginning could ruin the whole problem. Not fun, not sure how useful, but certainly gave you an appreciation of what was going on.

I guess my main issue is with OP's attitude regardless of the test's content. His sense of "lol, I sure showed the freshmen that I can put together a test that they would fail" is just plain dumb.

Questioning what the -Wall -Wextra -pedantic arguments mean would be better. This is how you find those typos in the real world.

Ask them about compiler errors. For example, what does "undefined reference to `vtable for Foo'" mean?

Then some style guide [0] might be helpful. Make them write the rvalue expression to the left of comparisons, because "if (3 = x)" is an error then. Or some "assert (this != NULL)" in methods.

Ask about semantics, like "What is the difference between a move and a copy constructor?" or "Write a program to demonstrate the difference between any two of static_cast,dynamic_cast,reinterpret_cast,const_cast,implicit cast" or "When should you use unique_ptr instead of shared_ptr?"

[0] http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...

Not really. To be honest, if anything it's good training. How many times have you seen an assignment operator in an if statement where a comparison operator was meant to be used?

Actually, now I think of it... all the questions were related to operators, except the last one which was a trick question. If all the questions bar one were in regards to operators only, then this isn't a particularly good test.

I disagree. Question#5 and bonus Question#1 are good questions. Production bugs are often close to these.

It tests if a student is able to follow a program's logic with rigor. It tests if you don't interpret the code but actually read it "as is".

Question#1 and Question#2 are less intelligent.

Also, no template test? Are you testing C with classes or C++ ? ;)

I found Question #1 to be bad, #2 is alright but coming close to just a 'trick' question. #5 is just a simple trick question, and I can see where people went wrong with it. Especially if they skimmed over the code, and in a high pressure test environment. The bonus question is reasonable and can be worked through, if it wasn't printing the string literals, which makes it just a mean trick question.

I think that's the problem with a lot of first time test (or interview) makers, they make their questions into trick/puzzle questions where they want the test taker to guess what the writer had in their mind.

--edited because I skimmed over the last question and assumed it was printing the values of the variables not the strings--

Screw that, I loved it when we'd get a "bonus test" that was actually really difficult.

I'm truly sorry that learning a real language takes some more effort than Ruby-loving ADHD rockstar developers can muster.

Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact