2014 Practice Exam MCQ - Review Ticket

2014 Practice Exam MCQ - Scores

My score is 24/40 (60%). 24 questions correct, 16 questions incorrect.

2014 Practice Exam MCQ - Reflection

I made multiple mistakes because I didn’t fully understand key concepts, including static methods (Question 2) and integer division (Question 4). Some of them, such as Questions 9 and 26, happened because I missed looking at how loops or indices function, indicating that I need to improve my implementation skills. A few failures, such as in Question 33, were caused by misreading logic conditions; so, I need to improve my skills in interpreting and debugging boolean expressions.

image-17.png

2014 Practice Exam MCQ - Corrections

Question 2

image.png

  • D is incorrect since getA is not a static method, it must be called with an object of SomeClass rather than the class name.

Question 4

image-2.png

  • B is incorrect because this would be the result if the division used was floating point division, instead of integer division. This would be the case if either x or y were of type double instead of type int or if either value was typecast as a double in the expression.

Question 9

image-3.png

  • C is incorrect because the element at index 0 will be excluded from the sum, since i starts at 1 instead of 0. When i is key.length an ArrayIndexOutOfBoundsException will be thrown.

Question 21

image-4.png

  • E is incorrect since an enhanced for loop rather than a standard for loop is used, the value of num is an element in mat and not necessarily a valid column value of mat.

Question 22

image-5.png

  • E is incorrect because the element at index 1 was initialized wo a new Book object in line 3.

Question 25

image-6.png

  • C is incorrect because Choice I and Choice II allow comparisons of dimensions to determine if one box can fit inside another, Choice III is flawed because smaller surface area or volume does not guarantee that a box can fit.

Question 26

image-7.png

  • B is incorrect because this algorithm use a for loop with a loop control variable k that has an initial value of 1, and increments by 1 until k is arr.length. While this algorithm accesses the elements of arr correctly to check whether the values are odd, the indices for arrays start at 0, meaning if arr[0] is odd, it will be skipped and not printed.

Question 28

image-8.png

  • It’s not B because if the value of n is 2 or less in the original call to the method mystery, the loop will be skipped and x will be 1 at //Point C.

Question 29

image-9.png

  • It’s not B because this will print the values [1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, and 97]. This will output the same number of values but the values will not be the same.

Question 30

image-10.png

  • It’s not B because this would be the result if the first call to substring was word.substring(howFar, word.length()).

Question 31

image-11.png

  • It’s not B since passing a reference parameter results in the formal parameter and the actual parameter being aliases. They both refer to the same object. Any updates made to the referenced array when mystery is called are being made on the single array that is reference by both data and values. When data[k + 1] is updated, this value new value should be used in the subsequent calculations.

Question 33

image-12.png

  • It’s not C because this would be correct if the boolean condition was changed from an or (   ) to an and (&&). Since k is never incremented, the or (   ) will always be true since k will always be less than 4 and an infinite loop will occur.

Question 34

image-13.png

  • It’s not D because Choice III uses the default Point constructor to assign center a new Point with x and y both equal to 0. It attempts to update x and y, however since they are private instance variables in Point, they are not able to be accessed directly in Circle. This code will cause a compile time error.

Question 38

image-14.png

  • It’s not D because this expression will evaluate to false whenever y is less than 10000 regardless of whether x is in the correct range between 1000 and 1500.

Question 39

image-15.png

  • It’s not A because the value of recur(4) is 8, however the result of this recursive call is passed as a parameter to our final recursive call. The call recur(8) returns 16.

Question 40

image-16.png

  • Option D is incorrect because when whatsItDo(“W”) is called, nothing is printed since the print occurs in the if statement which does not execute. All previous recursive method calls print a substring of str and not str.