Operators
Classes/Main & Println
If-else statements
Variables
Loops
100

Use operators to convert 153 minutes to hours and store it in a double variable called 'hours'

double hours = 153/60; 
100

What will the following statement print:

String flavor1 = "mint';

String flavor2 = "strawberry";

System.out.println(flavor1 + "chocolate" + flavor2 + "vanilla;");

mintchocolatestrawberryvanilla;

100

Type out the frame of an if-else statement.

if(condition)

{

    //statements

}

else

{

    //statements

}

100

What is wrong with the following code:

boolean isNum = 45;

Wrong datatype; boolean only stores true or false

100

What is the minimum number of times a while and do-while loop can run?

while = 0 times

do-while = 1 time

200

What is the "or or" sign?

||

200

T/F Main is not needed for a program to run.


False

200

Which statement is executed:

if(4 >= 5){

      statement1;
}

else

{

     statement2; 

}

statement 2

200

Declare and initialize a string variable that stores the color of a tablet as black. 

String color = "black";

200

What is another difference between while and do-while loops?

while = condition is checked before the loop body 

do-while = condition is checked after the loop body is executed

300

What operator is used to check if multiple conditions evaluate true?

&&

300

What is a class?

A class is the template that describes the data and behavior associated with everything in that class.

300

How do you check if the variable 'num' is odd?

if(num % 2 != 0)

{

     //statements

}

300
Declare and initialize a variable that stores the difference between your fathers age and your age.

int difference = ___ - ___;

300

Type the frame of a do-while loop.  

do

{

    //statements

} while(condition);

400

How would you type the condition "num is less than or equal to 11"

num <= 11

400

Type out the main method

public static void main(String [] args)

{

     //statements

}

400

How would you check if the variable 'num' is less than 5 AND greater than or equal to 1?

if(num < 5 && num >= 1){

     //statements

}

400

T/F String is a primitive data type.

False

400

Predict the output of the following:

int num = 18;

while(num % 3 == 0 && num > 5){

     System.out.println(num);

     num = num - 2;

}

18



500

What will (10 + 5%3 - 4)/2?

4

500

What will the following statement print:

double money = 32.74;

System.out.printf("%s$%s dollars.", "He has ", money);

He has $32.74 dollars.

500

What statement is executed:

int num = 345;

if(num == 345 && (num >= 5 || (num % 2 == 0)))

{

     //statement2;

}

else

{

    //statement1;

}

      

statement 2

500

What are the four primitive data types we learned in this class?

int, boolean, double, and char 

500

Predict the output of the following:

int num = 4;

do{

     System.out.println(num-1);

     num--;

}while(num < 4 && num > 0);

3

2

1

0

M
e
n
u