Guess the Output
Look at the code snippet and pick, out of four options, the exact value that will be printed.
- Pergunta
- 1/10
- Pontuação
- 0
Clique na saída certa 1 a 4 no teclado Toque na saída certa Acerta 7 em 10 para ganhares
Each round has 10 code snippets, in JavaScript, Python or PHP, that start easy and get harder. Pick the language at the top of the play area, or play with all of them.
Without running the code anywhere, follow it in your head, line by line, and pick out of the four options what it will print on the screen. You can also answer with keys 1 to 4 and carry on with Enter.
Once you've answered, the terminal shows the real output and explains how the code gets there. Get 7 out of 10 right to win the round.
Tip: Keep track of each variable's value as the code goes along, as if you were the computer.
Tip: Watch out for text mixed with numbers: JavaScript's + joins text, PHP's always adds, and in Python it's an error.
Tip: Remember that list and string indices start at 0, and that Python's range leaves out the last number.
The ability to read code and predict its result without running it, often called "tracing" or mental execution, is a classic programming teaching technique, used for decades in introductory computer science courses and still common today in technical job interviews, precisely because it tests real understanding of the code's logic and not just memorised syntax.
Rate this game
No ratings yet
Log in to rateYour stats
Create a free account to keep your wins and your favourite games.
Create a free account →