Trace the Code.
Loop logic.
If / Else Reasoning
Debug the Idea
Vocabulary & Concepts
100

What does this code print?

int x = 8;

x = x + 4;

System.out.println(x);

It is 12

100

What does this loop show?

for (int i = 0; i < 5; i++) {

    System.out.print(i);

}

The answer is 0,1,2,3,4

100

What does it print?

int num = 7;

if (num > 5) {

    System.out.println("A");

} else {

    System.out.println("B");

}

It is A.

100

What mistake is in this code?

int num = 10;

if (num = 5) {

    System.out.println("Equal");

}

What is using = instead of ==.

100

This keeps data that can change while the program runs.

It is variable.

200

What do you see after running the code?

int num = 15;

if (num > 10) {

    System.out.println("Greater than 10"); // Prints: Greater than 10

} else {

    System.out.println("Not greater than 10");

}

It is Greater than 10 

200

What value comes out?
int sum = 0;

for (int i = 1; i <= 4; i++) {

    sum += i;

}

System.out.println(sum);

It is 10


200

Which letter shows up?

int score = 81;

if (score >= 90) {

    System.out.println("A");

} else if (score >= 80) {

    System.out.println("B");

} else {

    System.out.println("C");

}

It is B.

200

Why doesn’t this loop work?

for (int i = 0; i <= 5; i--) {

    System.out.println(i);

}

There is a loop that keeps running forever.

200

This repeats code as long as a condition is true.

It is a loop.

300

What do you see when it runs?

int a = 4;

int b = 2;

a = a * b;

b = a - b;

System.out.println(b);

It is 6.

300

How many times does the count go up?
int count = 0;

for (int i = 5; i > 0; i--) {

    if (i % 2 == 1) {

        count++;

    }

}

System.out.println(count);

The answer is 3.

300

What does it print?

int x = 4;

int y = 6;

if (x > 5 && y > 5) {

    System.out.println("Both");

} else if (x > 5 || y > 5) {

    System.out.println("One");

} else {

    System.out.println("None");

}

It is one.

300

What’s wrong with this loop?

int[] nums = {1, 2, 3};

for (int i = 0; i <= nums.length; i++) {

    System.out.println(nums[i]);

}


Past the array’s limits.

300

This operator sees if two values are the same.

It is ==

400

What does this code print?

int x = 3;

int y = x + 2;

x = y * 2;

System.out.println(x);

The answer is 10.

400

What will this print out?

for (int i = 2; i <= 8; i += 2) {

    System.out.print(i + " ");

}

It is 2,4,6,8

400

What will be printed by this code?

int temp = 65;

if (temp > 80) {

    System.out.println("Hot");

} else if (temp > 60) {

    System.out.println("Warm");

} else {

    System.out.println("Cold");

}

The answer is warm.

400

What’s the problem?

int score = 90;

if (score >= 90);

{

    System.out.println("A");

}

The if statement ends with a semicolon.

400

This keyword immediately ends a loop.

It is a break.

500

What is printed?

int a = 5;

a++;

a = a * 2;

System.out.println(a);

The answer is 12.

500

What value does total have at the end?

int total = 1;

for (int i = 1; i <= 3; i++) {

    total *= i;

}

System.out.println(total);

The answer is 6.

500

What does the program display?

int x = 10;

if (x < 5 || x > 8) {

    System.out.println("True");

} else {

    System.out.println("False");

}

It is true

500

Where is the mistake?

int x;

System.out.println(x);

The variable was not given an initial value.

500

This tests whether both conditions are true at the same time.

It is &&