
AP CSA Unit 3 Review
Authored by Mark Freeman
Computers
12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
17 questions
Show all answers
1.
OPEN ENDED QUESTION
3 mins • 1 pt
Consider the following code which uses the int variable boxes: if (boxes <= 0) { System.out.println("empty"); } else if (boxes < 12) { System.out.println("still need more"); } else { System.out.println("good enough"); } Which of the following will always produce the same result as the code above, regardless of the value of boxes?
Evaluate responses using AI:
OFF
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following incomplete code segment. Consider the following potential replacements for /* missing code */. Which of these replacements will cause the code segment to always print no?
(int) (Math.random()) * 15 → Math.random can produce a 0 so this would be correct
(int) (Math.random() * 10) + 5 → Math.random cannot produce a one so this would be the only false answer
(int) (Math.random() * 10) + 10 → Math.random * 10 can produce a 5
(int) (Math.random() * 15) + 15 → Math.random can produce a zero
(int) (Math.random() + 15) → This could be rounded off to a 15
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the variables, which boolean condition is true?
a < b && a == b → this can not be logically true
a < b && a != b → this can not be logically true
b >= a || a >= b → This is like the commutative property and a and b are the same value so this is true
a > b || a != b → Both premises are false in this case
None → Answer c is the correct answer
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following if statement determines the amount of customers that come in at the Java Restaurant. It uses the double variable low, amount, and high. Which replacement code is equivalent to the original if statement?
if (amount > low) { if (amount < high) { System.out.println("Amount of customers could be better."); } else { System.out.println("Amount of customers is great!"); } } else { System.out.println("Amount of customers is great!"); }
if (amount > low) { if (amount < high) { System.out.println("Amount of customers could be better."); } } else { System.out.println("Amount of customers is great!"); }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following truth table matches which boolean condition?
A && (A && B) → doesn’t apply to line 1
A || (!A && !B) → only applies to line 1
!A && (A || B) → equivalent to !A && B which the table reflects
A || (A || B) → only applies to line 4
!A && (A || !B) → does not apply to line 4
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
An app records the amount of boxes a warehouse has using the int amount. The app also uses a String variable diagnosis in order to determine if the warehouse requires more boxes. The values of both amount and diagnosis are shown below. Which of the following code segments will correctly set the value of diagnosis for any given value of amount?
if (amount >= 75) { diagnosis = "More than enough"; } if (amount <= 74) { diagnosis = "Enough"; } if (amount <= 50) { diagnosis = "Need more"; } else { diagnosis = "Need way more"; }
if (amount >= 75) { diagnosis = "More than enough"; } else if (amount >= 50) { diagnosis = "Enough"; } else if (amount >= 25) { diagnosis = "Need More"; } else { diagnosis = "Need way more"; }
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
To test if a grade (represented by the variable g) is a D (between 69 and 59, including 69 but excluding 59) you would use the following if statement: if ( g ______ 69 ______ g ______ 59 ) What set of three symbols correctly fills the blanks in the order they appear?
>=, &&, <= → g cannot be higher than 69
<, &&, > → g can be equal to 69
<=, &&, > → this is correct because g must be lower than or equal to 69 and it must be higher than 59
<, ||, > → It is not a either or case
<=, &&, >= → g cannot be equal to 59
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
20 questions
Latihan Soal Administrasi Infrastruktur Jaringan XII TKJ
Quiz
•
10th - 12th Grade
12 questions
Incident Response Policy 1 Quiz
Quiz
•
12th Grade
14 questions
AWS Cloud
Quiz
•
11th - 12th Grade
17 questions
Đề ôn tập cuối HKI lớp 5
Quiz
•
6th Grade - University
20 questions
Quiz on Excel
Quiz
•
12th Grade
20 questions
Database&Relation
Quiz
•
12th Grade
20 questions
Data structure test1
Quiz
•
12th Grade
18 questions
School Mangement System ICT 0417 IGCSE
Quiz
•
10th - 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
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
22 questions
El Imperfecto
Quiz
•
9th - 12th Grade
20 questions
SSS/SAS
Quiz
•
9th - 12th Grade
20 questions
verbos reflexivos en español
Quiz
•
9th - 12th Grade
14 questions
Making Inferences From Samples
Quiz
•
7th - 12th Grade
23 questions
CCG - CH8 Polygon angles and area Review
Quiz
•
9th - 12th Grade
8 questions
Momentum and Collisions
Lesson
•
9th - 12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade