What is the output from each of the following loops?

a) ```
while ( 0 )
cout << ‘X’;
cout << endl;
```
b) ```
do
cout << ‘X’;
while ( y != y );
cout << endl;
```
c) ```
int i = 1;
while (i < 9)
{
cout i;
i++;
}
```
d) ```
d) char c = 'A';
do
{
cout << c << " ";
c = c + 2;
} while ( c <= 'M' )
cout << endl;
```
e) ```
int i = 0;
while (i < 50)
{
if ( i < 20 && i != 15 )
cout << 'X';
i++;
}
cout << endl;
```


The output of each loop is:
a. The only output is a carriage return.
b. X
c. 12345678
d. A C E G I K M
e. XXXXXXXXXXXXXXXXXXX (There are 19 Xs.)

Computer Science & Information Technology

You might also like to view...

Based on what it returns, what would be a better name for the function "Mystery" in the following program?

``` Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim sentence As String, result As String sentence = "Socrates is a man." result = Mystery(sentence) txtBox.Text = result End Sub Function Mystery(sentence As String) As String Dim position As Integer position = sentence.IndexOf(" ") Return sentence.Substring(0, position) End Function ``` (A) FirstWord (B) LastWord (C) FirstLetter (D) LastLetter (E) DoesNothing

Computer Science & Information Technology

________ was an early innovation that helped decrease the amount time the computer wasted between jobs.

a) Batch processing b) Interactive computing c) Single-user contiguous memory allocation d) both a and b

Computer Science & Information Technology

Which of the following might NOT be considered a disadvantage for teleworkers?

A) Lack of security when data is transferred to home computer B) Save corporate office space C) Supervisors may have mind set of observing workers instead of monitoring online work D) Fellow employees might be resentful of arrangements

Computer Science & Information Technology

If you have to perform a repetitive task in Access, you may consider building a(n) ________ to automate the task

Fill in the blank(s) with correct word

Computer Science & Information Technology