
AP CSA unit 1 - 4 TEST
Flashcard
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

23 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Consider the following code segment.
System.out.println("W");
System.out.println("X");
System.out.print("Y");
System.out.print("Z");
What is printed as a result of executing the code segment?
Back
W
X
YZ
2.
FLASHCARD QUESTION
Front
Consider the following code 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;
Back
II. only
3.
FLASHCARD QUESTION
Front
Consider the following code segment:
String str = "AP";
str += "CS " + 1 + 2;
System.out.println(str);
What is printed as a result of executing the code segment?
Back
APCS 12
4.
FLASHCARD QUESTION
Front
What is printed when the following code segment is executed?
public double calculate(double x)
{
return x + 1.5;
}
Double d1 = new Double(7.5);
System.out.println(calculate(d1));
Back
9.0
5.
FLASHCARD QUESTION
Front
Consider the following code segment, which is intended to display 6.0.
double fact1 = 1 / 2;
double fact2 = 3 * 4;
double product = fact1 * fact2;
System.out.println(product);
Which of the following best describes the error, if any, in the code segment?
Back
Either the numerator or the denominator of the fraction 1 / 2 should be cast as double.
6.
FLASHCARD QUESTION
Front
What is the expected output? -1, 0, 1, 17, 18
Back
17
7.
FLASHCARD QUESTION
Front
What does short circuit evaluation mean in the following code? if (a < b && c != d)
Back
if a < b is false it doesn't evaluate c != d
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
16 questions
Math Semester Exam
Flashcard
•
7th Grade - University
19 questions
Supply and Demand Vocabulary
Flashcard
•
9th - 12th Grade
21 questions
Environmental Awareness and Global Warming
Flashcard
•
KG
14 questions
Quiz 8/9 + Story Pyramid
Flashcard
•
9th - 12th Grade
20 questions
Atomic structure
Flashcard
•
9th Grade
20 questions
Irregular Verbs
Flashcard
•
9th Grade
15 questions
Pink Group
Flashcard
•
6th Grade - University
15 questions
Linear Relationships
Flashcard
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade