Spot the bug quiz.

Started by
37 comments, last by Stefan Fischlschweiger 8 years, 10 months ago

A friend of mine posted this little quiz on Google+ not too long ago, and I thought you guys might get a kick out of it if you haven't seen it before. I haven't seen C++ code in ages (I'm a Java-based code monkey myself), but I was still able to get some of the questions right. Fair warning: some of the code present is a major eye sore. Not quite THAT bad though.

http://q.viva64.com/

Yo dawg, don't even trip.

Advertisement

That looks fun, but I cannot play on this little phone! Too many instances of me screaming " NO! Not the comma! Arrgh!"

I'll have to wait until I get home.

As to that other link you posted.. O.o Oh. My. God!

11 / 15.

I assumed it has to be a bug while one of answers was simply a misplaced semicolon. Didn't expect that.

12/15, thought it only gave me 11/15 because in the misplaced bracket question I identified the problem correctly but clicked on the == instead of the misplaced bracket (it seemed reasonable, honestly, that was unfair) so I just gave myself the point. I didn't spot the misplaced semicolon either somehow, goes to show how these things are easy to miss!

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

12/15, thought it only gave me 11/15 because in the misplaced bracket question I identified the problem correctly but clicked on the == instead of the misplaced bracket (it seemed reasonable, honestly, that was unfair) so I just gave myself the point. I didn't spot the misplaced semicolon either somehow, goes to show how these things are easy to miss!

Yeah, same thing happened to me. And in one case i misclicked by one character.

Ohh, I earn a title of "Pedant of C++".

Most of those were copy/paste bugs, and their names were pretty bad, or at least looked bad out of context.

Fun little quiz.

Ohh, I earn a title of "Pedant of C++".

Most of those were copy/paste bugs, and their names were pretty bad, or at least looked bad out of context.

Fun little quiz.

I thought the same thing to myself. Not to mention, a good chunk of those bugs weren't really C++ specific. They could have happened in any language. For instance, there was a lot of bugs where people wrote

x0 - x1;

y0 - y1;

y0 - z1;

which can literally happen in any language. Some things, however, were classic C++ wtf moments.

Yo dawg, don't even trip.

Interesting quiz, but it's too picky about what you're supposed to click on. In some cases, I wanted to select the entire code snippet.

Nice touch that all the samples come from real life projects, and you even get to know which project :)

Interesting quiz, but it's too picky about what you're supposed to click on. In some cases, I wanted to select the entire code snippet.

Yeah I gave up on the memcmp(a,b,c == 0) question (which should be memcmp(a,b,c)==0)

My answer was "The ==0 is in the wrong place, it needs to be after the close-parenthesis", so I clicked on the ==.

But then the quiz said "Nope! The close-parenthesis is in the wrong place, it needs to be before the ==".

angry.png

This topic is closed to new replies.

Advertisement