Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions on Using Objects and Methods, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Questions 151–160 of 681
  1. 151
  2. 152
  3. 153
  4. 154
  5. 155
  6. 156
  7. 157
  8. 158
  9. 159
  10. 160

Question 151

Multiple choice Using Objects
Consider the processWords method. Assume that each of its two parameters is a String of length two or more. public void processWords(String word1, String word2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 152

Multiple choice Using Objects
Which of the following statements assigns a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 153

Multiple choice Using Objects
Consider the following two methods, which are intended to return the same values when they are called with the same positive integer parameter n. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 154

Multiple choice Primitive Types
Consider the following code segment. double valOne = 5.75; double valTwo = 2.75; int x = (int) valOne + (int) valTwo; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 155

Multiple choice Using Objects
Consider the method replaceStr, which is intended to return a string that is identical to orig except that all occurrences of string a are replaced by string b.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 156

Multiple choice Using Objects
The following method prints the value of start and then prints every other value up to, and possibly including, end. For example, the method call printRun(1, 7)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 157

Multiple choice Using Objects
Consider the following method. / * * Precondition: lim >= 0 * / public static void printLetters(int lim) { for (int m = 0;m < lim;m++) { for (int n = 0;n <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 158

Multiple choice Using Objects
The following incomplete method is intended to simulate a spinner in a game by returning "red", "blue", or "green" with equal probability. public static String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 159

Multiple choice Primitive Types
Consider the following code segment. int r = 23; int t = 10; double a = r % t; double b = r / t;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 160

Multiple choice Using Objects
The following method is intended to return a string that is formed by exchanging the first and last characters of its string parameter. For example, the call…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 151 of 681
Page 16 of 69