2015 MC Practice
test corrections and notes from201 the 2015 MC Practice
Score: 32/29
Corrections:
Question 4
Topic 6.4: Developing Algorithms Using Arrays
The correct answer is C: The largest value in arr is negative. maxVal is initialized to be greater than all other values in the array. Negative will not allow this
Question 9
Topic 2.9: Using the Math Class
The correct answer is E: 2 + (int) (Math.random() * 6) + (int) (Math.random() * 6). Math.random() produces a decimal between 0 and 1, including 0. Therefore multiplying it by 6 will produce a value 0-5. The dice are 1-6 so you need to add 2.
Question 13
Topic 6.4: Developing Algorithms Using Arrays
The correct answer is A: {17, 20, 21, 42, 45, 69, 48, 51, 39}. Only the first 3 values are changed. Updates the numbers at indexes 1, 4, and 7.
Question 10
Topic 2.6: String Objects - Concatenation, Literals, and More
The correct answer is D: 0008. The first line initialized str as 0. Then the second adds 008 to what the string already had to result in 0008.
Question 16
Topic 8.2: Traversing 2D Arrays
The correct answer is E: The column index of an element with the largest value in the two-dimensional array. Iterates through all rows and columns and finds the largest value.
Question 18
Topic 1.3: Expressions and Assignment Statements
The correct answer is D: 401. Problem uses integer rounding so 404/10=40.
Question 25
Topic 5.6: Writing Methods
The correct answer is E: 1 2 3 4 5 6 blackboard. All original values and names are printed. Changes made to arr and word do not affect the actual parameters num and name
Question 37
Topic 6.4: Developing Algorithms Using Arrays
The correct answer is E: II and III. Both II and III iterate through all the elements and order them in reverse.