Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 39 pages
Exam (elaborations)

AP CSA Semester Exam Actual Complete Real Verified Exam Questions And Correct Answers (Verified Answers) Already Graded A+ | Newest Exam Version!!!

Document preview thumbnail
Preview 4 out of 39 pages

AP CSA Semester Exam Actual Complete Real Verified Exam Questions And Correct Answers (Verified Answers) Already Graded A+ | Newest Exam Version!!!

Content preview

1|Page


AP CSA Semester Exam Actual Complete Real Verified
Exam Questions And Correct Answers (Verified
Answers) Already Graded A+ | Newest Exam Version!!!


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)

,2|Page


}
System.out.println("D");
}


What, if anything, is printed when the code segment is
executed?
A. A
B. B
C. C
D. D
E. Nothing is Printed - Answer-B. B


Consider the following method that is intended to
determine fi the double values d1 and d2 are close
enough to be considered equal. For example, given a
tolerance of 0.001, the values 54. 32271 and 54.32294
would be considered equal.


/** @return true if d1 and d2 are within the specified
tolerance
* false otherwise
*/

,3|Page


public boolean almostEqual (double d1, double d2, double
tolerance)
{
/* missing code */
}


Which of the following should replace /* missing code */ so
that almost equal will work as intended?
A. return ( d1 - d2 ) <= tolerance
B. return (( d1 + d2 ) / 2 ) <= tolerance
C. return ( d1 - d2 ) >= tolerance
D. return (( d1 + d2 ) / 2 ) >= tolerance
E. return Math.abs( d1 - d2 ) <= tolerance - Answer-E.
return Math.abs( d1 - d2 ) <= tolerance


Consider the following method, biggest, which is intended
to return the greatest of three integer. It does not always
work as inteded.


public static int biggest(int a. int b, int c)
{

, 4|Page


if ( ( a > b ) && ( a > c ) )
{
return a;
}
else if ( ( b > a ) && ( b > c ) )
{
return b;
}
else
{
return c;
}
}


Which of the following best describes the error in the
method?
A. biggest always returns the value of A
B. biggest may not work correctly when c has the greatest
value
C. biggest may not work correctly when a and b has the
greatest value

Document information

Uploaded on
February 26, 2026
Number of pages
39
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$25.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
80
Followers
6
Items
6052
Last sold
1 month ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions