Font size
WorksheetsAP CSA Unit 1 Review
Total questions: 20
Worksheet time: 10mins
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?
WXYZ
W
XYZ
WX
YZ
W
X
YZ
W
X
Y
Z
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?
CS AP12
AP CS3
CSAP 12
APCS 12
APCS 3
What is the expected output?
-1
0
1
17
18
Which of these are escape characters? Choose all that apply!
\n
\t
\
"
/
Is the following identifier legal or illegal?
MyFirstProgram
legal
illegal
If x = 4, x++ =?
16
8
5
3
if int a = 10, what does b = if b= 15/4
1
5
0
3
In integer division, what happens to the decimal, such as int a = 25/10, where the answer would be 2.5?
the decimal is dropped
the number is rouneded
the program gives you an error
only the decimal is returned
Which of the following are primitive data types? (slect all that are)
int
float
String
triple
T/F? String is a primitive data type?
true
false
In our program, we need to track whether or not the score is 0 or not. What variable type can we use?
int
double
String
boolelan
What is %
percentage
negation
modulus, like division but the remainder is the answer
inverse
if x = 5, what is x +=30?
-25
0
35
5.30
What is the code for this output?
What is the code for this output?
What is the code for this output?
What will be the output of this code?
What is the code for this output?
What is the code for this output?
What is the code for this output?
