
AP CSA Unit 3 Review
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Mark Freeman
Used 1+ times
FREE Resource
Enhance your content in a minute
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
Create a free account and access millions of resources
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
15 questions
User Interface Design - Topic 1
Quiz
•
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
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
