Assume there are no syntax errors in the following program segment and that it will compile: 1.What is the value of n when the above program segment is done executing?A) n is: 18.int i = 2; int n = 18; while (i { if ((i % 2) == 0) i++; else n--; } cout 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: 3.And what are the values of i and n after execution?A) i will be 11. n will be 10.int i = 1; int n = 10; while (i { if ((i % 2) != 0) i++; } cout 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: 4.And what are the values of i and j after execution?A) i = 10, j = 21int i = 1; int j = 3; while (i { i++; j += 2; } cout B) i = 11, j = 22 C) i = 15, j = 20 D) i = 16, j = 21 5.What is the output of the above program segment?A) The output will be 31. B) The output will be 33. C) The output will be 34. D) The output will be 35. Assume there are no syntax errors in the following program segment and it will compile: 6.And what is the value of x after execution?A) The value of x after loop is done = -1.int x = 10; while (x > 0) { cout x -= 3; } 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; 8.And what are the values of i and n after execution?A) i = 1 and n = 0.int n = 0; while (i { cout i++; } 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.-----------------------------------------------------------------------------------------------------------
|
Click here to order this paper @Essaybay.net. The Ultimate Custom Paper Writing Service
No comments:
Post a Comment