Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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 471–480 of 3,140
  1. 471
  2. 472
  3. 473
  4. 474
  5. 475
  6. 476
  7. 477
  8. 478
  9. 479
  10. 480

Question 471

Multiple choice Unit 1: Using Objects and Methods

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 472

Multiple choice Unit 1: Using Objects and Methods

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 473

Multiple choice Unit 1: Using Objects and Methods

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 474

Multiple choice Unit 1: Using Objects and Methods

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 475

Multiple choice Unit 1: Using Objects and Methods

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 476

Multiple choice Unit 1: Using Objects and Methods

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 477

Multiple choice Unit 1: Using Objects and Methods
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 478

Multiple choice Unit 1: Using Objects and Methods
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 479

Multiple choice Unit 1: Using Objects and Methods
Which of the following expressions generates a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 480

Multiple choice Unit 1: Using Objects and Methods
public static void modify(int number, String text) { number = number * 2; text = text + "!"; } public static void display() { int value…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 471 of 3,140
Page 48 of 314