NEW
Font size
WorksheetsCodeHS Unit 5 - Booleans
Total questions: 25
Worksheet time: 14mins
Which is not a valid value for a Boolean?
true
false
yes
None of these are correct.
Which symbol represents and in JavaScript?
&&
!
==
||
Which symbol represents or in JavaScript?
||
&&
>
!
What means that two values are equal in Boolean?
++
==
=
>=
Which means is not equal?
=!
||
!=
++!
What is the result of the following?
9 % 2?
1
4.5
7
11
What is missing? (fill in the blank)
_____(var i = 0; i < 5; i + +){
if
else
for
while
Which is appropriate for a variable name?
duke_Devils
1Duke
DUKE#1
Duke Devils
Which returns a random number between 1 and 55?
randomInt(1, 55)
randInt(1, 55)
Randomizer.int(1, 55)
Randomizer.netInt(1, 55)
How many possible values can Randomizer.nextBoolean() return?
0
1
2
3
How many possible values can Randomizer.nextBoolean() return?
0
1
2
3
Which statement will end a loop?
break
else
if
if else
Which is the correct way to obtain user input for a string?
readLine()
readInt()
readDouble()
readBoolean()
You must use quotations around a prompt in a readLine().
Example:
readLine("What's your name?");
True
False
What will this code segment output?
System.out.println("Hello");
System.out.println("World");
Hello
World
HelloWorld
Hello World
Hello
World
What will this code segment output if the user inputs the number 10?
int yourInteger = readInt("Input a number");
System.out.println(yourInteger);
yourInteger
"yourInteger"
10
"10"
His name is Fred and he is less than 16 years old
if (name = "fred" && age < 16 )
if (name === "fred" && age < 16 )
if (name = "fred" || age < 16 )
if (name === "fred" || age < 16 )
Repeat something 10 times
repeat 10
for (var i = 0; i < 10; i + +)
repeat { } until 10;
while (i = 10)
What is the symbol used for the INCREMENT operator in JS?
+
++
=
==
Loops in programming start counting from ?
0
1
Any number
100
What is ++ ?
Which of these is a loop?
if(x < 10)
while(x < 10)
var x = 10;
text (x,10; 10)
Which of these will increase the value of the variable X?
increment (x)
x + +;
x = x;
x + 1;
