Logical & Comparison Operators
If-Statements & Control Flow
Loops & Tracing
Strings & Methods
Trivia Time!
100

What is the only && relationship between two Booleans that results in true? 

true && true

100

In an if-elseif-else chain, how many branches will run?

Exactly one branch will run.

100

How many times does this loop run?

for (int i = 2; i < 6; i++)

4 times

100

If a String has length 6, what is its last index?

5

100

What is the smallest country in the world by land area?

Vatican City

200

What is the result of: !true || (false && true)?

false

200

What is printed?

int x = 7;
if (x > 5) System.out.print("A");
if (x > 2) System.out.print("B");
else System.out.print("C");

AB

200

What is printed?

int i = 1;
while (i < 4) {
    System.out.print(i);
    i++;
}

123

200

What does "hello".substring(1,4) return?

"ell"

200

Which element has the highest melting point of all elements?

Tungsten

300

Evaluate: 

(5 >= 5) && ( 3 < 1 || !(2 != 2) )

true

300

What is the difference between a single large if-else chain and several individual if statements?

A large if-else chooses only one true branch; several ifs evaluate all conditions independently.

300

What is the difference between these loops

for (int i = 0; i < 5; i++) { System.out.print(i);}

int i = 0;
while (i < 5) {
    System.out.print(i);
    i++;
}

They are equivalent!  A for loop and a while loop can be the same. 

300

What is returned by: "banana".indexOf("a")?

1

300

 What continent has the most countries?

 Africa (54 countries)

400

What is the result of:

"cat".equals("Cat") || (4 % 2 != 0)?

false

400

What is printed?

int n = 10;
if (n % 2 == 0)
    if (n > 5)
        System.out.print("X");
    else
        System.out.print("Y");

X

400

What is printed?

for (int r = 0; r < 2; r++) {

    for (int c = 0; c < 3; c++) {
        System.out.print("*");
    }

    System.out.println();
}

***
***

400

What is printed?

String s = "code";
for (int i = 0; i < s.length(); i++) {
    System.out.print(s.charAt(i));
}

code

400

Who was the first woman to win a Nobel Prize?

Marie Curie

500

Evaluate the full expression:
 !(7 > 2 && "hi".length() == 2) || (3 <= 1)

False

!(true && true) || false  
!true || false  
false || false  
false

500

What is printed?

int a = 4;
if (a < 10)
    if (a % 3 == 1)
        System.out.print("M");
    else
        System.out.print("N");
else
    System.out.print("P");

M

500

How many times does the inner loop run total?

for (int r = 0; r < 3; r++) {
    for (int c = 2; c <= 6; c += 2) {
        // work
    }
}

Inner runs 3 times each row → 3×3 = 9 total.

500

SURPRISE!  A question about Random!!!

Create a variable "rangeOfDays" and set it equal to a random number between 225 and 275, inclusive.  

int rangeOfDays = (int) (Math.random() * 51 ) + 225;

500

Which artist holds the record for the most streamed song on Spotify of all time?

The Weeknd (“Blinding Lights”)

M
e
n
u