First off, if a question were to simply ask "What would be the result?" on a question involving assterions on the exam, do we assume that assertions are enabled or disabled at runtime? Compiled with or not compiled with?
What is the result of the following question?
A. An AssertionError is thrown and "Continue..." is output. B. An AssertionError is thrown with the message �No good�. C. An AssertionError is thrown with the message �Ok�. D. Continue... E. Compilation fails.
Answer givenis E. I also think it won't compile due to incorrect syntax on line 1??? But i don't trust this mock's results because they have alot of errors in their answers.
Ex 2: assert (boolean expression) : "houston we have a problem"; -- (in this example the second part can be anything that returns a value, you can send it of to a method as long as the method returns a value, the result will be converted to a string and displayed with the stack trace)
The reason this code will fail to compile is because (val > 0) ? �Ok� : �No good� will not result in a boolean value, it will result in a String. The first part of an assert statement must always result in a boolean value, if you have a second expression as in example 2 that must always result in a value.
The first question is a good one though, from a similar point if they use assert as a variable name in a question are we to assume assertions are enabled?