AP® Computer Science A Using Objects and Methods Practice Questions
Work through AP Computer Science A practice 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.
Question 532
Question 533
Question 534
Question 535
Question 536
Question 537
String s1 = "AP";
String s2 = s1 + "CSA";
String s3 = "APCSA";
Which of the following statements must be true?Main Solution
Answer
Answer: B. s2 and s3 contain the same characters, so equals returns true. But s2 is produced by concatenating a variable with a literal, so it is not the same reference as s3; therefore s2 == s3 is false.
Answer: Correct: B
A
s2 == s3 is true.
B
s2.equals(s3) is true, but s2 == s3 is false.
C
s1 == s2 and s2 == s3 are both true.
D
s1.equals(s2) is true.
Answer images
Question 538
Question 539
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.

