CSCI 1300 Quiz: 6 Feb 2007 Special Weird Instructions: On any question, you may write the word UNCERTAIN beside your answer. For any UNCERTAIN answer you will receive: 30% credit even if you are wrong! But only 90% credit if you are right! 1. Write an example of an infinite loop. int i = 1; while(i > 0) { ++i; } 2. What is the output of this loop when it appears in a complete program? int n = 0; while (n <= 20) { cout << n << endl; ++n; } 3. Complete this program by completing the missing loop: #include #include using namespace std; int main( ) { int i = 1; int count = 0; // Complete this while loop so that it sets count // equal to the number of times that i must be // doubled (that is, multiplied by two) before // i gets bigger than one million: while (i <= 1000000) // Fill in the Boolean expression { ... // AND ALSO fill in the loop body i = 2*i; ++count; } cout << "If you double 1 " << count << " times, " << "you'll have more than a million!" << endl; } cout << "If you double 1 " << count << " times, " << "it will surpass one million!' << endl; return EXIT_SUCCESS; }