100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

AP Computer Science A / Review Questions & Certified Solutions / 100% Correct / Already Graded A+.

Rating
4.7
(3)
Sold
-
Pages
163
Grade
A+
Uploaded on
28-04-2025
Written in
2024/2025

Terms in this set (203) Consider the following code segment. Sln("W"); Sln("X"); S("Y"); S("Z"); What is printed as a result of executing the code segment? D. W X YZ Consider the following code segment. S("cat "); Sln("dog "); Sln("horse "); S("cow "); What is printed as a result of executing the code segment? B. cat dog horse cow

Show more Read less
Institution
AP Computer Science A
Course
AP Computer Science A











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
AP Computer Science A
Course
AP Computer Science A

Document information

Uploaded on
April 28, 2025
Number of pages
163
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Content preview

Terms in this set (203)

Consider the following code D.
segment. W
System.out.println("W"); X
System.out.println("X"); YZ
System.out.print("Y");
System.out.print("Z");
What is printed as a result of
executing the code segment?


Consider the following code B. cat dog
segment. horse cow
System.out.print("cat ");
System.out.println("dog ");
System.out.println("horse ");
System.out.print("cow ");
What is printed as a result of
executing the code segment?


Consider the following code D. Hello!How are
segment. you?
System.out.print("Hello!");
System.out.println("How ");
System.out.print("are ");
System.out.print("you?");
What is printed as a result of
executing the code segment?



Consider the following code D. Changing print in line 2 to println
segment.
System.out.println(hello); // Line
1
System.out.print(world); // Line 2
The code segment is intended to
produce the following output but
does not work as intended.
hello world
Which of the following changes can
be made so that the code segment
produces the intended output?

,Consider the following code A. Changing print to println in lines 1 and 2
segment.
System.out.print("Ready"); // Line
1
System.out.print("Set"); // Line 2
System.out.print("Go!"); // Line 3
The code segment is intended to
produce the following output but
may not work as intended.
Ready
Set
Go!
Which change, if any, can be made
so that the code segment produces
the intended output?


Each of the following code A. I only
segments is intended to print the
word Hello. Which of the following
code segments works as intended?
I. System.out.print("Hello");
II. System.out.print(Hello);
III. System.out.print(He);
System.out.print(llo);



Which statement correctly declares B. double patientTemp;
a variable that can store a
temperature rounded to the
nearest tenth of a degree?




A teacher determines student C. int totalPoints; double
percentages in a course as the percentage;
points a student earns divided by
the total points available in the
grading period. Points are awarded
only in whole number increments,
but student percentages are to be
stored as decimals.
The following code segment
appears in a program used to
compute student percentages.
Points that a student earns are
stored in pointsEarned, the total
points available in the grading
period are stored in totalPoints, and
the student percentage is stored in
percentage.
int pointsEarned;
/ missing code /
Which of the following is most
appropriate to replace / missing
code / in the program?

,Consider the following code D. The variable x should be declared as a double and the variable y
segment: should be declared as a boolean.
/ data type 1 / x = 0.5;
/ data type 2 / y = true; Which of
the following best describes the
data types that should be used to
replace/ data type 1 / and / data
type 2 / so that the code segment
compiles without error?




Consider the following code D. x + 1
segment.
int x; int y; x = 3; y = / missing
expression /; x = 1 + 2 * y;
System.out.print(x);
System.out.println(y);
Which of the following can be used
as a replacement for / missing
expression / so that the code
segment prints 94 ?




The volume of a cylinder is equal to E. I, II, and III
the height times the area of the
circular base. The area of the
circular base is equal to π (pi) times
the square of the radius.
The code segment below is
intended to compute and print
the volume of a cylinder with
radius r and height h. Assume that
the double variables r, h, and pi
have been properly declared and
initialized. / missing code /
System.out.print(volume); Which of
the following can be used to replace
/ missing code / so that the code
segment works as intended?
I. double baseArea = pi r r;double
volume = baseArea * h; II. double
volume = pi r r;volume
= volume * h;
III. double volume = pi r r * h;

, Consider the following code B. II only
segment.
int x = 10; int
y = 20;
/ missing code /
System.out.print(top / bottom);
Which of the following replacements
for / missing code
/ will cause an
ArithmeticException to occur? I. int
top = x - y;int bottom = y x;
II. int top = 2 * x;int bottom
= y -top;
III. int top = x + y;int bottom
= 2 *top;



Consider the following code C. 3.0
segment.
int a = 1;
int b = 2;
int c = 3;
int d = 4;
double x = a + b * c % d; What is
the value of x when the code
segment has been executed?

Reviews from verified buyers

Showing all 3 reviews
7 months ago

7 months ago

7 months ago

4.7

3 reviews

5
2
4
1
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

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.
ExamsTest Abington State University
View profile
Follow You need to be logged in order to follow users or courses
Sold
3780
Member since
10 months
Number of followers
16
Documents
952
Last sold
1 week ago
Actual Tutor

Ace Your Exams with Premium Study Materials! Unlock your full potential with our expertly crafted revision materials. Whether you're prepping for exams, quizzes, or looking to solidify your understanding, Our study guides, summaries, and Questions banks are designated to simplify complex topics and enhance your knowledge retention. What to Expect Comprehensive Summaries: Key points made easy for quick revision. Test Banks: Practice with real exam- questions. Exam Prep Guides: Focused content to boost your scores. Instant Access: Download and start studying immediately! Don’t just study harder—study smarter! Excel in your exams with our trusted materials. Study, Learn and Excel

Read more Read less
4.4

1515 reviews

5
840
4
531
3
115
2
21
1
8

Recently viewed by you

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

Frequently asked questions