22) What will the following code display? <p>int x = 0;</p> <p>for (int count =
ID: 3633784 • Letter: 2
Question
22) What will the following code display?
<p>int x = 0;</p>
<p>for (int count = 0; count < 3; count++)</p>
<p>x += count;</p>
<p>cout << x << endl;</p>
<p>22)</p>
<p>A) 0 B) 3 C) 6 D)012</p>
<p> </p>
<p>23) A file must be ________ before data can be written to or read from it. A) opened</p>
<p>B) buffered</p>
<p>C) closed</p>
<p>D) initialized</p>
<p>E) None of these</p>
<p> </p>
<p>24) What will the following code display?</p>
<p>int number = 6</p>
<p>int x = 0;</p>
<p>x = --number;</p>
<p>cout << x << endl;</p>
<p>A) 5 B) 0 C) 7 D) 6</p>
<p> </p>
<p>25) What will the following code display?</p>
<p>int number = 6;</p>
<p>cout << number++ << endl;</p>
<p>A) 6 B) 0 C) 7 D) 5</p>
<p> </p>
<p>26) What will the following loop display?</p>
<p>int x = 0;</p>
<p>while (x < 5)</p>
<p>{</p>
<p>cout << x << endl;</p>
<p>x++;</p>
<p>}</p>
<p>A)01234</p>
<p>B)012345</p>
<p>C) 01 2 3 4</p>
<p>D) The loop will display numbers starting at 0, for infinity.</p>
<p> </p>
<p>27) This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the</p>
<p>condition is false from the beginning.</p>
<p>A) while</p>
<p>B) do-while</p>
<p>C) for</p>
<p>D) infinite</p>
<p>E) None of these</p>
<p> </p>
<p>28) If you want a user to enter exactly 20 values, which loop would be the best to use? 28)</p>
<p>A) for</p>
<p>B) do-while</p>
<p>C) while</p>
<p>D) infinite</p>
<p>E) None of these</p>
<p> </p>
<p>29) This is a special value that marks the end of a list of values. 29)</p>
<p>A) variable</p>
<p>B) constant</p>
<p>C) loop</p>
<p>D) sentinel</p>
<p>E) None of these</p>
<p> </p>
<p>30) This is a control structure that causes a statement or group of statements to repeat. 30)</p>
<p>A) loop</p>
<p>B) decision statement</p>
<p>C) constant</p>
<p>D) cout object</p>
<p>E) None of these</p>
<p> </p>
<p>31) This means to increase a value by one. 31)</p>
<p>A) increment</p>
<p>B) modulus</p>
<p>C) decrement</p>
<p>D) parse</p>
<p>E) None of these</p>
<p> </p>
<p>32) A loop that is inside another loop is called: 32)</p>
<p>A) a nested loop</p>
<p>B) an infinite loop</p>
<p>C) a post-test loop</p>
<p>D) a pre-test loop</p>
<p>E) None of these</p>
<p> </p>
<p>33) A for statement contains three expressions: initialization, test, and: 33)</p>
<p>A) null</p>
<p>B) validation</p>
<p>C) reversal</p>
<p>D) update</p>
<p>E) None of these</p>
<p> </p>
<p>34) When the increment operator precedes its operand, as in ++num1, the expression is in this mode. 34)</p>
<p>A) prefix</p>
<p>B) preliminary</p>
<p>C) binary</p>
<p>D) postfix</p>
<p>E) None of these</p>
<p>35) In a for statement, this expression is executed only once.</p>
<p>A) null</p>
<p>B) initialization</p>
<p>C) validation</p>
<p>D) test</p>
<p>E) None of these</p>
<p> </p>
<p>36) This is a dummy function that is called instead of the actual function it represents.</p>
<p>A) overloaded function B) main function</p>
<p>C) stub D) driver</p>
<p> </p>
<p>37) A file ________ is a small holding section of memory that file-bound information is first written to.</p>
<p>A) buffer</p>
<p>B) name</p>
<p>C) segment</p>
<p>D) number</p>
<p>E) None of these</p>
Explanation / Answer
Dear,
22) output of the code is 3
23) A file must be opened before data can be written to or read from it.
24)Output of the code is 5
25)Output of the code is 6
26)Output of the code is
0
1
2
3
4
27) A) while
28) for loop
29) sentinel
30) loop
31) increment
32) a nested loop
33) update
34) A) prefix
35) A) overloaded function
36) A) buffer
Hope this will help you..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.