789
Exam Answer
(programming.dev)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
In the error shown a compiler would be just fine and run as usual but the person programming it would be expecting a different result so a compiler wouldn't do this for you since it's a logical error and not a syntax error.
If it's a statically typed language and
xis of typeDate, it's for sure throw a type error when trying to assign a string to it. If it had autoboxing / auto type conversion fromStringtoDate, length could return a number or a string.If this were Javascript on NodeJS, it would fail at
print(x)because that doesn't exist in JS. If it were Python it would fail atx.lengthbecause that has to belen(x). And so on.If this were all to pass, at the latest at runtime, when the programmer sees the output "6", they would know something's up.
As I said, cute, but worthless test.
CC BY-NC-SA 4.0