1.How many values does the following scanf statement expect the user of the program to input:
scanf ("%i%i%i", &x,&y,&z);

a. 4 values
b. 3 values
c. 2 values
d. 1 value
2.What is output from the following code segment:
int x = 1, num;
while (x < 4)
{
num = x + x;
printf ("%i\n", num);
x++;
}

3. How would the last line of the following code segment need to be modified for the average calculation below to be correct? (Note: this is not an entire program just a code segment.) Modify the code in the box below.
float average;
int    total = 100, number = 27;
average = total/number;

4. (Points: 4.0)
It is common to confuse the equality operator with the assignment operator because the equality operator looks like Fill in the Blank 01and the assignment operator looks like Fill in the Blank 02

5. (Points: 4.0)
Which statement below  is equivalent to the following code segment:
if ( ( num % 2) == 0 )
printf ("Even.\n");
else
printf ("Odd.\n");

a. (num % 2) == 0 ? printf ("Odd.\n") : printf ("Even.\n");
b. (num % 2) == 0 ? printf ("Even.\n") : printf ("Odd.\n");
c. (num % 2) == 0 : printf ("Odd.\n") ? printf ("Even.\n");
d. (num % 2) == 0 : printf ("Even.\n") ? printf ("Odd.\n");

6. (Points: 4.0)
Assume the design below. Which conditions must be met in order for this person to get a car. Choose all that apply.
if ( (you complete your degree in 4 years) && (you get a job) ) then
You will get a car.

a. Person must get a job.  b. Person must take the summer off.  c. Person can complete degree in 3 years.  d. Person must complete degree in 4 years.

7. (Points: 4.0)
Based on the values of condition 1 and condition 2 (T = True, F = False), fill in the remainder of the truth table below with T's or F's.
Condition1 Condition2   Cond. 1 && Cond. 2   Cond. 1 || Cond. 2
F                 F               Fill in the Blank 01               Fill in the Blank 02
F                 T               Fill in the Blank 03               Fill in the Blank 04
T                 F               Fill in the Blank 05               Fill in the Blank 06
T                 T               Fill in the Blank 07               Fill in the Blank 08
Fill blanks above with correct T or F values.

8. (Points: 4.0)
Which C statement below causes the program to immediately exit from a loop, but continue processing the remainder of code in the program (if any).

a. continue;
b. exit;
c. break;
d. stop;

9. (Points: 4.0)
Which C statement below causes any statements following it in the body of the loop to be skipped, but allows the next iteration of the loop to be processed.

a. exit;
b. return;
c. break;
d. continue;

10. (Points: 4.0)
What is output from the following code segment:
for (x = 1; x <= 5; x++)
{
if (x != 3)
break;
printf ("%i  ", x);
} /* end for loop  */
printf ("Greetings");

1.

11. (Points: 4.0)
What is output from the following code segment:
for (x = 1; x <= 5; x++)
{
if (x != 3)
continue;
printf ("%i  ", x);
} /* end for loop */
printf ("Greetings");

1.

12. (Points: 4.0)
A group of contiguous memory locations related by the fact that they all have the same name and the same data type is knows as:

a. a function. b. a variable. c. an array. d. a loop.
13. (Points: 4.0)
What is wrong with the following while loop?
(Hint: it is a logic error, not a syntax error.)
int count = 1;
while (count <= 2)
{
printf ("C is fun!\n");
printf ("%i\n", count);
}

14. (Points: 4.0)
How many elements does array grades have?

a. 3 b. 6 c. 5 d. 4
15. (Points: 4.0)
How do we refer to the second element of the following array:

16. (Points: 4.0)
What is the value of nums after the following code segment is executed?:
int nums;
nums = 10;
nums = 11 + nums;
nums = nums + nums;
Please provide the integer value of what is stored in variablenums at this point in the program.

1.

17. (Points: 4.0)
Which of the following statements initializes the entire array nums to zero? (Choose all that apply, look very closely!):

a. for (i = 0, i < 4, i++) { nums[i] = 0; } b. int nums = {0, 0, 0, 0}; c. int nums = {0}; d. int nums[ ] = {0,0,0,0};
18. (Points: 4.0)
To declare array my_values to contain a maximum of 10 floating point numbers, the correct declaration would be:

a. float my_values;  b. float my_values[] = {1,2,3,4,5,6,7,8,9}; c. float my_values; d. float my_values;
19. (Points: 4.0)
What is output from the following code segment?
int num = 1;
while (num <= 3)
{
printf ("* ");
num = num + 1;
}
printf (" All done!");

20. (Points: 4.0)
The body of which looping structure is always executed at least 1 time?

a. the while loop b. the for loop c. the do loop d. the if loop

21. (Points: 4.0)
What is output from the following code segment?
int num = 1;
do
printf ("%i", num);
num = num + 1;
} while (num <= 3);

1.

22. (Points: 4.0)
A loop within another loop is known as:

a. a 2-dimensional loop. b. a double loop. c. a nested loop. d. a loop-dee-loop.

23. (Points: 4.0)
A looping structure which allows programmers to specify that an action is to be repeated as long as some condition remains true is known as:

a. a while loop. b. an array. c. an if structure. d. an if/else structure.
24. (Points: 4.0)

In the following program, what additional syntax is needed to ensure that the first 2 printf statements in the if structure shown will be executed only when the condition is true (i.e., when grade >= 60). Please make the change right in the code itself.

Excellent Solution

================  