CSIS 212 MIDTERM EXAM – QUESTION AND ANSWERS (Graded A)
CSIS 212 MIDTERM EXAM
CSIS 212
CSIS 212 MIDTERM EXAM – QUESTION AND ANSWERS (Graded
... [Show More] A)
Question 1
3 out of 3 points
Which software product release category is "generally feature complete and supposedly bug free, and ready for use by the community?"
Selected Answer: Release candidate.
Question 2
3 out of 3 points
Which of the following statements is false?
Selected Answer: Today’s fastest Internet speeds are on the order of trillionsof bits per second with quadrillion-bit-per-second speeds on the horizon.
Question 3
3 out of 3 points
Which of the following statements is false?
Selected Answer: Each class can be used only once to build many objects.
Question 4
0 out of 3 points
Which of the following statements is false?
Selected Answer: A quadrillion-instruction-per-section computer can perform in one second more than 100,000 instructions for every person on the planet.
Question 5
3 out of 3 points
Which of the following statements is false?
Selected Answer: Android—the fastest-growing mobile and smartphone operating system—is based on the Windows kernel and uses Java.
Question 6
3 out of 3 points
________ involves reworking programs to make them clearer and easier to maintain while preserving their correctness and functionality.
Selected Answer: Refactoring
Question 7
3 out of 3 points
________ models software in terms similar to those that people use to describe real-world objects.
Selected Answer: Object-oriented design
Question 8
3 out of 3 points
Which of the following statements is true?
Selected Answer: The Internet is just a network of computers.
Question 9
3 out of 3 points
All import declarations must be placed
Selected Answer: before the class declaration.
Question 10
3 out of 3 points
Which of the following is a variable declaration statement?
Selected Answer: int total;
Question 11
0 out of 3 points
Which of the following does not contain a syntax error?
Selected Answer: System.out.println("Hello
world!");
Question 12
3 out of 3 points
Which of the following statements does not alter the value stored in a memory location?
Selected Answer: int a;
Question 13
3 out of 3 points
Each of the following is a relational or equality operator except:
Selected Answer: =!
Question 14
3 out of 3 points
When method printf requires multiple arguments, the arguments are separated with ________.
Selected Answer: commas (,).
Question 15
3 out of 3 points
Which of the following cannot cause a syntax error to be reported by the Java compiler?
Selected Answer: An extra blank line.
Question 16
3 out of 3 points
Which of the following statements would display the phase Java is fun?
Selected Answer: System.out.println("hellois fun\rJava ");
Question 17
3 out of 3 points
Which of the following statements is false?
Selected Answer: Each class declaration that begins with the access modifier private must be stored in a file that has the same name as the class and ends with the .java filename extension.
Question 18
3 out of 3 points
Floating-point literals are of type ________ by default.
Selected Answer: double
Question 19
3 out of 3 points
An import declaration is not required if you always refer to a class with its ________ name, which includes its package name and class name.
Selected Answer: fully qualified name
Question 20
3 out of 3 points
Which of the following statements is true?
Selected Answer: Every instance variable has a default initial value—a value provided by Java when you do not specify the instance variable’s initial value.
Question 21
3 out of 3 points
Which of the following statements is false?
Selected Answer: To distinguish a constructor from a class’s operations, the UML places the word “constructor” between double quotes before the constructor’s name.
Question 22
3 out of 3 points
The format specifier %.2f specifies that two digits of precision should be output ________ in the floating-point number.
Selected Answer: to the right of the decimal point
Question 23
3 out of 3 points
Types in Java are divided into two categories. The primitive types are boolean, byte, char, short, int, long, float and double. All other types are ________ types.
Selected Answer: reference
Question 24
3 out of 3 points
Java requires a ________ call for every object that’s created.
Selected Answer: constructor
Question 25
3 out of 3 points
Which of the following statements about the conditional operator (?:) is false?
Selected Answer: The second operand is the result value if the condition evaluates to false.
Question 26
3 out of 3 points
What is the size in bits of an int?
Selected Answer: 32
Question 27
3 out of 3 points
Which primitive type can hold the largest value?
Selected Answer: double
Question 28
0 out of 3 points
Which of the following statements is true?
Selected Answer: Logic errors are caught by the compiler. Syntax errors have effects at execution time.
Question 29
3 out of 3 points
How many times is the body of the loop below executed?
int counter = 1;
while (counter > 20) {
// body of loop
counter = counter - 1;
}
Selected Answer: 0.
Question 30
3 out of 3 points
Which of the following is not a primitive type?
Selected Answer: String
Question 31
3 out of 3 points
Which statement is true?
Selected Answer: All of the above.
24.Which of the following terms is not used to refer to a sentinel value that breaks out of a while loop?
a. signal value.
*b. maximum value.
c. dummy value.
d. flag value.
Question 32
3 out of 3 points
Which of the following is not an algorithm?
Selected Answer: Textbook index.
Question 33
3 out of 3 points
Consider the classes below:
public class TestA {
public static void main(String[] args) {
int x = 2;
int y = 20
int counter = 0;
for (int j = y % x; j < 100; j += (y / x)) {
counter++;
}
}
}
public class TestB {
public static void main(String[] args) {
int counter = 0;
for (int j = 10; j > 0; --j) {
++counter;
}
}
}
Which of the following statements is true?
Selected Answer: Neither (a) nor (b) is true.
Question 34
0 out of 3 points
Which of the following for-loop headers results in equivalent numbers of iterations:
Selected Answer: for (int q = 100; q >= 0; q--)
Question 35
3 out of 3 points
Which expression is equivalent to if (!(grade == sentinelValue))?
Selected Answer: if (grade != sentinelValue)
Question 36
3 out of 3 points
Which of the following statements is true?
Selected Answer: Strings can be used in a switch statement’s controlling expression and in its case labels.
Question 37
3 out of 3 points
Consider the following two Java code segments:
Segment 1 Segment 2
int i = 0;
for (int i = 0; i <= 20; i++) {
while (i < 20) { System.out.println(i);
i++; }
System.out.println(i);
}
Which of the following statements are true?
Selected Answer: Both (a) and (b) are true.
Question 38
3 out of 3 points
The control variable of a counter-controlled loop should be declared as ________to prevent errors.
Selected Answer: int.
Question 39
3 out of 3 points
For the code segment below:
switch(q) {
case 1:
System.out.println("apple");
break;
case 2:
System.out.println("orange");
break;
case 3:
System.out.println("banana");
break;
case 4:
System.out.println("pear");
case 5:
System.out.println("grapes");
default:
System.out.println("kiwi");
}
Which of the following values for q will result in kiwi being included in the output?
Selected Answer: Any integer less than 1 and greater than or equal to 4.
Question 40
3 out of 3 points
Which case of the following would warrant using the boolean logical inclusive OR (|) rather than the conditional OR (||)?
Selected Answer: Testing if at least one of two conditions is true when the right operand has a required side effect.
Question 41
0 out of 3 points
Which of the following can be used in a switch statement in the expression after keyword case?
Selected Answer: an enumeration constant.
a. A and B.
b. A and C.
c. B and C.
*d. All.
Question 42
3 out of 3 points
Consider the code segment below.
if (gender == 1) {
if (age >= 65) {
++seniorFemales;
}
}
This segment is equivalent to which of the following?
Selected Answer: if (gender == 1 && age >= 65) {
++seniorFemales;
}
Question 43
3 out of 3 points
Which of the following is not a type of iteration statement in Java?
Selected Answer: loop statement.
Question 44
3 out of 3 points
Which of the following statements about a do…while iteration statement is true?
Selected Answer: The body of a do…while loop is always executed at least once.
Question 45
3 out of 3 points
Which of the following statements about the switch statement is false?
Selected Answer: You can use a comma-separated list of Strings in a switch statement’s case label.
Question 46
3 out of 3 points
Which statement below is false?
Selected Answer: Structured programming requires four forms of control.
Question 47
3 out of 3 points
Which of the following will not help prevent infinite loops?
Selected Answer: Include braces around the statements in a do…while statement.
Question 48
3 out of 3 points
For the two code segments below:
Segment A
int q = 5;
switch(q) {
case 1:
System.out.println(1);
case 2:
System.out.println(2);
case 3:
System.out.println(3);
case 4:
System.out.println(4);
case 5:
System.out.println(5);
default:
System.out.println("default");
}
Segment B
q = 4;
switch(q) {
case 1:
System.out.println(1);
case 2:
System.out.println(2);
case 3:
System.out.println(3);
case 4:
System.out.println(4);
case 5:
System.out.println(5);
default:
System.out.println("default");
}
Which of the following statements is true?
Selected Answer: The output for Segment A is:
5
default
Question 49
3 out of 3 points
Which of the following statements about the continue statement is true?
Selected Answer: A continue statement proceeds with the next iteration of the immediately enclosing while, for, do…while statement.
Question 50
3 out of 3 points
Which statement prints the floating-point value 123.456 right justified with a field width of 10?
Selected Answer: System.out.printf("%10.3f", 123.456);
Sunday, February 9, 2020 7:59:37 PM EST
OK [Show Less]