C++
Raiting:
35

Let's Play a Game




The authors of the PVS-Studio analyzer invite you to test your attentiveness.

Code analyzers never get tired and can find errors a human's eye cannot easily notice. We have picked a few code fragments with errors revealed by PVS-Studio, all the fragments taken from well-known open-source projects.

We invite you to take part in a competition against code analyzers to test your agility by trying to find the errors by yourself. You will be offered 15 randomly selected tasks. Every correct answer earns you one score if you give it within 60 seconds. The code fragments are short and 60 seconds is a fair limit.

Let's examine a couple of examples with errors for you to understand how to give the answer.



Example one. You see the following code:

image

The programmer has made a typo and written index 3 instead of 2. When moving the cursor above the code, various words and numbers will be highlighted. You should point the cursor at number 3 and click the left mouse button.

That will be the right answer.

Example two. It's not always possible to give one definite answer:

image

The buffer size is to be compared to number 48. The programmer accidentally wrote an excess sizeof() operator, which will result in comparing the buffer size to the size of the int type.

In my opinion, it is the "sizeof" operator which is a mistake here and this is the word you should point the mouse at. However, without knowing the complete program text, one may go another way in one's thinking: the 'sizeof' operator was to calculate the size of some buffer but was mistakenly fed a macro. The error then is in "SSL3_MASTER_SECRET_LENGTH".

For cases like this, both answers (whether "sizeof" or "SSL3_MASTER_SECRET_LENGTH") will count as correct.

Good luck. Start game.

P.S. We understand that the tasks are not perfect; it's not always clear where exactly you should <br />"hit" with the mouse, and the system can be cheated. Just remember that this site section was created purely for fun's sake, not for detailed and reliable testing of someone's abilities.
Andrey2008 18 september 2014, 16:15
Vote for this post
Bring it to the Main Page
 

Comments

0 thania November 4, 2016, 1:20
Great to see that someone still understand how to create an awesome blog.
Good blog.
0 poflogin November 29, 2016, 3:33
Thank you for advices, I decided to get second degree and your site became very helpful in my situation

Leave a Reply

B
I
U
S
Help
Avaible tags
  • <b>...</b>highlighting important text on the page in bold
  • <i>..</i>highlighting important text on the page in italic
  • <u>...</u>allocated with tag <u> text shownas underlined
  • <s>...</s>allocated with tag <s> text shown as strikethrough
  • <sup>...</sup>, <sub>...</sub>text in the tag <sup> appears as a superscript, <sub> - subscript
  • <blockquote>...</blockquote>For  highlight citation, use the tag <blockquote>
  • <code lang="lang">...</code>highlighting the program code (supported by bash, cpp, cs, css, xml, html, java, javascript, lisp, lua, php, perl, python, ruby, sql, scala, text)
  • <a href="http://...">...</a>link, specify the desired Internet address in the href attribute
  • <img src="http://..." alt="text" />specify the full path of image in the src attribute