Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Practice Questions

Work through AP Computer Science A practice 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 361–370 of 546
  1. 361
  2. 362
  3. 363
  4. 364
  5. 365
  6. 366
  7. 367
  8. 368
  9. 369
  10. 370

Question 361

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 362

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 363

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 364

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 365

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 366

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 367

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 368

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 369

Multiple choice Using Objects
Consider the following code segment.
String s = "programming";
System.out.println(s.substring(3, 7) + "-" + s.indexOf("m"));
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 370

Multiple choice Using Objects
Consider the following declarations. String s1 = "abc"; String s2 = new String("abc");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 361 of 546
Page 37 of 55