Variables Math and Boolean Expressions Conditionals Loops Arrays
100
int, double, boolean, char, float
Name three different types of primitive variables.
100
TRUE
Evaluate NOT TRUE OR TRUE
100
if, if/else, else if
Name the three types of conditional statements.
100
for, while
What are the two main types of loops?
100
vehicles[1]
How would you access “car” in the following array? vehicles = [“bus”, “car”, “train”, “truck”]
200
A primitive variable is a basic data type defined by the coding language and its reserved works but a non-primitive type variable is often created by the programmer and isn't defined in the coding language.
What is the difference between a primitive variable and non-primitive variable?
200
True
What does this expression evaluate to?
(True and True) or (False or False) and (False or False)
200
“Perfect number of books!”
“Time to read...”
What will be printed?
int numBooks = 25
if (numBooks < 10) {
System.out.println(“I need more books!”);
} else if (numBooks > 30) {
System.out.println(“Where do I put all my books??”);
} else {
System.out.println(“Perfect number of books!”);
}
System.out.println(“Time to read...”);
200
50 times
How many times “Girls Who Code” be printed out?
int i = 0;
while (i < 10) {
for (int j = 0; j < 5; j++) {
System.out.println(“Girls Who Code”);
}
i++;
}
200
boba
Drinks = [[‘coffee’, ‘tea’, ‘boba’], [‘smoothie’, ‘juice’, ‘soda]]
What is returned by drinks[0][2]?
300
new, full name
Which of the following are invalid variable names:
new, name, full name, age?
300
false
If i = 5, evaluate i >= 2 AND i < 4
300
Nothing is printed!
What is printed by the following code?
int numDogs = 5;
if (numDogs < 5) {
System.out.println(“Woof!”);
} else if (numDogs > 5) {
System.out.println(“Woof Woof!!”);
}
300
120
What will be returned?
y = 5
count = 0
while (y >= 0):
for x in range(20):
count += 1
y -= 1
return count
300
True, for example, arr[-1] would return the last element of arr, arr[-2] would return the second to last element of arr, and so on.
True or False… python supports negative indexing for arrays.
400
No, because when we try to store a double in an int, it is a lossy conversion.
Is this valid, why or why not?
int height = 180.65;
400
true
Evaluate the boolean expression NOT((3==2) AND ((3 != 1.5 * 2) OR true))
400
if (testScore < 60) {
System.out.println(“F”);
} else if (testScore < 70 && test score >= 60) {
System.out.println(“D”);
} else if (testScore < 80 && test score >= 70) {
System.out.println(“C”);
} else if (testScore < 90 && test score >= 80) {
System.out.println(“B”);
} else {
System.out.println(“A”);
}
Given a testScore variable between 0 and 100, write code that will print out the letter grade.
400
8
11
14
17
What will be printed?
x = 5;
while (x < 17):
x += 3
print(x)
400
int[] arr = new int[10]
for (int i = 0; i < arr.length; i++) {
arr[i] = 2*i + 5;
}
Write code in Java that accomplishes the following task (use a for loop): for each index i of an array of length 10, store 2*i + 5 in that index.
500
5 different variables of the types: int, double, boolean, char, String
Initialize and declare 5 variables, each of a different data type (primitive and non-primitive).
500
Answers may vary
Example:
NOT((5 != 5) OR ((7 < 3) AND (13 == 13)))
Write a boolean expression, which evaluates to true, and contains <, and, or, not, !=, ==
500
if (temperature > 70):
print ("Warm")
else:
print("Cold")
Write a conditional statement to evaluate and let you know whether it is cold or warm (by using the temperature variable, which is already defined). If the temperature is above 70, then it is warm, otherwise it is cold.
500
10
What does the following code print?
int[] nums = {5, 1, 4, 3, 7};
int sum = 0;
for (int i = 2; i >= 0; i--) {
sum += nums[i]
}
System.out.println(sum);
500
Out of bounds error
fruits = [[strawberries, blueberries, raspberries], [peach, plum], [orange]]
What is returned by fruits[2][1]?






Girls Who Code Jeopardy

Press F11 for full screen mode



Limited time offer: Membership 25% off


Clone | Edit | Download / Play Offline