Data Types and Variables
Casting and Arithmetic
Algorithms, Tracing, and Output
Expressions and Operators
BONUS - Finish each row to choose these
100

What primitive data type would you use to store the number of students in a classroom?

int – used for whole numbers like the number of students.

100

What is casting in Java?

Converting one data type to another manually using syntax like (int) or (double).

100

What is an API? 

Documentation for using methods and classes; a set of instructions for writing code
100

What is the result of 15 % 4?

3 – 15 divided by 4 leaves a remainder of 3.

100

How many dots appear on a pair of dice?

42

1+2+3+4+5+6 = 21

two dice = 42

200

What is the difference between a primitive and a reference data type in Java?

Primitive types store values directly (e.g., int, double); reference types (e.g., String, arrays) store memory addresses.

200

What is the result of casting the double 9.8 to an int?

9 – truncates the decimal part.

200

What does the following code output?

int x = 10;
x++;
System.out.println(x);

11 – x++ increases x after the statement.

200

What does the ++ operator do to a variable?

Increases the variable by 1.


200

Which is the only body part that is fully grown from birth?

Eyes

300

What keyword makes a variable constant and unable to be reassigned?

final – makes a variable unchangeable after initialization.

300

Why is casting not needed when assigning an int to a double?

Because it’s a automatic widening conversion and is allowed; no data is lost.

300

Trace this code and give the final value of y:

int x = 2;
int y = x * 3 + 1;

7 – 2 * 3 + 1 = 7

300

Which operators are evaluated first: *, /, %, +, or -?

*, /, and % are evaluated before + and -

300

Which country is credited with inventing ice cream? 

China

400

What happens if you try to assign a String to an int variable?

Compile-time error – incompatible types.

400

What is the output of:

int x = (int)(3.7 + 0.5);
 System.out.println(x);

AND what does this formula do? 

4 – 3.7 + 0.5 = 4.2 → cast to int becomes 4.

This is the formula for ROUNDING A POSITIVE NUMBER. 

400

What is the definition of an algorithm?

A step-by-step procedure for solving a problem

400

What is the output of:

System.out.println(8 % 3 * 2);


4  

8 % 3 = 2; 

2 * 2 = 4

400

Which country has the most islands?

Sweden (270,000)

500

What is the output of the following code?

int a = 5;
double b = 2.0;
System.out.println(a / b);

2.5 – int divided by double results in a double.

500

Identify the error:double x = 5 / 2; Why does this not result in 2.5?

3.5 – casting a 7 to a double results in double division that produces decimal result.

500

What will this code output?

int a = 5;
a += 3;
a--;
System.out.println(a);

7

a = 5 + 3 = 8; 

a-- = 7

500

Evaluate the expression to find the value of result:

int result = 5 + 2 * 3 % 4;

7

2 * 3 = 6; 

6 % 4 = 2; 

5 + 2 = 7

500

What is the highest-rated film on IMDb as of January 1, 2024?

The Shawshank Redemption

M
e
n
u