If the following code fragment is executed in an otherwise complete and correct program, which expression will be executed? Why?

```
x = 0;
if (x = 12)
yes_statement;
else
no_statement;
```

a) The no_statement will be executed because x is not 12.
b) The statement has incorrect syntax so will not compile at all.
c) x=12 is illegal in the Boolean expression of an if statement.
d) The yes_statement will be executed.


d) The yes_statement will be executed.

The expression x = 12 has the value 12, which is converted to true, causing the if always to execute the yes_statement.

Computer Science & Information Technology

You might also like to view...

After choosing an array variable's type in the "Insert Variable" dialog box, click the checkbox labeled ____ and initialize the variable by choosing ____.

A. is array; Array Variable B. is array; Custom Array C. is item; Item Variable D. is item; Custom Item

Computer Science & Information Technology

Which output column of the ls command displays the filename?

A. The first column B. The second column C. The seventh column D. The eighth column

Computer Science & Information Technology

The computer's time and date should be compared against a known standard, such as ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Answer the following statement(s) true (T) or false (F)

When an investigator finds a mix of information, judges often issue a limiting phrase to the warrant, which allows the police to present all evidence together.

Computer Science & Information Technology