Giveaway answer fields in challenges | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Giveaway answer fields in challenges

Hi everyone. I was wondering whether it would be possible to change the way we input the answer to “What is the output of this code?” questions, at least in challenges; otherwise, the number of characters required will often give the answer away. For example, the question below should presumably test one’s understanding of the && operator, but since the output must be 7 or 10, and the answer can only be one character in length, it isn’t necessary to worry about the actual question! What is the output of this [c++] code? int x = 7; int y = 3; if (x > 5 && y < 2) cout << x + y; else cout << x - y; Just a thought... 😁

28th Jun 2019, 3:22 PM
Ed Morrow
4 Answers
+ 15
Not a bad idea, although in your example, it's easy to use 6 instead of 7 and fix the problem: int x = 6; int y = 3; if (x > 5 && y < 2) cout << x + y; else cout << x - y; i like it when i see that the challenge creators have taken care of it in a creative way.
28th Jun 2019, 3:30 PM
Cépagrave
Cépagrave - avatar
+ 11
Agreed, I've also noticed
28th Jun 2019, 5:22 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
+ 10
I agree and if I remember right once asked the community a very similar question but there was not much support for changing things.
30th Jun 2019, 5:21 AM
Sonic
Sonic - avatar
+ 3
Good point, there’s probably usually a way to fix the questions themselves, which would be a lot simpler. I have seen quite a few where it’s possible to “cheat”, though.
28th Jun 2019, 3:42 PM
Ed Morrow