An assertion
a) is never more than just comment embedded in code
b) are always easily and precisely stated with C++ syntax,
c) is used to document and check correctness in programs
d) is typically a precondition or postcondition for a function
e) if converted to a Boolean statement, may be used with the library assert macro to test whether the assertion is satisfied at that point in the code.
All of these except a) and b) are true.
a) is way too restrictive. b) is optimistic beyond dreams. An assertion may well be just a comment, but can be much more, as c)-e) state. Assertions are used like this: If you know that some of variables in your program should have a specific values, or these variable should make an expression take on a value you know, you can write this out as a Boolean expression (as an assertion) and test it.
You might also like to view...
To determine a monthly interest rate, you must divide the annual interest rate by:
A) twelve. B) six. C) four. D) two.
A program that looks benign but actually has a malicious purpose is a _______
a. Trojan horse b. Virus c. Worm d. Cookie