If this code fragment were executed in an otherwise correct and complete program, what would the output be? Explain.
```
int a = 3, b = 2, c = 5
if (a > b)
a = 4;
if ( b > c)
a = 5;
else
a = 6;
cout << a < endl;
```
a) 3
b) 4
c) 5
d) 6
e) None of the above, the cout statement belongs to the else and so is skipped.
d) 6
The else belongs to the second if, despite indentation suggesting otherwise. Consequently, the first if statement executes, a is assigned the value 4, the second if executes, b is 2, c is 5, so b > c, evaluates to false so the else clause executes, so that a is assigned the value 6.
You might also like to view...
Examples of sans-serif fonts include all of the following EXCEPT ____.
A. Arial B. Times New Roman C. Verdana D. Helvetica
A ________ is set of commands and instructions that can be grouped as a single command to accomplish a task automatically
A) template B) macro C) linked object D) function
What is meant by the term availability?
A. how often a security solution or device must be updated and how long the updates take B. the amount or percentage of time a computer system is available for use C. the probability that a failed security solution or device can be restored to its normal operable state within a given timeframe using the prescribed practices and procedures D. making a security solution or device easier to use and matching the solution or device more closely to organizational needs and requirements
Which of the following is an attack where the hacker inserts himself between instructions, introduces changes, and alters the order of execution of the instructions, thereby altering the outcome?
A. memory leak B. bluesnarfing C. race condition D. integer overflow