Primitive Types
Boolean Expressions and If Statements
Using Objects
Iteration
200

Order the following data types from smallest to largest:

char, boolean, double, int, String

boolean, char, int, double, String

200

boolean bool = 5 >7 - That code segment sets the value of bool to this

What is false?

200

String name = "Taylor";

System.out.println(name.substring(0,2);

Ta

200

When is it better to use a for loop instead of a while loop?

When you know exactly how many times you want a loop to run.

400

int y = (13-7) / 4;

1

400

This is the expression used to compare two values (non-Strings)

What is == (double equals)?
400

What is the Java API documentation used for?

It's used to see all the methods, fields and constructors for a particular class.

400

Set up a for loop for running through all the letters in a string called a and printing it to the screen

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

System.out.println(a.substring(0,1));


}

600

i=14,567;

i%=100;

What is 67?

600

This is the kind of statement that is usually found in between if and else statements

What are else if statements?

600

Math.random() generates a random number from this range

What is 0 to 1, including 0 but not 1?

600

What is the output?

for (int i = 12; i >= 5; i -= 3)
{
  System.out.print(i + " ");
}

12 9 6 

800

DAILY DOUBLE

This is what it's called when you change one variable type into another

800

When you use this kind of statement, it's usually to catch anything that didn't fit the conditions of the blocks before it

What is an else statement?

800

What would the fields be for the Rectangle class?

length and width

800

What is the output?

for (int i = 1; i < 4; i++)
{
  for (int j = 0; j < i; j++)
  {
    System.out.print(i);
  }
  System.out.println();
}

1

22

333

1000

Adding two Strings together is called this - kind of a long name for such a simple concept

What is concatenation?

1000

This is what to use when comparing equality in Strings

What is .equals?

1000

Describe the difference between autoboxing and unboxing in Java.

Converting an object of a wrapper type (Integer) to its corresponding primitive (int) value is called unboxing.

Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

1000

What is output by the following code?


for (int i = 1; i < 7; i++)
{
    for (int y = 1; y <= 5; y++)
    {
        System.out.print("*");
    }
    System.out.println();
}

A rectangle of 6 rows with 5 stars per row

M
e
n
u