CSCI 240 - Possible Questions for Quiz 3

  1. (2 points) Which of the following increments x by 1?

    1. 1++;
    2. x + 1;
    3. x = 1;
    4. x += 1;
    5. x+;
  2. (2 points) Select the three control structures that (along with sequence) will be studied in this course.

    1. int
    2. decision
    3. repetition/looping
    4. #include
    5. branch and return/function calling
  3. (2 points) Name one command that is used to implement the decision statement control structure that will be studied in this course.

  4. (2 points) Name the 3 C++ statements used to create a loop.

  5. (2 points) What will the following code display on the screen and where will it display?

  6. for (i = 0; i < 5; i++)
      cout << "\n";
      cout << i;
  7. (2 points) Write a for loop to display the first 5 multiples of 10 on one line. For example: 10 20 30 40 50

  8. (2 points) Write a while loop to display the first 5 multiples of 10 on one line. For example: 10 20 30 40 50

  9. (2 points) When is the 3rd subexpression in for (--; --; --) statement executed?

  10. (2 points) Write a decision statement to test if a number is even or not. If it is, print "even". If it is not, add 1 to it and print "it was odd, but now it's not".

  11. (2 points) Why is a while loop described as "top-driven"

  12. (2 points) If a read-loop is written to process an unknown number of values using the while construct, and if there is one read before the while instruction there will also be one

    1. at the top of the body of the loop
    2. at the bottom of the body of the loop
    3. in the middle of the body of the loop
    4. there are no other reads