Question 2

image

  • I got this question wrong because I didn’t read the answer choice properly. I did not notice that it had a -1 attached to the animals.length and ignored the rest of the options.
  • Answer A is correct because the loop must iterate through the entire list and stop when the index i is equal to the length of the list, since indexes start from 0.
  • I can watch 6.2 daily videos 1-3 to learn this concept.

Question 7

image

  • I got this problem wrong because I didn’t notice that a1 could not be accessed outside its class due to the private keyword. Furthermore, i neglected that inheritance allowed methodA to be accessed in class B.
  • Answer D is correct because methodB can’t be used in the parent class in which it doesn’t exist. Furthermore, a1 can’t be accessed in class B.
  • I can watch 9.3 daily videos 1 and 2 to learn this concept.

Question 16

image

  • I got this wrong because I didn’t realize that the original snippet was iterating through the number of columns in line 5. I assumed that it was iterating for rows and therefore needed to be changed to arr.length.
  • Answer C is correct because row can only be iterated through an array, not a column.
  • I can watch 8.2 daily vides 1-3 to learn this concept.

Question 18

image

  • This answer is incorrect because I didn’t read and interpret the boolean values properly in the code snippet. I should have used sample values to see if the same result was achieved.
  • Answer E is correct because it recognizes that the opposite of the given expression would print cat and uses that in the if condition.
  • I can watch 3.6 videos 1 and 2 to learn this concept.

Question 19

image

  • This answer is incorrect because I once again did not take the time to evalulate the booleans myself with sample values. I also did not think to apply deMorgans law.
  • Answer A is correct because it utilizes deMorgans law.
  • I can watch 3.6 videos 1 and 2 to learn this concept.

Question 20

image

  • I got this question wrong because I did not notice the difference between < and <=. Furthermore, i didn’t notice that one of the snippets prints even numbers.
  • Answer E is correct because the original snippet only prints odd numbers up till 7. While this loops k limit has been changed to 8, it has no impact since k is incremented by 2 and therefore prints the same.
  • I can watch 4.2 daily videos 1-3 to learn this concept.

Question 24

image

  • I got this question wrong because I did not realize that the <= in the first for loop would result in the loop going to an index that did not exist if a 0 was not found. The only array in which this applies was D.
  • Option D is correct because it was the only array in which there was no 0, meaning the loop would have continued past arr.length-1 to a nonexistent index.
  • I can watch 8.2 daily videos 1-3 to learn this concept.

Question 32

image

  • I got this wrong because I did not realize that the option i select would result in the count being reset to 0 before being compared to the previous count.
  • Option E is correct because it allows for the count to be compared to the max and then reset to avoid overcounting.
  • I can watch 6.4 daily videos 1-3 to learn this concept.

Question 36

image

  • I got this wrong because I did not know the answer.
  • Option C is correct.
  • I can watch 9.6 daily videos 1-3 to learn this concept.

Question 47

image

  • I got this wrong because I did not remember the function of println properly and thought it would print the current statement on a new line.
  • Option C is correct because it would create a new line after “two”
  • I can watch 1.1 daily videos 1-3 to learn this concept.

Question 52

image

  • I got this wrong because I didn’t realize that the return was not specified. Furthermore void methods have no return.
  • Option B is correct because a void method should not return anything. Therefore it should modify price but not return a value.
  • I can watch 5.5 videos 1 and 2 to learn this concept. s