787
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.
If it's a statically typed language and
x
is 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 fromString
toDate
, 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.length
because 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