APCSA Unit 3 Review
Assessment
•
Robyn Rose
•
Computers
•
9th - 12th Grade
•
23 plays
•
Hard
Improve your activity
Higher order questions
Match
•
Reorder
•
Categorization
actions
Add similar questions
Add answer explanations
Translate quiz
Tag questions with standards
More options
13 questions
Show answers
1.
Multiple Choice
Consider the code segment below
What is printed as a result?
int x = 10;
int y = 20;
System.out.print(y + x / y);
1
1.5
3
20
20.5
Answer explanation
ORDER OF OPERATIONS!!!
Division (INTEGER DIVISION) happens FIRST!
2.
Multiple Choice
Which of the following expressions evaluates to 1?
1. 2 / 5 % 3
2. 2 / (5 % 3)
3. 2 / 5 + 1
1 only
2 only
1 and 2 only
2 and 3 only
1, 2, and 3
Answer explanation
Divided by (/) and mod (%) have the same level of importance, so without parentheses we do them from left to right
3.
Multiple Choice
Consider the following:
int a = 2;
int b = 6;
int c = 3;
Which of the following expressions evaluates to false?
a < b == c < b
a > b == b < c
a < b != c < b
a < b != c < b
4.
Multiple Choice
Consider the following code segment
boolean a = true;
boolean b = true;
System.out.print((b || (!a || b)) + " ");
System.out.print(((!b || !a) && a) + " ");
System.out.println(!(a && b) && b);
true false false
true true true
true false true
false true false
5.
Multiple Choice
Consider the following code segment.
String str1 = new String("Happy");
String str2 = new String("Happy");
System.out.print(str1.equals(str2) + " ");
System.out.print(str2.equals(str1) + " ");
System.out.print(str1 == str2);
What is printed as a result of executing the code segment?
true true true
true true false
false true false
false false true
6.
Multiple Choice
Consider the following code segment, which is intended to store the sum of all multiples of 10 between 10 and 100, inclusive (10 + 20 + ... + 100), in the variable total.
int x = 100;
int total = 0;
while( /* missing code */ )
{
total = total + x;
x = x - 10;
}
Which of the following can be used as a replacement for /* missing code */ so that the code segment works as intended?
x < 100
x <= 100
x > 10
x >= 10
Explore this activity with a free account
Find a similar activity
Create activity tailored to your needs using
Computer Basics
•
6th - 8th Grade
Web Design
•
6th - 9th Grade
While Loops
•
9th - 12th Grade
CodeCombat
•
8th Grade
CodeHS JavaScript
•
8th - 12th Grade
Web Design
•
10th - 12th Grade
Integer Operations
•
6th Grade
Web Development Review
•
9th - 12th Grade