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

USE THE NG CHOICES FOR QUESTION 9-11 A. the for statement B. while statement C.

ID: 3842975 • Letter: U

Question

USE THE NG CHOICES FOR QUESTION 9-11 A. the for statement B. while statement C. the do/while statement D. the switch statement Which control statement which is best used when you know how many times to repeat the execution group of statement? The control statement which is best used when you need to choose which statements to execute from among many choices, and the condition for selection can be expressed as some expression is not necessarily integer? The control statement which is best used when you want to repeat a group of statements over and over based on a condition and the statements in the loop body must be executed at least once is the? use the following program SEGMENT to answer the next two questions int I, J; for (i = 2; i> = 0, i--) {for (J = 1; J

Explanation / Answer

9) the for loop is best use to when we know number of iterations.

10) switch statement gives you control over to execute among many choices and pick one based on some input and also it gives flexibility to accept type other than int.

11) do/while loop is best use when we need to repeat group of statements again and again and most importantly to make sure it run at least once because in do/while the first iteration runs and then we check the condition.

12) The statement will execute 6 times (number of T in execute colums)

13) The statement will execute number of times outer loop iterated that is for i = 2 and i =1 , two times

14) False , a do while loop repeats the loop body for at least once.

15) False, eof(end of file) is primarily useful where we don't know when to stop reading the file as have no knowledge about the size.

16) False, its a signal to notify that we have reached the end of file and have no prior knowledge.

17) #include<filestream>

i i>0 i-- j j<4 j++ execute 2 T 1 1 T 2 T 2 T 3 T 3 T 4 T 4 F F 1 T 0 1 T 2 T 2 T 3 T 3 T 4 T 4 F F 0 F