
Quiz U3B - CSA
Authored by Matthew Fahrenbacher
Computers
9th - 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
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which is an equivalent way to write the following boolean expression? Assume that x and y are int variables that have been properly declared and initialized.
!(x == 4 && y <= 5)
x !=4 && y >= 5
x != 4 && y > 5
x != 4 || y >= 5
x != 4 || y > 5
2.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which is an equivalent way to write the following boolean expression? Assume that x is an int variables that have been properly declared and initialized.
!(x >= 5 || x != 3)
x <= 5 && x == 3
x < 5 || x == 3
x <= 5 || x == 3
x == 3
Answer explanation
x < 5 && x == 3 is an equivalent expression using DeMorgan's Law (I didn't give you this as a choice though!). But if x is both less than 5 and equal to, then the only way those statements can both be true is if x is exactly 3.
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which if case would check whether an int variable ppm is between 29 and 31, inclusive?
if(29 <= ppm <= 31)
if(29 <= ppm || ppm <= 31)
if(29 <= ppm && ppm <= 31)
if(ppm - 30 <= 1)
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which if case would check if water is NOT in liquid form based on a temperature variable named temp of type double, measured in Fahrenheit? Recall that water freezes at 32 and boils at 212.
if(temp <= 32 || temp >= 212)
if(temp <= 32 && temp >= 212)
if(32 <= temp <= 212)
if(temp >= 32 && temp <= 212)
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Consider the following variables that represent time:
int hour; // valid range: 0 - 23
int minute; // valid range: 0 - 59
Which one of the following expresses the interval from 7:15 to 9:15?
hour == 7 || hour == 8 || hour == 9 && minute <= 15
hour == 7 && minute >= 15 || hour == 9 && minute <= 15
hour >= 7 && minute >= 15 || hour <= 9 && minute <= 15
hour == 7 && minute >= 15 || hour == 8 || hour == 9 && minute <= 15
hour == 7 || minute >= 15 && hour == 8 && hour == 9 || minute <= 15
6.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
int y = 5;
int x = 0;
Which of the following if cases will not crash? [Short Circuit Evalution!]
if(y / x > 1)
if(x != 0 && y / x > 0)
if(y / x > 0 && x != 0)
if(x != 0 || y / x > 0)
7.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
The boolean expression (A || B) && A is true...
whenever A is true
whenever B is true
whenever either A is true or B is true
whenever both A is true and B is true
In all cases
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?