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.
Multiple choice
Using Objects
Question 472
Multiple choice
Primitive Types
Question 473
Multiple choice
Using Objects
Question 474
Multiple choice
Using Objects
Consider the following code segment.
String s = "method";
String t = s.substring(2);
int value = t.length() + s.indexOf(t.substring(1, 3));
What value is stored in value?
Pick an answer, then check it. The solution opens in a window.
ACorrect answer
Main Solution
Answer
Answer: A. t is "thod", so t.length() is 4. The expression t.substring(1, 3) is "ho", which begins at index 3 in "method". The total is 7.
Answer: Correct: A
A
7
B
6
C
5
D
3
Answer images
Question 475
Multiple choice
Using Objects
Question 476
Multiple choice
Using Objects
Question 477
Multiple choice
Primitive Types
Question 478
Multiple choice
Primitive Types
Question 479
Multiple choice
Primitive Types
Question 471 of 681
Page 48 of 69
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.

