What I learned

  • Overall got a 34/39 on the mc
  • Topics I got wrong:
    • 1.B: Determine code that would be used to complete code segments.
    • 2.C: Determine the result or output based on the statement execution order in a code segment containing method calls.
    • 2.D: Determine the number of times a code segment will execute.
  • Overall, it seems that all of the questions that I missed had to do with trouble shooting code and spotting errors
  • In the future, I should work on getting better at spotting errors in code and seeing what is causing a specific error

Q3: Consider the following definition. Which of the following code segments produces the output 123456 ? ```

  • Notes: I said that the answer was E but it was A
  • I should’ve wrote out all of the outputs on paper
  • I was unsure on the answer and moved on because of time

Q6: Consider the following two classes.

What is printed as a result of executing the following code segment?

  • Because the algorithm uses a for-each loop to traverse the rows, the row index is not being stored.
  • I chose that “The row index of an element with the largest value in the two-dimensional array”
  • Answer was “The column index of an element with the largest value in the two-dimensional array”

Q7: Consider the following method. Alt text What is printed as a result of executing the following code segment?

  • I said that the answer was “00000”
  • The answer was “00100”
  • What I said would be the result for the method call combine(“00000”, “11111”), for example.

Q28: Consider the code segment below. int a = 1988; int b = 1990; String claim = “ that the world’s athletes “ + “competed in Olympic Games in “; String s = “It is “ + true + claim + a + “ but “ + false + claim + b + “.”; System.out.println(s); What, if anything, is printed when the code segment is executed?

  • I sad that the answer was “It is trueclaima but falseclaimb.”
  • The answer was “It is true that the world’s athletes competed in Olympic Games in 1988 but false that the world’s athletes competed in Olympic Games in 1990.”
  • I missed the fact that the values were from the concatenation and not the variables themselves