No student devices needed. Know more
16 questions
Which of the following is NOT a relational operator?
!=
>=
/=
<=
Which of the following is NOT a logical operator?
!
==
&&
||
a || b is true if and only if either a is true or b is true, but not both.
true
false
Which of the following operators cannot be applied to boolean variables?
||
!=
>=
==
Given
String str1, str2;
What does str1 < str2 compare?
The addresses of the strings
The lengths of the strings
The contents of the strings in lexicographic order (as in a dictionary)
Nothing: this is not allowed in Java syntax
What is an If Statement?
An expression that evaluates if a variable is true or false
A statement that tests if two values are equal
A type of conditional that lets you complete a task if the condition is "true"
A statement that tests if two values are unequal
Which of the following is the Boolean expression in this code?
The If Else Statement
sprite.x < sprite.y
sprite.setAnimation("sprite2")
function draw()
var sprite = createSprite(200, 200)
What is a Conditional Statement?
A part of the code that allows you to perform different actions depending on which is true or false
A variable that has a value of true or false
A part of the code that tells you if a value is less than another value
A part of the code that tests whether or not two values are equal
Is "3" == 3 True?
Yes, same number
No, One is in quotes.
What Comparison operator can be used to check if someone is 18 or older?
age >= 18
age <= 18
age > 18
age < 18
Which numbers would cause the Boolean expression "variable=<14" to be true?
3,17,20
14,18,20
1,11,14
13,14,15
int b=5;
if(b>3 && b>10)
System.out.print("fun");
System.out.print("go");
go
fun
gofun
fungo
funfun
int d=5;
if(d>3 || d<0)
System.out.print("fun");
else
System.out.print("go");
go
fun
gofun
fungo
there is no output
How does an ‘IF’ statement differ from a while loop?
An IF statement is always run once; a WHILE loop is run as long as the condition in the parentheses is true.
A WHILE loop is always run once; An if Statement is run as long as the condition in the parentheses is true
An IF statement can only be run while the condition is false; the WHILE loop can only be run as long as the condition is false
An IF statement is always longer than a WHILE statement
What does it mean to “initialize” a variable?
It is given its initial value to store
It is given a value which may not be changed
Explore all questions with a free account