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.

Subtopic: Using Objects Clear filter

Questions 271–280 of 454
  1. 271
  2. 272
  3. 273
  4. 274
  5. 275
  6. 276
  7. 277
  8. 278
  9. 279
  10. 280

Question 271

Multiple choice Using Objects
What is printed?
String s = "TRIGONOMETRY";
int k = s.indexOf("NOM");
String t = s.substring(k, k + 4);
System.out.println(t + " " + t.indexOf("O"));
Pick an answer, then check it. The solution opens in a window.

Question 272

Multiple choice Using Objects
What is printed?
String s = "PARAMETRIC";
int n = s.indexOf("MET");
String out = s.substring(n - 2, n + 5);
System.out.println(out);
Pick an answer, then check it. The solution opens in a window.

Question 273

Multiple choice Using Objects
What is printed?
String s1 = "CAT";
String s2 = "CATALOG";
boolean a = s1.compareTo(s2) > 0;
boolean b = s2.substring(0, s1.length()).equals(s1);
boolean c = s1.length() < s2.length();
System.out.println(a + " " + b + " " + c);
Pick an answer, then check it. The solution opens in a window.

Question 274

Multiple choice Using Objects
What is printed?
String word = "ABCABC";
String first = word.substring(0, 3);
String last = word.substring(word.length() - 3);
System.out.println(first.equals(last) + " " + first.compareTo(last));
Pick an answer, then check it. The solution opens in a window.

Question 275

Multiple choice Using Objects
What is printed?
String s = "ENGINEERING";
int i = s.indexOf("NEE");
String t = s.substring(0, i) + s.substring(i + 3);
System.out.println(t + " " + t.length());
Pick an answer, then check it. The solution opens in a window.

Question 276

Multiple choice Using Objects
Consider the following code segment.
String s = "Advanced Placement";
int n = s.length() - s.indexOf("P");
String t = s.substring(s.length() - n);
What value is stored in t after the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 277

Multiple choice Using Objects
Consider the following code segment. double y = Math.sqrt(Math.pow(3, 2) +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 278

Multiple choice Using Objects
Consider the following code segment. int a = 3, b = 4; System.out.println("sum: " + a +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 279

Multiple choice Using Objects
Consider the following code segment. int r = Math.abs(-3 * 4) -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 280

Multiple choice Using Objects
Consider the following code segment. String s = "Computer Science";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 271 of 454
Page 28 of 46