MCQs
None.
None.
Due to history of using integer values as booleans, if an integer is used as a boolean, then incrementing
will mean that whatever its truth value before the operation, it will have a truth-value of true after it.
However, it’s not possible to predict the result of — given knowledge only of the truth value of x, as
it could result in false.
The if-statement block is only not executed when the expression evaluates to 0. It’s just
syntactic sugar for a branch-if-zero instruction.
None.
The given number is a double not an integer, so the function returns 0 which is boolean false.
C++ has bool as a fundamental data type.
std::vector<bool> is a specialized version of vector, which is used for elements of type
bool and optimizes for space. It behaves like the unspecialized version of vector and the
storage is not necessarily an array of bool values, but the library implementation may
optimize storage so that each value is stored in a single bit.
A pointer can be implicitly converted to a bool. A nonzero pointer converts to true and zerovalued
pointer converts to false.