Home Collegeboard 2014 MCQ Notes
Post
Cancel

Collegeboard 2014 MCQ Notes

Things I searched while taking the quiz:

  • Java Math random() Method (Q18): returns a pseudorandom double type number greater than or equal to 0.0 and less than 1.0
  • Difference between length and size Java: length is for Java array, size is for Java ArrayList collection object
  • What does Java substring a to b do (Q23): returns a string including character a, up to but NOT including character b
  • Java remove() (Q23): removes element at index k and returns the removed element
  • Rows and columns of 2d array (for visualization :D) 2d array
  • Does Java division with integers round down or up: rounds down

Questions I struggled with/almost got tricked by

Q16

Q16 I had a hard time understanding what this problem was sking and almost but k because result[k] and result[j] would match. But I eventually understood that all the values from a1 were copied over to result at the indexes, so then values from a2 would have to copied over starting at the k + a1.length, or else the values from a1 would just be replaced.

  • Practice Topic 6.4 (Developing Algorithms Using Arrays): Refer to Lesson 6

Q39

Q39 I almost got tricked and said 18 as the answer, which would be the case if in the else part it just said recur(n/3) instead of recur(recur(n/3)). With this, you must keep on looping until the recur(n/3) is less than or equal to 10, and when it is finally and 8, the whole thing will eventually return 8*2 which is 16.

  • Practice Topic 10.1 (Recursion): Refer to Lesson 10

Questions I got wrong:

Q2

Q2 The correct answer is int x = obj.getA();, and not int x = obj.myA();. myA is a private variable and can’t be accessed by other classes besides SomeClass. getA can be accessed though, because it is public method in SomeClass and other formatting is correct (can be assigned to int x since returns int, no parameters).

  • Practice topic 2.5 (Calling a Non-void Method): Refer to Lesson 2

Q15

Q15 The correct answer is I only, but I chose II only. I and II do essentially the same thing and fulfill the requirements of nondecreasing order, but II will have a ArrayIndexOutOfBoundsException because on the last iteration of k it will do data[k+1] which doesn’t exist since it is an index longer than the data and will result in an error.

  • Practice topic 6.2 (Traversing Arrays): Refer to Lesson 6

Q22

Q22 The correct answer is line 4 that won’t compile, since pagesPerMinute is a method in the AudioBookClass and variables that are type Book can only call methods from the Book class. I was stuck between 4 and 6 because for line 6 I thought there had to be an @Override before the length method, but I guess it automatically overrides here.

  • Practice topic 9.6 (Polymorphism): Refer to Lesson 9

Notes:

  • Need to pay attention to ArrayIndexOutOfBoundsException cases
  • Super helpful to write down/keep track of values as code executes and/or iterating
  • Know how to read pseudocode
This post is licensed under CC BY 4.0 by the author.