Important questions about Assertions. Assertions MCQ questions with answers. Assertions exam questions and answers for students and interviews.
A : Assertions can be enabled or disabled on a class-by-class basis.
B : Conditional compilation is used to allow tested classes to run at full speed.
C : Assertions are appropriate for checking the validity of arguments in a method.
D : The programmer can choose to execute a return statement or to throw an exception if an assertion fails.
A : Assertion expressions should not contain side effects.
B : Assertion expression values can be any primitive type.
C : Assertions should be used for enforcing preconditions on public methods.
D : An AssertionError thrown as a result of a failed assertion should always be handled by the enclosing method.