Answer the following statements true (T) or false (F)
1. The if, while and for statements control only one statement.
2. Given the declaration
```
int x = 0;
```
The following expression causes a divide by zero error:
```
(x !=0) || (2/x < 1);
```
3. Suppose we have these declarations,
```
int x = -1, y = 0, z = 1;
{/code
This Boolean expression is correct and it does what the programmer intends.
```
x < y < z
```
4. You want to determine whether time has run out. The following code correctly implements this.
```
!time > limit
```
5. The value of count is 0; limit is 10. Evaluate:
```
(count == 0)&&(limit < 20)
```
1. True
The one statement may be a block (statements that are enclosed with
curly braces { }) or a simple statement.
2. False.
The || operator uses short-circuit evaluation. The first member of this
expression is true; the truth value of the complete expression can be determined
from this; consequently, the second expression is not evaluated. There is no divide-
by-zero error.
3. False
Unfortunately, the expression compiles without error and runs. The < operator associates (groups) left to right, so the expression evaluates as
```
(x < y) < z
```
The left hand expression evaluates to true, which, if compared to a numeric type, converts to 1. When compared to 1, this is false. What the programmer intends, expressed as mathematacs might is -1 < 0< 1, a result that is clearly true.
4. False.
The expression always evaluates to false. This cannot be what the programmer intended. The compiler doesn’t catch the problem because the code is legal, correct C++. Corrected code is
```
!(time > limit)
```
Code execution proceeds as follows: The operator ! takes a bool argument. It returns the opposite bool value. The value of time is converted to a bool. The value of time is certainly nonzero, hence !time is !true, i.e., false. The > compares this result with a numeric value, limit, (an int or perhaps some kind of floating point). The value on the left (false) is converted to a 0 value of that type. The value of limit is unlikely to be a negative number and we are concerned about time running out, so it is unlikely that time is zero. Consequently, the inequality becomes 0>limit, where limit is nonzero. This is false.
5. true
You might also like to view...
In the ___________________-alternative decision structure the Else part is empty.
Fill in the blank(s) with the appropriate word(s).
Answer the following questions true (T) or false (F)
1. An object of a derived class type has exactly one type, the type with which it was declared. 2. If a base class constructor is not called explicitly in the definition of a derived class constructor, an error results.
A(n) ________ describes all the possible values and likelihoods that a given variable can be within a specific range, and they can be in the form of a graph, table, or formula
A) continuous variable B) probability distribution C) observational unit D) discrete variable
Which feature on an NTFS volume provides file encryption?
A. EFS B. NFS C. SMB D. FTP