Details of this Paper

C++ coding multiple choice questions

Description

solution


Question

Assume there are no syntax errors in the following program segment and that it will compile;int i = 2;int n = 18;while (i < n);if ((i % 2) == 0);i++;else;n--;cout << i << endl, 1. What is the value of n when the above program segment is done executing? A) n is: 18.;B) n is: 3.;C) Infinite Loop. i will not change.;D) No Output.;2. What is the output of the above program segment? A) There is no output.;B) The output is 2.;C) The output is 18.;D) The output is 3.;Assume there are no syntax errors in following program segment and that it will compile;int i = 1;int n = 10;while (i < n);if ((i % 2) != 0);i++;cout << i << endl, 3. And what are the values of i and n after execution? A) i will be 11. n will be 10.;B) i will be 11. n will be 1.;C) Infinite Loop: i is stuck at 2 and n stays at 10.;D) No Output.;Assume there are no syntax errors and that the following code will compile;int i = 1;int j = 3;while (i < 15 &&& j < 20);i++;j += 2;cout << (i + j) < 0);cout << x << endl;x -= 3;6. And what is the value of x after execution? A) The value of x after loop is done = -1.;B) The value of x after loop is done = -2.;C) The value of x after loop is done = 1.;D) The value of x after loop is done = 2.;7. What is the output of the following program segment? A) -2;B) 10 9 8 7 6 5 4 3 2 1;C) 1 4 7 10;D) 10 7 4 1;Assume that the following segment of code has no syntax errors and will compile;int i = 1;int n = 0;while (i <= n);cout << i;i++;8. And what are the values of i and n after execution? A) i = 1 and n = 0.;B) i = 2 and n = 0.;C) i = 0 and n = 0.;D) i = -1 and n = 0.;9. What is the output of the following program segment? A) 1, 2, 3,...;B) 1;C) 0;D) No output. -----------------------------------------------------------------------------------------------------------;Given the following segment of code, assume the syntax is correct and that it will compile;int extra;extra = extra + 1;if (extra == 0);cout << "medium;else if (extra < 0);cout << "small;else;cout << "large", 1. What is the output of the code when initial value of extra is 2? A) large;B) medium;C) small;2. What is the output of the code when initial value of extra is -1? A) small;B) medium;C) large;3. What is the output of the code when initial value of extra is -88? A) small;B) medium;C) large;Assume the syntax is correct for the following segment of code and that is will compile;int a;int b;int c;if (a % 2 != 0);b = a * 2 ? 6;if (a == b);c = a + b;else if (a < b);c = b ? a;else;c = 25;else if (a 20);c = 5;b = a ? 3;if ((b > c) && (b c) || (b < c));a = 3 - b;else;a = b / c;else;c = 6 * a;b = a + c;4. What are the final values of a, b, and c when the initial value of a is 8? A) a = -16, b = 19, c = 5;B) a = 21, b = 36, c = 15;C) a = 8, b = 56, c = 48;D) a = 9, b = 12, c = 3;5. What are the final values of a, b, and c when the initial value of a is 9? A) a = 9, b = 12, c = 3;B) a = 8, b = 56, c = 48;C) a = 3, b = 8, c = 3;D) a = -16, b = 19, c = 5;6. What are the final values of a, b, and c when the initial value of a is 21? A) a = 8, b = 56, c = 48;B) a = 9, b = 12, c = 3;C) a = 21, b = 36, c = 15;D) a = -16, b = 19, c = 5;7. What are the final values of a, b, and c when the initial value of a is 22? A) a = 8, b = 56, c = 48;B) a = -16, b = 19, c = 5;C) a = 9, b = 12, c = 3;D) a = 21, b = 36, c = 15

 

Paper#71572 | Written in 18-Jul-2015

Price : $19
SiteLock