Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (TCO 1) For the values given, what will c contain after executing the followi

ID: 3639118 • Letter: 1

Question

1. (TCO 1) For the values given, what will c contain after executing the following?

int a = 9, b = 4, c = -2;
c *= ++a % b;

4
-4
-2
2

3. (TCO 10) For readability, variable names should be:

short and only use lower case letters.
a random mix of letters and numbers for security reasons.
very long and complex to assure uniqueness of each name.
indicative of what value is being stored in the variable.


4. What is the value of beta after the following code executes if the input is 5?

int beta;
cin >> beta;
switch(beta)
{
case 5:
beta += 5;
case 1:
beta++;
case 5:
beta += 5;
break;
case 4:
beta += 4;
}

16
11
7
20


5. How many times does the following loop body execute?

int count = 52;
for(int i = 0; i < count; i++)
{
cout << count << endl;
--count;
}

26
52
25
None of the above


6. A reference from your code to some external resource which cannot be resolved leads to a

runtime error.
linker error.
compiler error.
All of the above


8. Testing repetition statements:

must validate that a loop repeats the correct number of times.
controlled by complex conditionals can involve many test cases.
must have a test case for each condition which terminates the loop.
All of the above


9. When doing feature testing, _______.

a test case is based on how a correct solution to the problem would respond to given inputs
the tester focuses on the selection and repetition statements in the program code
test cases cannot be written until the program code is complete
None of the above


10. When a variable is passed by reference as a function argument,

its value is copied
it can have its value both read and modified by the function
it is protected from being modified by the function
All of the above


11. Arrays are always passed into a function by location because

passing an array by value would require changing every element of the array.
it is much quicker to pass location information than to create a copy of the entire array which would be needed for pass by value.
a function should never need a private copy of an array to work on.
None of the above


12. An array is used in a program to:

gather together a set of related data items of various types.
organize a collection of values of the same type.
encapsulate a set of data behind methods which are provided to access the data.
None of the above



Explanation / Answer

1. -4 3. indicative of what value is being stored in the variable 4.16 5.26 6.linker error 8.All of the above 9.None of the above 10.it can have its value both read and modified by the function 11.it is much quicker to pass location information than to create a copy of the entire array which would be needed for pass by value. 12.organize a collection of values of the same type.