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 381–390 of 681
  1. 381
  2. 382
  3. 383
  4. 384
  5. 385
  6. 386
  7. 387
  8. 388
  9. 389
  10. 390

Question 381

Multiple choice Using Objects

What is printed?

String s = "COMPUTATION";
String a = s.substring(0, 3);
String b = s.substring(s.length() - 3);
String c = a + b;
System.out.println(c.indexOf("IO") + c.length());
Pick an answer, then check it. The solution opens in a window.

Question 382

Multiple choice Primitive Types

What is printed?

int a = 100;
a = a / 3;
a = a / 3;
a = a * 3 * 3;
System.out.println(a);
Pick an answer, then check it. The solution opens in a window.

Question 383

Multiple choice Primitive Types

What is printed?

int a = 5, b = 3, c = 2;
int r1 = a + b * c;
int r2 = (a + b) * c;
int r3 = r2 - r1;
int r4 = r1 * r3 / r2;
System.out.println(r4 + " " + (r1 + r2 + r3));
Pick an answer, then check it. The solution opens in a window.

Question 384

Multiple choice Primitive Types

What is printed?

int x = 7, y = 2;
double a = x / y;
double b = 1.0 * x / y;
System.out.println(a + " " + b + " " + (a == b));
Pick an answer, then check it. The solution opens in a window.

Question 385

Multiple choice Primitive Types

What is printed?

int p = 50, q = 8;
int d = p / q;
int r = p % q;
double val = Math.pow(d, r) - Math.pow(r, d - r * 2);
System.out.println(val);
Pick an answer, then check it. The solution opens in a window.

Question 386

Multiple choice Using Objects

What is printed?

String s1 = "APPLE";
String s2 = "APPLICATION";
boolean a = s1.compareTo(s2) < 0;
boolean b = s1.equals(s2.substring(0, s1.length()));
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 387

Multiple choice Using Objects

What is printed?

String word = "ABRACADABRA";
String first = word.substring(0, 4);
String last = word.substring(word.length() - 4);
System.out.println(first.equals(last) + " " + first.compareTo(last));
Pick an answer, then check it. The solution opens in a window.

Question 388

Multiple choice Primitive Types
public static double computeAverage(int total, int count) { return total /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 389

Multiple choice Using Objects
public static String getResult() { String text = "banana"; int len = text.length(); String part =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 390

Multiple choice Primitive Types
Which of the following expressions generates a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 381 of 681
Page 39 of 69