I went into a job interview and they present me a paper with a sample code similar to this: This Sample Code and ask if this would compile. I told them it wouldn't compile, because at line 13, the expression wouldn't return a boolean value for If condition. They told me that it DOES compile and ask me what the outpost is going to be. At that point, I was dumbfound and that put my knowledge in C# in question like how am I suppose to know which if clause is going to be executed or it is actually a catch clause is going to be executed instead?
Eventually when I came back home to check my answer, it turn out that I was right that it wouldn't compile. The compiler would return an error saying, "Cannot implicitly convert type 'int' to 'bool'" from both Visual Studios 2013 AND CSC.exe (C# compiler.)
What does this suppose to mean in a job interview when people who asked me those questions, actually got the wrong answers? Are they just trying to fool me into trying to force me explaining my thought process when I am being introduced to the wrong answer that throw off everything I know about C#? Is this a normal practice in job interview now with a bunch of trick questions and intentional wrong answers?
by CSharpNetProg via /r/csharp