(CS 2010 Module 3 and 4: 2026 Questions and Answers)
To quit, a user types 'q'. To continue, a user types any ! (key == 'q')
other key. Which expression evaluates to true if a user
should coninue?
What is the output for x = 15? No match
switch (x) {
case 10:
// Output: "First "
break;
case 20:
// Output: "Second "
break;
default:
// Output: "No match "
break;
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM
, (CS 2010 Module 3 and 4: 2026 Questions and Answers)
Which expression for XXX and YYY correctly outputs age <13 / age <= 19
the test for pre-teen and teenager? Choices are in the
form XXX/YYY.
if (XXX) {
// Output "Pre-teen"
}
else if (YYY) {
// Output "Teenager"
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM
, (CS 2010 Module 3 and 4: 2026 Questions and Answers)
For what values of x does the default case execute in Only for values that are not 2, 3, or 4
the code below? x is declared as an integer.
switch (x) {
case 2:
......
break;
case 3:
.......
break;
case 4:
.......
break;
default:
........ // When does this execute?
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM
To quit, a user types 'q'. To continue, a user types any ! (key == 'q')
other key. Which expression evaluates to true if a user
should coninue?
What is the output for x = 15? No match
switch (x) {
case 10:
// Output: "First "
break;
case 20:
// Output: "Second "
break;
default:
// Output: "No match "
break;
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM
, (CS 2010 Module 3 and 4: 2026 Questions and Answers)
Which expression for XXX and YYY correctly outputs age <13 / age <= 19
the test for pre-teen and teenager? Choices are in the
form XXX/YYY.
if (XXX) {
// Output "Pre-teen"
}
else if (YYY) {
// Output "Teenager"
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM
, (CS 2010 Module 3 and 4: 2026 Questions and Answers)
For what values of x does the default case execute in Only for values that are not 2, 3, or 4
the code below? x is declared as an integer.
switch (x) {
case 2:
......
break;
case 3:
.......
break;
case 4:
.......
break;
default:
........ // When does this execute?
}
3/30/2026, 5:31:26 PM 3/30/2026, 5:31:25 PM 3/30/2026, 5:31:22 PM