Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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 251–260 of 2,811
  1. 251
  2. 252
  3. 253
  4. 254
  5. 255
  6. 256
  7. 257
  8. 258
  9. 259
  10. 260

Question 251

Multiple choice Unit 1: Using Objects and Methods
Assume that the String variables str1 and str2 have been properly declared and initialized. Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 252

Multiple choice Unit 1: Using Objects and Methods
Which of the following statements will print 1234? I. System.out.print(12 * 100…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 253

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment: String phrase = "Hello, world!"; int index = phrase.indexOf("world"); if (index >= 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 254

Multiple choice Unit 1: Using Objects and Methods
Consider the following code snippet: public class MathOperations { public static void main(String[] args) { int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 255

Multiple choice Unit 1: Using Objects and Methods

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 256

Multiple choice Unit 1: Using Objects and Methods
Given the following code segment: String s = "ALASKA"; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 257

Multiple choice Unit 1: Using Objects and Methods
What is the result when the following code segment is compiled and executed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 258

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. String s = "ban"; ArrayList<String> words = new ArrayList<String>(); words.add(s); words.add(s.substring(1));…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 259

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public double goFigure(int n) { n %= 7; return (double) (12 / n); } What is printed…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 260

Multiple choice Unit 1: Using Objects and Methods
Consider the following method. public int locate(String str, String oneLetter) { int j = 0; while (j < str.length() &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 251 of 2,811
Page 26 of 282