Explore topic-wise MCQs in Assertions Pointing out the correct statements.

This section includes 2 Mcqs, each offering curated multiple-choice questions to sharpen your Assertions Pointing out the correct statements knowledge and support exam preparation. Choose a topic below to get started.

1.

Which three statements are true? 1.Assertion checking is typically enabled when a program is deployed. 2.It is never appropriate to write code to handle failure of an assert statement. 3.Assertion checking is typically enabled during program development and testing. 4.Assertion checking can be selectively enabled or disabled on a per-package basis, but not on a per-class basis. 5.Assertion checking can be selectively enabled or disabled on both a per-package basis and a per-class basis.

A. 1, 2 and 4
B. 2, 3 and 5
C. 3, 4 and 5
D. 1, 2 and 5
Answer» C. 3, 4 and 5
2.

Which statement is true?

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.
Answer» B. Conditional compilation is used to allow tested classes to run at full speed.