Docsity

Introduction to Computer Programming - Quiz 4 Problems | CSCI 105, Quizzes of Computer Science

Toggle sidebar
bg1
CSCI 105 Introduction to Computer Programming Spring, 2009
Surprise Quiz #4
20 Points
MATCHING: For questions 1-10, select the item that best matches the description.
1. A C# statement that will perform an instruction only if a condition is true.
2. A C# statement that will perform one of two instructions depending on whether a condition is either true or
false.
3. A small rectangular box on a C# form that can be either "on" or "off".
4. One of a group of related circles on a C# form that can be selected.
5. A container that can be placed on a C# form to group components such as buttons together.
6. An example of one of these is (hour >= 40).
7. The checked attribute of a component will that this data type.
8. This is when you have if-statements used as the actions for other if-statements.
9. Multiple statements grouped together within braces.
10. Alters the sequential flow of a program. One example of these is repetition or a loop.
CHOICES:
a. block b. bool c. check box d. condition e. control structure
ab. if-statement ac. if-else-statement ad. nested if-statements ae. panel bc. radio button
MULTIPLE CHOICE:
11. What is the value of num after the following instructions are executed?
a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above
int num = 0, x = 7;
if (x > 9)
num++;
12. What is the value of num after the following instructions are executed?
a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above
int num = 2, x = 2;
if (num != x)
num *= 3;
13. What is the value of num after the following instructions are executed?
a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above
int x = -1, y=0, z=1;
if (y – x == z)
num = x + y;
else
num = z * 2;
14. What is the value of num after the following instructions are executed?
a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above
int num = 0;
if (18 % 5 > 3)
num++;
else
num--;
pf3

Partial preview of the text

Download Introduction to Computer Programming - Quiz 4 Problems | CSCI 105 and more Quizzes Computer Science in PDF only on Docsity!

CSCI 105 Introduction to Computer Programming Spring, 2009 Surprise Quiz # 20 Points MATCHING: For questions 1-10, select the item that best matches the description.

  1. A C# statement that will perform an instruction only if a condition is true.
  2. A C# statement that will perform one of two instructions depending on whether a condition is either true or false.
  3. A small rectangular box on a C# form that can be either "on" or "off".
  4. One of a group of related circles on a C# form that can be selected.
  5. A container that can be placed on a C# form to group components such as buttons together.
  6. An example of one of these is (hour >= 40).
  7. The checked attribute of a component will that this data type.
  8. This is when you have if-statements used as the actions for other if-statements.
  9. Multiple statements grouped together within braces.
  10. Alters the sequential flow of a program. One example of these is repetition or a loop. CHOICES: a. block b. bool c. check box d. condition e. control structure ab. if-statement ac. if-else-statement ad. nested if-statements ae. panel bc. radio button MULTIPLE CHOICE:
  11. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above int num = 0, x = 7; if (x > 9) num++;
  12. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above int num = 2, x = 2; if (num != x) num *= 3;
  13. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above int x = -1, y=0, z=1; if (y – x == z) num = x + y; else num = z * 2;
  14. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above int num = 0; if (18 % 5 > 3) num++; else num--;
  1. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above int num = 2, x = 9; if (x >= 9) num++; else num--;
  2. What is the value of num after the following instructions are executed? a) 0 b) 2 c) 4 d) 6 e) 14 ab) none of the above int x=2, y=3, z=7; if (x > 4 && z > 4) num = 2 * y; else num = 2 * x;
  3. What is the value of num after the following instructions are executed? a) 0 b) 2 c) 4 d) 6 e) 14 ab) none of the above int x=2, y=3, z=7; if (x > 4 || z > 4) num = 2 * y; else num = 2 * x;
  4. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above if (String.Compare(“Bob”, “Charlie”) == 0) num = 1; else num = 2;
  5. What is the value of num after the following instructions are executed? a) -2 b) -1 c) 0 d) 1 e) 2 ab) none of the above if (String.Compare(“Bob”, “Charlie”) < 0) num = 1; else num = 2;
  6. What is the value of num after the following instructions are executed? a) 0 b) 3 c) 5 d) 8 e) 16 ab) none of the above int num = 0, x=5, y=8, z=3; if (x > num) num = x; if (y > num) num = y; if (z > num) num = z;
  7. Extra Credit Super Mega Bonus Question : Which of the following is not like the others?