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 481–490 of 3,140
  1. 481
  2. 482
  3. 483
  4. 484
  5. 485
  6. 486
  7. 487
  8. 488
  9. 489
  10. 490

Question 481

Multiple choice Unit 1: Using Objects and Methods
public static int square(int n) { return n * n; } public static int compute(int x, int y)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 482

Multiple choice Unit 1: Using Objects and Methods
public static String combine(String first, String second) { return "" +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 483

Multiple choice Unit 1: Using Objects and Methods
public static int compute(int value) { double squared = Math.pow(value, 2);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 484

Multiple choice Unit 1: Using Objects and Methods
The Book class is defined as follows: public class Book { private String title; private int pages; public Book(String t, int p) { title = t; pages = p; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 485

Multiple choice Unit 1: Using Objects and Methods
What is printed?
int a = 88;
a = a / 6;
a = a / 4;
a = a * 4 * 6;
System.out.println(a);
Pick an answer, then check it. The solution opens in a window.

Question 486

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

Multiple choice Unit 1: Using Objects and Methods
What is printed?
int x = 73;
int a = x / 10;
int b = x % 10;
int y = b * 10 + a;
int z = y / 10 + y % 10;
System.out.println(z);
Pick an answer, then check it. The solution opens in a window.

Question 488

Multiple choice Unit 1: Using Objects and Methods
What is printed?
int p = 40, q = 9;
int d = p / q;
int r = p % q;
double val = Math.pow(d, r - 1) + Math.pow(r, d - 2);
System.out.println(val);
Pick an answer, then check it. The solution opens in a window.

Question 489

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

Multiple choice Unit 1: Using Objects and Methods
What is printed?
int a = 6, b = 4, c = 3;
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 481 of 3,140
Page 49 of 314