unit 3.pdf - AP Computer Science A unit 3 Test Booklet Name...

This preview shows page 1 - 3 out of 11 pages.

AP Computer Science ATest Bookletunit 3Name1.Consider the following code segment.String str1 = new String("Advanced Placement");String str2 = new String("Advanced Placement");if (str1.equals(str2) && str1 == str2){System.out.println("A");}else if (str1.equals(str2) && str1 != str2){System.out.println("B");}else if (!str1.equals(str2) && str1 == str2){System.out.println("C");}else if (!str1.equals(str2) && str1 != str2){System.out.println("D");}What, if anything, is printed when the code segment is executed?AABCDNothing is printed.BCDE
Copyright © 2021. The College Board. These materials are part of a College Board program. Use or distribution of these materials online or in print beyond yourschool’s participation in the program is prohibited.Page 1 of 11
AP Computer Science ATest Bookletunit 32.A teacher put three bonus questions on a test and awarded 5 extra points to anyone who answered all threebonus questions correctly and no extra points otherwise. Assume that thebooleanvariablesbonusOne,bonusTwo,andbonusThreeindicate whether a student has answered theparticular question correctly.Each variable was assignedtrueif the answer was correct andfalseif the answer was incorrect.Which of the following code segments will properly update the variablegradebased on a student'sperformance on the bonus questions?
Copyright © 2021. The College Board. These materials are part of a College Board program. Use or distribution of these materials online or in print beyond yourschool’s participation in the program is prohibited.Page 2 of 113.Assume that the boolean variables a, b, c, and d have been declared and initialized. Consider the followingexpression.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 11 pages?

Upload your study docs or become a

Course Hero member to access this document

Newly Uploaded Documents

Show More

Newly Uploaded Documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture