Loops: 1. What is the difference between for, while, and do/while loops? Come up with examples of scenarios where each kind of loop is the best fit. 2. Write a loop that will print out every multiple of 15 less than 158 and greater than 0 , and explain/justify why you picked the type of loop you did. 3. What is the output of the following code? int count =1, num =25; while (count i;j) cout "Nesting" endl; 6. How many times will the following loop display play game? int check =1; do \{ \} while (check ==1 ); 7. How many times will the following loop display Loop? int i=7,j=3; while (i>++j) cout "Loop" endl; Midterm Review: T/F: 1. Suppose a,b,c, and d are integers, then if (! (a
c&c&d) ) ) is equivalent to if (a>b&&b ) must be followed by using namespace std; 6. When a loop is nested inside another loop, the inner loop goes through all its iterations of each iteration of the outer loop, but both inner and outer loop must be the same type of loop. Multiple choices: 1. If you have the following statement in your program, \#define YEAR 2022 then which of the following statement is ILLEGAL? A. cout YEAR; B. int year = YEAR; C. YEAR++; D. if (YEAR) 2. Which of the following is NOT true of the && operator? A. It is the logical AND operator. B. It returns true if either operand is true. C. It is a binary operator. D. It uses short circuit evaluation 3. Two different variables in the same program may have the same name A. Never. A program cannot have two variables with the same name. B. if the second one is initialized with a different value than the first one. C. if the second one is never declared. D. if they have different scope. 4. Which of the following is a valid variable name? A. num-of-cars B. 4years C. cars D. bool 5. The statement int a=1; int b=(a)++; A. This doesn't work. B. Assign b the value 1 , and change the value of a to 1 . C. Assign b the value 0 , and change the value of a to 1 . D. Assign b the value 0 , and change the value of a to 2 . 6. Which of the following will give you the range from 6.05 to 8.10, inclusive? A. float num =(rand()&6+5)0.01+rand()3+6; B. float num =(rand()&5+6)0.01+rand()&2+7; C. float num =(rand()=6+5)0.01+rand()&2+7; D. float num =(rand()=5+6)0.01+rand()=3+6