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 361–370 of 681
  1. 361
  2. 362
  3. 363
  4. 364
  5. 365
  6. 366
  7. 367
  8. 368
  9. 369
  10. 370

Question 361

Multiple choice Primitive Types
What is printed? int a = 17, b = 5; int q = a / b; int r = a %…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 362

Multiple choice Using Objects
What is printed? String a = "Java"; String b = "java"; String c = "Java";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 363

Multiple choice Using Objects
What is printed by the following? String s = "ABCDEFGHIJ"; String t =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 364

Multiple choice Primitive Types
What is printed? Integer a = 7; Integer b = 3; String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 365

Multiple choice Using Objects
What is printed? String a = "code"; String b = "program"; int diff =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 366

Multiple choice Primitive Types

What is printed?

int x = - 15, y = 4;
int z = Math.abs(x) / y;
int w = Math.abs(x) % y;
System.out.println(Math.abs(z - w) + Math.pow(w, z));
Pick an answer, then check it. The solution opens in a window.

Question 367

Multiple choice Primitive Types

What is printed by the following code segment?

int a = 58;
int b = a / 10 + a % 10;
int c = b * b;
double d = Math.sqrt(c - 25);
System.out.println(b + " " + d);
Pick an answer, then check it. The solution opens in a window.

Question 368

Multiple choice Primitive Types

What is printed?

Integer x = 17;
Integer y = 5;
double result = Math.pow(x % y, x / y) + 0.5;
System.out.println(result);
Pick an answer, then check it. The solution opens in a window.

Question 369

Multiple choice Using Objects

What is printed?

String s = "abcabc";
int first = s.indexOf("bc");
String t = s.substring(first + 2);
int second = t.indexOf("bc");
System.out.println(first + " " + second + " " + (first + second + 2));
Pick an answer, then check it. The solution opens in a window.

Question 370

Multiple choice Using Objects

Consider the following code segment.

String s = "EXAMINATION";
int k = s.indexOf("NATION");
String t = s.substring(0, k) + s.substring(k + 3);
System.out.println(t + " " + t.length());

What is printed as a result of executing the code segment?

Pick an answer, then check it. The solution opens in a window.
Question 361 of 681
Page 37 of 69